Package com.ardor3d.image.util
Class GeneratedImageFactory
java.lang.Object
com.ardor3d.image.util.GeneratedImageFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Image
create1DColorImage
(boolean useAlpha, ReadOnlyColorRGBA... colors) Creates a one dimensional color image using each color given as a single pixel.static Image
createColorImageFromLuminance8
(Image lumImage, boolean useAlpha, ReadOnlyColorRGBA... colorTable) Converts an 8 bit luminance Image to an RGB or RGBA color image by mapping the given values to a corresponding color value in the given colorTable.static Image
createLuminance8Image
(Function3D source, int width, int height, int depth) Creates an 8 bit luminance image using the given function as input.static Image
createLuminance8Image
(Function3D source, int width, int height, int depth, double startX, double endX, double startY, double endY, double startZ, double endZ, double rangeStart, double rangeEnd) Creates an 8 bit luminance image using the given function as input.static Image
createSolidColorImage
(ReadOnlyColorRGBA color, boolean useAlpha, int side) Creates a side x side sized image of a single solid color, of data type byte.static void
fillInColorTable
(ReadOnlyColorRGBA[] colors) Fill any empty spots in the given color array by linearly interpolating the non-empty values above and below it.
-
Constructor Details
-
GeneratedImageFactory
public GeneratedImageFactory()
-
-
Method Details
-
createSolidColorImage
Creates a side x side sized image of a single solid color, of data type byte.- Parameters:
color
- the color of our imageuseAlpha
- if true, the image will have an alpha component (whose value will come from the supplied color.)side
- the length of a side of our square image- Returns:
- the new Image
-
create1DColorImage
Creates a one dimensional color image using each color given as a single pixel.- Parameters:
useAlpha
- if true, the image will have an alpha component (whose value will come from each supplied color.)colors
- one or more colors- Returns:
- a 1D image, width == colors.length
-
createLuminance8Image
Creates an 8 bit luminance image using the given function as input. The domain of the image will be [-1, 1] on each axis unless that axis is size 0 (in which case the domain is [0, 0]. The expected range of the function result set is also [-1, 1] and this is remapped to [0, 255] for storage as a byte.- Parameters:
source
- the source function to evaluate at each pixel of the image.width
- the width of the imageheight
- the height of the imagedepth
- the depth of the image (for 3D texture or texture array use)- Returns:
- the resulting Image.
-
createLuminance8Image
public static Image createLuminance8Image(Function3D source, int width, int height, int depth, double startX, double endX, double startY, double endY, double startZ, double endZ, double rangeStart, double rangeEnd) Creates an 8 bit luminance image using the given function as input.- Parameters:
source
- the source function to evaluate at each pixel of the image.width
- the width of the imageheight
- the height of the imagedepth
- the depth of the image (for 3D texture or texture array use)startX
- the lowest domain value of the X axis. Or in other words, when a pixel on the leftmost side of the image is evaluated, this is the X value sent to the function.endX
- the highest domain value of the X axis. Or in other words, when a pixel on the rightmost side of the image is evaluated, this is the X value sent to the function.startY
- the lowest domain value of the Y axis.endY
- the highest domain value of the Y axis.startZ
- the lowest domain value of the Z axis.endZ
- the highest domain value of the Z axis.rangeStart
- the expected lowest value of the output from the source function. This is used to map the output to a byte.rangeEnd
- the expected highest value of the output from the source function. This is used to map the output to a byte.- Returns:
- the resulting Image.
-
createColorImageFromLuminance8
public static Image createColorImageFromLuminance8(Image lumImage, boolean useAlpha, ReadOnlyColorRGBA... colorTable) Converts an 8 bit luminance Image to an RGB or RGBA color image by mapping the given values to a corresponding color value in the given colorTable.XXX: perhaps replace the color array with some gradient class?
- Parameters:
lumImage
- the Image to convert.useAlpha
- if true, the final image will use have an alpha channel, populated by the alpha values of the given colors.colorTable
- a set of colors, should be length 256.- Returns:
- the new Image.
-
fillInColorTable
Fill any empty spots in the given color array by linearly interpolating the non-empty values above and below it.- Parameters:
colors
- the color table - must be length 256.
-