|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrebuild.graphics.ImageEncoder
public abstract class ImageEncoder
The base abstract class that represents an image encoder.
Field Summary | |
---|---|
protected int |
compressionLevel
The compression level. |
protected byte[] |
dataBytes
The encoded bytes. |
protected boolean |
encodeAlpha
Encode alpha? |
protected int |
height
The height of the image. |
protected Bitmap |
image
The image. |
protected int |
scaleX
The scale of the image in the horizontal orientation. |
protected int |
scaleY
The scale of the image in the vertical orientation. |
protected int |
width
The width of the image. |
protected int |
xOffset
The offset of the x origin point of the image. |
protected int |
yOffset
The offset of the y origin point of the image. |
Constructor Summary | |
---|---|
protected |
ImageEncoder(Bitmap image,
boolean encodeAlpha)
Class constructor specifying Bitmap to encode, and whether to encode alpha. |
protected |
ImageEncoder(Bitmap image,
boolean encodeAlpha,
int compressionLevel)
Class constructor specifying Bitmap to encode, and whether to encode alpha. |
protected |
ImageEncoder(Bitmap image,
java.lang.String mime)
Class constructor specifying Bitmap to encode, with no alpha channel encoding. |
protected |
ImageEncoder(java.lang.String mime)
Class constructor |
Method Summary | |
---|---|
byte[] |
encode()
Encode an image in a specific format. |
byte[] |
encode(boolean encodeAlpha)
Encode an image in a specific format. |
protected byte[] |
getARGBByte(int offset,
int stride,
XYRect source)
Get the ARGB data of the image in a byte array. |
protected int[] |
getARGBInt(int offset,
int stride,
XYRect source)
Get the ARGB data of the image in a int array. |
int |
getCompressionLevel()
Retrieve compression level. |
boolean |
getEncodeAlpha()
Retrieve alpha encoding status. |
protected int |
getIndex(int x,
int y,
int offset)
Get index into the int array in getARGBInt(int, int, XYRect) . |
protected static int |
getIndex(int x,
int y,
int width,
int height,
int offset)
Get index into the int array in getARGBInt(int, int, XYRect) . |
abstract java.lang.String |
getMime()
Get the MIME type of the image encoder. |
protected abstract byte[] |
inEncode(boolean encodeAlpha)
Encode an image in a specific format. |
void |
setCompressionLevel(int level)
Set the compression level to use. |
void |
setEncodeAlpha(boolean encodeAlpha)
Set the alpha encoding on or off. |
void |
setImage(Bitmap image)
Set the image to be encoded. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] dataBytes
protected Bitmap image
protected int width
protected int height
protected boolean encodeAlpha
protected int compressionLevel
protected int scaleX
protected int scaleY
protected int xOffset
protected int yOffset
Constructor Detail |
---|
protected ImageEncoder(java.lang.String mime)
protected ImageEncoder(Bitmap image, java.lang.String mime)
Bitmap
to encode, with no alpha channel encoding.
image
- A Java Image object which uses the DirectColorModel.protected ImageEncoder(Bitmap image, boolean encodeAlpha)
Bitmap
to encode, and whether to encode alpha.
image
- A Java Image object which uses the DirectColorModelencodeAlpha
- Encode the alpha channel? false = no; true = yesprotected ImageEncoder(Bitmap image, boolean encodeAlpha, int compressionLevel)
Bitmap
to encode, and whether to encode alpha.
image
- A Java Image object which uses the DirectColorModelencodeAlpha
- Encode the alpha channel? false = no; true = yescompressionLevel
- The compression level of the image encoder.Method Detail |
---|
public abstract java.lang.String getMime()
public final byte[] encode(boolean encodeAlpha) throws java.io.IOException
encodeAlpha
- True if alpha should be encoded.
java.io.IOException
- If an error occurs.protected abstract byte[] inEncode(boolean encodeAlpha) throws java.io.IOException
encodeAlpha
- True if alpha should be encoded.
java.io.IOException
- If an error occurs.public final void setImage(Bitmap image)
image
- A Java Image object which uses the DirectColorModel.public final void setEncodeAlpha(boolean encodeAlpha)
encodeAlpha
- false = no, true = yespublic final boolean getEncodeAlpha()
public final byte[] encode() throws java.io.IOException
java.io.IOException
- If an error occurs.public final int getCompressionLevel()
public void setCompressionLevel(int level)
The
- compression level to set.protected int[] getARGBInt(int offset, int stride, XYRect source)
offset
- The offset into the array to save the data.stride
- The stride to save the image, should be at least the width of the image.source
- The source size of the image.
protected int getIndex(int x, int y, int offset)
getARGBInt(int, int, XYRect)
.
x
- The X location of the image.y
- The Y location of the image.offset
- The offset for the array.
getARGBInt(int, int, XYRect)
,
getIndex(int, int, int, int, int)
protected static int getIndex(int x, int y, int width, int height, int offset)
getARGBInt(int, int, XYRect)
.
x
- The X location of the image.y
- The Y location of the image.width
- The width of the image.height
- The height of the image.offset
- The offset for the array.
getARGBInt(int, int, XYRect)
,
getIndex(int, int, int)
protected byte[] getARGBByte(int offset, int stride, XYRect source)
offset
- The offset into the array to save the data.stride
- The stride to save the image, should be at least the width of the image.source
- The source size of the image.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |