public class ByteArrayImageData extends ImageObject implements PNGImageTypes
| Modifier and Type | Field and Description |
|---|---|
int |
byteAlignment
This specifies the alignment of byte scan lines.
|
int |
imageType |
boolean |
isWritable |
background, height, widthPNG_TYPE_GRAY_SCALE, PNG_TYPE_GRAY_SCALE_ALPHA, PNG_TYPE_PALETTE, PNG_TYPE_TRUE_COLOR, PNG_TYPE_TRUE_COLOR_ALPHACREATE_OPTION_DONT_SCALE_UP, CREATE_OPTION_IGNORE_ALPHA, CREATE_OPTION_KEEP_ASPECT_RATIO, CREATE_OPTION_ROUGH_SCALING, SCAN_LINE_BYTE_ARRAY, SCAN_LINE_INT_ARRAY, TYPE_ARGB, TYPE_GRAY_SCALE_16, TYPE_GRAY_SCALE_2, TYPE_GRAY_SCALE_256, TYPE_GRAY_SCALE_4, TYPE_INDEXED_16, TYPE_INDEXED_2, TYPE_INDEXED_256, TYPE_INDEXED_4, TYPE_MASK, TYPE_MONO, TYPE_RGB, TYPE_UNKNOWN| Constructor and Description |
|---|
ByteArrayImageData(int width,
int height)
Create the ByteArrayImageData.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(Graphics g,
int x,
int y,
int options) |
void |
free() |
void |
freeImage()
Free any resource associated with the ImageData object.
|
int[] |
getImageColorTable()
For indexed images, this retrieves the color table as an array of ARGB integers.
|
int |
getImageScanLineLength()
If the scan line type is SCAN_LINE_BYTE_ARRAY then this indicates
the number of bytes is needed for one complete scan line.
|
void |
getImageScanLines(int startLine,
int numLines,
Object destArray,
int offset,
int destScanLineLength)
Place a set of scan lines into a destination array.
|
int |
getImageScanLineType()
Get the type of scan line used by the image - either SCAN_LINE_BYTE_ARRAY or SCAN_LINE_INT_ARRAY
|
int |
getImageType()
This returns one of the TYPE_XXX values
|
int[] |
getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
Retrieve the pixels from the Image in encoded ARGB values.
|
boolean |
isWriteableImage()
Returns if you can write data to the ImageData.
|
void |
setImageScanLines(int startLine,
int numLines,
Object sourceArray,
int offset,
int sourceScanLineLength)
Place a set of scan lines from a source Array into the ImageData.
|
void |
setImageType(int type)
Set the image type and create the byte array to hold the data.
|
int |
setIndexedType(Color[] colorTable) |
int |
setIndexedType(int[] colorTable) |
boolean |
setPixels(int[] src,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
Set the pixels in the IImage in encoded ARGB values.
|
int |
setPNGType(int typeOfImage,
int bitDepth)
Set the imageType value using a PNG image type and a bitDepth.
|
boolean |
usesAlpha()
Returns whether the image uses the Alpha channel.
|
createImageFor, draw, draw, getBackground, getCompatibleImagePoints, getDPI, getHeight, getImageData, getImageHeight, getImageWidth, getNativeDrawable, getPixelsUsingScanLines, getScanLinesUsingPixels, getWidth, isReadableImage, scanLinesComplete, setPixelsUsingScanLines, setScanLinePixels, setScanLinesUsingPixelspublic int imageType
public boolean isWritable
public int byteAlignment
public ByteArrayImageData(int width,
int height)
width - the width of the image.height - the height of the image.public int[] getImageColorTable()
ImageDatagetImageColorTable in interface ImageDatagetImageColorTable in class ImageObjectpublic void setImageType(int type)
type - one of the ImageData.TYPE_XXX.public void free()
free in interface Drawablefree in class ImageObjectpublic void freeImage()
ImageDatafreeImage in interface ImageDatafreeImage in class ImageObjectpublic int setPNGType(int typeOfImage,
int bitDepth)
typeOfImage - a valid PNG_TYPE_XXX value.bitDepth - the number of bits per pixel which must be valid for the specified
type. Note that TRUE_COLOR and TRUE_COLOR_ALPHA must use a bit depth of 8.public int setIndexedType(Color[] colorTable)
public int setIndexedType(int[] colorTable)
public int getImageType()
ImageDatagetImageType in interface ImageDatagetImageType in class ImageObjectpublic int getImageScanLineLength()
ImageDatagetImageScanLineLength in interface ImageDatagetImageScanLineLength in class ImageObjectpublic int getImageScanLineType()
ImageDatagetImageScanLineType in interface ImageDatagetImageScanLineType in class ImageObjectpublic boolean usesAlpha()
IImagepublic boolean isWriteableImage()
isWriteableImage in interface ImageDatapublic void getImageScanLines(int startLine,
int numLines,
Object destArray,
int offset,
int destScanLineLength)
throws IllegalStateException
ImageDatagetImageScanLines in interface ImageDataIllegalStateExceptionpublic void setImageScanLines(int startLine,
int numLines,
Object sourceArray,
int offset,
int sourceScanLineLength)
throws IllegalStateException
ImageDatasetImageScanLines in interface ImageDataIllegalStateExceptionpublic int[] getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
ImageDatagetPixels in interface ImageDatadest - The destination int array. If this is null then a new array should be created.offset - The offset into the array to start placing pixels.x - the x co-ordinate within the image.y - the y co-ordinate within the image.width - the width of the pixel block to get.height - the height of the pixel block to get.rowStride - the number of int values between each row in the destination int array. If this is 0 it
will be assumed to be equal to width.public boolean setPixels(int[] src,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
ImageDatasetPixels in interface ImageDatasrc - The source int array.offset - The offset into the array to start retrieving pixels.x - the x co-ordinate within the image.y - the y co-ordinate within the image.width - the width of the pixel block to get.height - the height of the pixel block to get.rowStride - the number of int values between each row in the source int array. If this is 0 it
will be assumed to be equal to width.