Class ImageFactory


  • public class ImageFactory
    extends java.lang.Object
    Utility class for image manipulation.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Sep 23, 2013
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.LinkedHashMap<java.lang.Float,​java.lang.String> slabExtMap  
      private static java.util.LinkedHashMap<java.lang.Float,​java.lang.String> slabMap  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageFactory()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String getFileName​(float f, java.lang.String defaultFileName, java.util.HashMap<java.lang.Float,​java.lang.String> fNames)
      Retrieve the file name that matches best the proportions to be displayed
      private java.lang.String getFileName​(int width, int height)
      Compute the filename based on the stretching factor
      java.lang.String getFileNameExt​(double width, double height, int capWidth)
      Compute the filename based on the stretching factor
      javafx.scene.image.Image getSlabImage​(javafx.geometry.Dimension2D dim)
      Draw a borderless stone slab
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • slabMap

        private static java.util.LinkedHashMap<java.lang.Float,​java.lang.String> slabMap
      • slabExtMap

        private static java.util.LinkedHashMap<java.lang.Float,​java.lang.String> slabExtMap
    • Constructor Detail

      • ImageFactory

        public ImageFactory()
    • Method Detail

      • getFileName

        private java.lang.String getFileName​(int width,
                                             int height)
        Compute the filename based on the stretching factor
        Parameters:
        width - of the button
        height - of the button
        Returns:
        best matching stone slab image file name
      • getFileName

        private java.lang.String getFileName​(float f,
                                             java.lang.String defaultFileName,
                                             java.util.HashMap<java.lang.Float,​java.lang.String> fNames)
        Retrieve the file name that matches best the proportions to be displayed
        Parameters:
        f - result of the division of the displayable width through the displayable height
        defaultFileName - default file name to be used
        fNames - Hashmap to be used with the file names
        Returns:
        file name
      • getSlabImage

        public javafx.scene.image.Image getSlabImage​(javafx.geometry.Dimension2D dim)
        Draw a borderless stone slab
        Parameters:
        dim - dimension of the image
      • getFileNameExt

        public java.lang.String getFileNameExt​(double width,
                                               double height,
                                               int capWidth)
        Compute the filename based on the stretching factor
        Parameters:
        width - of the button
        height - of the button
        Returns:
        best matching stone slab extension file name.