|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.ImageTool
This class is used for two purposes. It can be used as an Image creator, creating images of a specific type. And it contains a set of useful static methods for manipulating images and image data.
| Field Summary | |
int[] |
createColorTable
This is the optional color map that will be used for createImage(). |
int |
createOptions
These are the options that will be used for createImage(). |
static int |
SCALE_KEEP_ASPECT_RATIO
An option for one of the scale() methods. |
static int |
SCALE_ROUGH
An option for the scale() methods. |
static int |
SCALE_USE_EXACT_TYPE
An option for one of the scale() methods. |
| Constructor Summary | |
ImageTool()
|
|
ImageTool(int createOptions)
|
|
ImageTool(int createOptions,
int[] createColorTable)
|
|
| Method Summary | |
static Image |
createCompatibleImage(ImageData source,
int newWidth,
int newHeight)
Create a new Image that is compatible with the source ImageData. |
static Image |
createCompatibleImage(ImageData source,
int destinationImageDataType,
int newWidth,
int newHeight)
Create a new Image that is compatible with the source ImageData, given a specific destination ImageData type. |
Image |
createImage(int width,
int height)
This creates an Image using the createOptions and createColorTable fields. |
static Image |
createImageUsing(ImageTool it,
int width,
int height,
int defaultOptions)
If the specified ImageTool is null, then an image will be created using the default options, otherwise the specified ImageTool is used to create the image. |
static void |
fromARGB(int[] argbData,
int argbOffset,
int argbScanLineLength,
int destImageDataType,
int destWidth,
int[] destColorTable,
Object destScanLines,
int destOffset,
int destScanLineLength,
int numScanLines)
|
static int[] |
getGrayScaleColorTable(int imageDataType)
Create and return a Gray scale color table. |
static Object |
getScanLineBuffer(ImageData imageData,
int numScanLines,
Object oldBuffer)
Create an int[] or byte[] buffer to read/write scan lines from the specified ImageData, re-using a previous buffer object if possible. |
static int |
imageDataTypeToImageCreationOptions(int imageDataType)
Convert an ImageData.TYPE_XXXX value to an Image.XXX_IMAGE option for creating an image. |
static void |
imprint(ImageData big,
ImageData small)
This method "imprints" the data in the small ImageData into the big ImageData at the top left corner of the big ImageData. |
static boolean |
isAGrayScaleImage(int imageDataType)
|
static boolean |
isAnIndexedImage(int imageDataType)
|
static int[] |
makeDefaultColorTable(int imageDataType)
Create and return a Color Table for one of the TYPE_INDEXED_XXX types. |
static void |
scale(ImageData source,
ImageData destination)
Scale a source Image so that it fits exactly into the destination Image using smooth scaling. |
static void |
scale(ImageData source,
ImageData destination,
int options)
Scale a source Image so that it fits exactly into the destination Image. |
static Image |
scale(ImageData source,
int newWidth,
int newHeight,
int scaleOptions)
Scale an image and return a new image. |
static void |
scaleSection(ImageData source,
int newWidth,
int newHeight,
ImageData dest,
int destX,
int destY,
int options)
Scale an image and then place a section of the scaled image into an ImageData object. |
static Image |
scaleSection(ImageData source,
int newWidth,
int newHeight,
Rect destinationArea,
int scaleOptions)
Scale an image and return a section of the scaled image. |
static Image |
scaleSourceSection(ImageData source,
Rect sourceArea,
int newWidth,
int newHeight,
int scaleOptions)
Scale a section of an image and return a new image. |
static void |
toARGB(int sourceImageDataType,
int sourceWidth,
int[] sourceColorTable,
Object sourceScanLines,
int sourceOffset,
int sourceScanLineLength,
int[] argbData,
int argbOffset,
int argbScanLineLength,
int numScanLines)
|
static ImageData |
toImageData(IImage image)
Return the best ImageData implementation for the specified IImage. |
static int |
toImageDataType(int imageCreationOptionsOrImageDataType)
|
static boolean |
usesColorTable(int imageDataType)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public int createOptions
public int[] createColorTable
public static final int SCALE_ROUGH
public static final int SCALE_KEEP_ASPECT_RATIO
public static final int SCALE_USE_EXACT_TYPE
| Constructor Detail |
public ImageTool()
public ImageTool(int createOptions)
public ImageTool(int createOptions,
int[] createColorTable)
| Method Detail |
public static int toImageDataType(int imageCreationOptionsOrImageDataType)
public static int imageDataTypeToImageCreationOptions(int imageDataType)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static boolean isAnIndexedImage(int imageDataType)
public static boolean isAGrayScaleImage(int imageDataType)
public static boolean usesColorTable(int imageDataType)
public Image createImage(int width,
int height)
throws SystemResourceException,
ImageTypeNotSupportedException,
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
IllegalArgumentException
public static Image createImageUsing(ImageTool it,
int width,
int height,
int defaultOptions)
throws SystemResourceException,
ImageTypeNotSupportedException,
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
IllegalArgumentException
public static Image createCompatibleImage(ImageData source,
int destinationImageDataType,
int newWidth,
int newHeight)
throws IllegalArgumentException,
SystemResourceException,
ImageTypeNotSupportedException
source - The source ImageData.destinationImageDataType - The desired new ImageData type. If this is one of the
TYPE_INDEXED_XXX values, then the source ImageData must be of the exact same type so that
the source color table can be transferred to the new image.newWidth - The new width for the image.newHeight - The new height for the image.
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
public static Image createCompatibleImage(ImageData source,
int newWidth,
int newHeight)
throws IllegalArgumentException,
SystemResourceException,
ImageTypeNotSupportedException
source - The source ImageData.newWidth - The new width for the image.newHeight - The new height for the image.
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
public static Image scale(ImageData source,
int newWidth,
int newHeight,
int scaleOptions)
throws IllegalArgumentException,
SystemResourceException,
ImageTypeNotSupportedException
source - the source ImageDatanewWidth - the new width for the image.newHeight - the new height for the image.scaleOptions - any of the SCALE_XXX options.
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
public static Image scaleSourceSection(ImageData source,
Rect sourceArea,
int newWidth,
int newHeight,
int scaleOptions)
throws IllegalArgumentException,
SystemResourceException,
ImageTypeNotSupportedException
source - the source ImageDatasourceArea - the area within the source image to scale.newWidth - the new width for the image.newHeight - the new height for the image.scaleOptions - any of the SCALE_XXX options.
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
public static Image scaleSection(ImageData source,
int newWidth,
int newHeight,
Rect destinationArea,
int scaleOptions)
throws IllegalArgumentException,
SystemResourceException,
ImageTypeNotSupportedException
source - the source ImageDatanewWidth - the new width for the image.newHeight - the new height for the image.destinationArea - the area in the scaled image to return.scaleOptions - any of the SCALE_XXX options.
IllegalArgumentException
SystemResourceException
ImageTypeNotSupportedException
public static void scale(ImageData source,
ImageData destination)
source - The source ImageDatadestination - The destination Image.
public static void scale(ImageData source,
ImageData destination,
int options)
source - The source ImageDatadestination - The destination Image.options - only SCALE_ROUGH or 0.public static ImageData toImageData(IImage image)
public static void scaleSection(ImageData source,
int newWidth,
int newHeight,
ImageData dest,
int destX,
int destY,
int options)
source - The source image.newWidth - The width of the complete image after scaling.newHeight - The heigh to the complete image after scaling.dest - The destination imageData.destX - The x point within the scaled image that should go into the destination image.destY - The y point within the scaled image that should go into the destination image.options - Options for scaling - so far only the SCALE_ROUGH is supported.
public static void imprint(ImageData big,
ImageData small)
public static int[] getGrayScaleColorTable(int imageDataType)
public static int[] makeDefaultColorTable(int imageDataType)
public static Object getScanLineBuffer(ImageData imageData,
int numScanLines,
Object oldBuffer)
imageData - The imageData to read/write scan lines.numScanLines - The number of scan lines to read/write.oldBuffer - An object to be re-used if possible.
public static void toARGB(int sourceImageDataType,
int sourceWidth,
int[] sourceColorTable,
Object sourceScanLines,
int sourceOffset,
int sourceScanLineLength,
int[] argbData,
int argbOffset,
int argbScanLineLength,
int numScanLines)
public static void fromARGB(int[] argbData,
int argbOffset,
int argbScanLineLength,
int destImageDataType,
int destWidth,
int[] destColorTable,
Object destScanLines,
int destOffset,
int destScanLineLength,
int numScanLines)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||