public class ImageAdapter extends ImageObject
Modifier and Type | Field and Description |
---|---|
protected ImageData |
imageData |
background, height, width
CREATE_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 |
---|
ImageAdapter()
You must call the set() method after calling this.
|
ImageAdapter(ImageData id) |
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics g,
int x,
int y,
int options) |
static IImage |
drawableToIImage(Drawable d,
PixelBuffer reuse) |
static void |
drawRGB(ImageData image,
Graphics g,
int x,
int y,
boolean useAlpha) |
void |
free()
This frees resources associated with this ImageAdapter only, not the
original ImageData.
|
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 |
isReadableImage()
By default this returns true.
|
boolean |
isWriteableImage()
Returns if you can write data to the ImageData.
|
void |
set(ImageData newImageData) |
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.
|
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.
|
static IImage |
toIImage(ImageData id,
ImageAdapter reuseWrapper) |
boolean |
usesAlpha()
Returns whether the image uses the Alpha channel.
|
createImageFor, draw, draw, freeImage, getBackground, getCompatibleImagePoints, getDPI, getHeight, getImageData, getImageHeight, getImageWidth, getNativeDrawable, getPixelsUsingScanLines, getScanLinesUsingPixels, getWidth, scanLinesComplete, setPixelsUsingScanLines, setScanLinePixels, setScanLinesUsingPixels
protected ImageData imageData
public ImageAdapter()
public ImageAdapter(ImageData id)
public static IImage drawableToIImage(Drawable d, PixelBuffer reuse)
public static IImage toIImage(ImageData id, ImageAdapter reuseWrapper)
public void set(ImageData newImageData)
public void draw(Graphics g, int x, int y, int options)
public void free()
free
in interface Drawable
free
in class ImageObject
Drawable.free()
public int[] getPixels(int[] dest, int offset, int x, int y, int width, int height, int rowStride)
ImageData
dest
- 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 usesAlpha()
IImage
public int getImageType()
ImageData
getImageType
in interface ImageData
getImageType
in class ImageObject
public int getImageScanLineType()
ImageData
getImageScanLineType
in interface ImageData
getImageScanLineType
in class ImageObject
public int getImageScanLineLength()
ImageData
getImageScanLineLength
in interface ImageData
getImageScanLineLength
in class ImageObject
public void getImageScanLines(int startLine, int numLines, Object destArray, int offset, int destScanLineLength) throws IllegalStateException
ImageData
IllegalStateException
public void setImageScanLines(int startLine, int numLines, Object sourceArray, int offset, int sourceScanLineLength) throws IllegalStateException
ImageData
IllegalStateException
public boolean isWriteableImage()
ImageData
public boolean isReadableImage()
ImageObject
isReadableImage
in interface ImageData
isReadableImage
in class ImageObject
public int[] getImageColorTable()
ImageData
getImageColorTable
in interface ImageData
getImageColorTable
in class ImageObject
public boolean setPixels(int[] src, int offset, int x, int y, int width, int height, int rowStride)
ImageData
src
- 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.