public abstract class ImageObject extends Object implements IImage, ImageMaker
It also implements getImageScanLines() and setImageScanLines() using
| Modifier and Type | Field and Description |
|---|---|
protected Color |
background |
protected int |
height |
protected int |
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 |
|---|
ImageObject() |
| Modifier and Type | Method and Description |
|---|---|
void |
createImageFor(ImageDataInfo imageInfo,
Rect interestedArea)
This is called at the start of decoding - to let the ImageMaker know the parameters
of the image to be created.
|
void |
draw(Graphics g,
int x,
int y,
int width,
int height,
int options) |
void |
draw(Graphics g,
int x,
int y,
Rect visibleDestinationArea,
int options)
Draw the Drawable to the Graphics and specify the area on the graphics that is visible.
|
void |
free() |
void |
freeImage()
Free any resource associated with the ImageData object.
|
Color |
getBackground()
This returns a background color if one is set for the image.
|
Image |
getCompatibleImagePoints(double width,
double height) |
boolean |
getDPI(double[] dest)
This returns false on an Image.
|
int |
getHeight() |
int[] |
getImageColorTable()
For indexed images, this retrieves the color table as an array of ARGB integers.
|
ImageData |
getImageData()
After decoding is done this is used to retrieve the fully decoded image.
|
int |
getImageHeight() |
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.
|
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 |
getImageWidth() |
Object |
getNativeDrawable() |
protected int[] |
getPixelsUsingScanLines(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int rowStride) |
protected void |
getScanLinesUsingPixels(int startLine,
int numLines,
Object destArray,
int offset,
int destScanLineLength)
This is a way to implement the ImageData.getImageScanLines() method using the IImage.getPixels()
method.
|
int |
getWidth() |
boolean |
isReadableImage()
By default this returns true.
|
void |
scanLinesComplete()
This is called once all scan lines are complete.
|
protected boolean |
setPixelsUsingScanLines(int[] source,
int offset,
int x,
int y,
int width,
int height,
int rowStride) |
boolean |
setScanLinePixels(int scanLine,
int[] pixels,
int offset,
int destX,
int destFrequency,
int numPixels,
int srcFrequency)
This is used when decoding images.
|
protected void |
setScanLinesUsingPixels(int startLine,
int numLines,
Object sourceArray,
int offset,
int sourceScanLineLength)
This is a way to implement the ImageData.setImageScanLines() method using the IImage.setPixels()
method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetImageScanLines, getPixels, isWriteableImage, setImageScanLines, setPixelsprotected int width
protected int height
protected Color background
public Object getNativeDrawable()
public Color getBackground()
IImagegetBackground in interface IImagepublic int getImageType()
ImageDatagetImageType in interface ImageDatapublic int getImageScanLineType()
ImageDatagetImageScanLineType in interface ImageDatapublic int getImageScanLineLength()
ImageDatagetImageScanLineLength in interface ImageDatapublic int getImageWidth()
getImageWidth in interface ImageDatapublic int getImageHeight()
getImageHeight in interface ImageDataprotected void setScanLinesUsingPixels(int startLine,
int numLines,
Object sourceArray,
int offset,
int sourceScanLineLength)
throws IllegalStateException
startLine - numLines - sourceArray - offset - sourceScanLineLength - IllegalStateExceptionprotected void getScanLinesUsingPixels(int startLine,
int numLines,
Object destArray,
int offset,
int destScanLineLength)
throws IllegalStateException
startLine - numLines - sourceArray - offset - sourceScanLineLength - IllegalStateExceptionprotected boolean setPixelsUsingScanLines(int[] source,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
protected int[] getPixelsUsingScanLines(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int rowStride)
public int[] getImageColorTable()
ImageDatagetImageColorTable in interface ImageDatapublic boolean isReadableImage()
isReadableImage in interface ImageDatapublic void freeImage()
ImageDatapublic boolean setScanLinePixels(int scanLine,
int[] pixels,
int offset,
int destX,
int destFrequency,
int numPixels,
int srcFrequency)
Also scan lines may be presented in a random sequence and multiple times.
setScanLinePixels in interface ImageMakerinterestedArea - the area specified in createImageFor() that
the ImageMaker indicated it was interested in.scanLine - the scan line index (starting at 0) of the full original image being set.pixels - an array containing the scan line ARGB pixel values.offset - the start of the pixel within the pixels array.destX - the x location where the first pixel should be placed.destFrequency - the distance between the pixels being provided. If this
value is 1, then the pixels are actually right next to each other. A value of
2 means that every other pixel is being done.numPixels - the number of pixels being set.srcFrequency - the distance between the pixels in the pixels array.
This will usually be 1 but may be any other distance.public void createImageFor(ImageDataInfo imageInfo, Rect interestedArea) throws IllegalArgumentException
ImageMakercreateImageFor in interface ImageMakerimageInfo - information on the image to be decoded.interestedArea - when the method is called this is set to be the
full area of the image (0,0,imageWidth,imageHeight). This method
can alter this Rect to be a sub-area within the image. In that case
the object that is providing pixel data will know that it need
not provide pixel data outside that area. However you should not
assume that this will strictly be adhered to. It is possible
that all pixels for the entire image may still be provided to
setScanLinePixels().IllegalArgumentException - if the ImageMaker decides it cannot create the image.public void scanLinesComplete()
scanLinesComplete in interface ImageMakerpublic ImageData getImageData()
ImageMakergetImageData in interface ImageMakerpublic void draw(Graphics g, int x, int y, int width, int height, int options)
public boolean getDPI(double[] dest)
public Image getCompatibleImagePoints(double width, double height)
public void draw(Graphics g, int x, int y, Rect visibleDestinationArea, int options)
Drawabledraw in interface Drawableg - the Graphics to draw to.x - the x-location on the graphics to draw to.y - the y-location on the graphics to draw to.visibleDestinationArea - the area that will be updated on the Graphics. If this is null
then assume that all of the Drawable must be drawn.options - any of the Drawable options OR'ed together.