Class ImageFactory
- java.lang.Object
-
- ch.sahits.game.openpatrician.javafx.control.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 displayedprivate java.lang.String
getFileName(int width, int height)
Compute the filename based on the stretching factorjava.lang.String
getFileNameExt(double width, double height, int capWidth)
Compute the filename based on the stretching factorjavafx.scene.image.Image
getSlabImage(javafx.geometry.Dimension2D dim)
Draw a borderless stone slab
-
-
-
Method Detail
-
getFileName
private java.lang.String getFileName(int width, int height)
Compute the filename based on the stretching factor- Parameters:
width
- of the buttonheight
- 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 heightdefaultFileName
- default file name to be usedfNames
- 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 buttonheight
- of the button- Returns:
- best matching stone slab extension file name.
-
-