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, wait
getImageScanLines, getPixels, isWriteableImage, setImageScanLines, setPixels
protected int width
protected int height
protected Color background
public Object getNativeDrawable()
public Color getBackground()
IImage
getBackground
in interface IImage
public int getImageType()
ImageData
getImageType
in interface ImageData
public int getImageScanLineType()
ImageData
getImageScanLineType
in interface ImageData
public int getImageScanLineLength()
ImageData
getImageScanLineLength
in interface ImageData
public int getImageWidth()
getImageWidth
in interface ImageData
public int getImageHeight()
getImageHeight
in interface ImageData
protected void setScanLinesUsingPixels(int startLine, int numLines, Object sourceArray, int offset, int sourceScanLineLength) throws IllegalStateException
startLine
- numLines
- sourceArray
- offset
- sourceScanLineLength
- IllegalStateException
protected void getScanLinesUsingPixels(int startLine, int numLines, Object destArray, int offset, int destScanLineLength) throws IllegalStateException
startLine
- numLines
- sourceArray
- offset
- sourceScanLineLength
- IllegalStateException
protected 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()
ImageData
getImageColorTable
in interface ImageData
public boolean isReadableImage()
isReadableImage
in interface ImageData
public void freeImage()
ImageData
public 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 ImageMaker
interestedArea
- 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
ImageMaker
createImageFor
in interface ImageMaker
imageInfo
- 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 ImageMaker
public ImageData getImageData()
ImageMaker
getImageData
in interface ImageMaker
public 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)
Drawable
draw
in interface Drawable
g
- 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.