danger.ui
Class Bitmap
java.lang.Object
|
+--danger.ui.Bitmap
- Direct Known Subclasses:
- ImmutableBitmap
- public class Bitmap
- extends java.lang.Object
|
Constructor Summary |
Bitmap()
|
Bitmap(Bitmap src)
|
Bitmap(Bitmap src,
int width,
int height)
|
Bitmap(byte[] pixels,
int width,
int height,
int transparentColor)
|
Bitmap(byte[] pixels,
int width,
int height,
int colorspace,
int transparentColor)
|
Bitmap(byte[] pixels,
int width,
int height,
int colorspace,
int transparentColor,
int paletteSize)
|
Bitmap(int width,
int height)
|
|
Method Summary |
boolean |
canDrawInverted()
|
static Bitmap |
convertToScreenColorSpace(Bitmap bitmap)
Convert a bitmap to the native screen format. |
static Bitmap |
convertToScreenColorSpace(Bitmap bitmap,
int backgroundColor)
Convert a bitmap to the native screen format. |
static void |
copyBits(Bitmap to,
Rect toRect,
Bitmap from,
Rect fromRect)
Copy a region from one bitmap to another |
void |
copyBitsTo(Bitmap to,
Rect toRect,
Rect fromRect)
Copy the contents of fromRect in this bitmap, to toRect
in the provided destination Bitmap |
boolean |
copyRotated(Bitmap from,
int degrees)
|
void |
copyScaled(Bitmap src)
Copy the contents of the provided source bitmap to this
bitmap, scaling them to fit |
Pen |
createPen()
|
Pen |
createPen(int dx,
int dy)
|
static void |
flatten(Bitmap src,
byte[] dst,
int dstOffset)
|
int |
getColorSpace()
|
static int |
getFlattenedSize(Bitmap src)
|
int |
getHeight()
|
int |
getPaletteSize()
|
byte[] |
getPixels()
return the raw pixel data array |
int |
getPoint(int x,
int y)
|
int |
getPoint(Point point)
|
int |
getStride()
|
int |
getTransparentColor()
|
int |
getWidth()
|
static Bitmap |
newFromEncodedData(byte[] data)
|
static Bitmap |
newFromFlattenedData(byte[] data,
int offset)
|
static Bitmap |
newFromJPEGData(byte[] jpegData)
|
static Bitmap |
newFromPNGData(byte[] pngData)
|
void |
replaceColor(int color,
int newColor)
|
void |
replacePaletteColor(int color,
int newColor)
|
Bitmap |
rotateBy(int degrees)
return a bitmap rotated by 0, 90, 180, or 270 degrees. |
Bitmap |
scaleTo(int width,
int height)
Return a new bitmap, containing the contents of this bitmap,
scaled to the provided size |
void |
setTransparentColor(int color)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mPaletteOffset
protected int mPaletteOffset
Bitmap
public Bitmap(byte[] pixels,
int width,
int height,
int colorspace,
int transparentColor,
int paletteSize)
Bitmap
public Bitmap()
Bitmap
public Bitmap(int width,
int height)
Bitmap
public Bitmap(byte[] pixels,
int width,
int height,
int colorspace,
int transparentColor)
Bitmap
public Bitmap(Bitmap src)
Bitmap
public Bitmap(Bitmap src,
int width,
int height)
Bitmap
public Bitmap(byte[] pixels,
int width,
int height,
int transparentColor)
newFromPNGData
public static Bitmap newFromPNGData(byte[] pngData)
throws java.io.IOException
newFromJPEGData
public static Bitmap newFromJPEGData(byte[] jpegData)
throws java.io.IOException
newFromEncodedData
public static Bitmap newFromEncodedData(byte[] data)
throws java.io.IOException
newFromFlattenedData
public static Bitmap newFromFlattenedData(byte[] data,
int offset)
flatten
public static void flatten(Bitmap src,
byte[] dst,
int dstOffset)
getFlattenedSize
public static int getFlattenedSize(Bitmap src)
createPen
public Pen createPen(int dx,
int dy)
createPen
public Pen createPen()
getPoint
public int getPoint(int x,
int y)
getPoint
public int getPoint(Point point)
getPaletteSize
public int getPaletteSize()
scaleTo
public Bitmap scaleTo(int width,
int height)
- Return a new bitmap, containing the contents of this bitmap,
scaled to the provided size
copyScaled
public void copyScaled(Bitmap src)
- Copy the contents of the provided source bitmap to this
bitmap, scaling them to fit
copyBitsTo
public final void copyBitsTo(Bitmap to,
Rect toRect,
Rect fromRect)
- Copy the contents of fromRect in this bitmap, to toRect
in the provided destination Bitmap
copyBits
public static void copyBits(Bitmap to,
Rect toRect,
Bitmap from,
Rect fromRect)
- Copy a region from one bitmap to another
rotateBy
public Bitmap rotateBy(int degrees)
- return a bitmap rotated by 0, 90, 180, or 270 degrees.
Other rotations currently return null.
copyRotated
public boolean copyRotated(Bitmap from,
int degrees)
getWidth
public int getWidth()
getHeight
public int getHeight()
getStride
public int getStride()
getColorSpace
public int getColorSpace()
getTransparentColor
public int getTransparentColor()
getPixels
public byte[] getPixels()
- return the raw pixel data array
setTransparentColor
public void setTransparentColor(int color)
replacePaletteColor
public void replacePaletteColor(int color,
int newColor)
replaceColor
public void replaceColor(int color,
int newColor)
convertToScreenColorSpace
public static Bitmap convertToScreenColorSpace(Bitmap bitmap,
int backgroundColor)
- Convert a bitmap to the native screen format. This is needed
in order to be able to draw onto a bitmap. You cannot draw into
some kinds of bitmaps (for example, indexed).
Returns a drawable duplicate of the source.
convertToScreenColorSpace
public static Bitmap convertToScreenColorSpace(Bitmap bitmap)
- Convert a bitmap to the native screen format. This is needed
in order to be able to draw onto a bitmap. You cannot draw into
some kinds of bitmaps (for example, indexed).
Returns a drawable duplicate of the source.
canDrawInverted
public boolean canDrawInverted()
Danger Confidential. Copyright © 2000-2003, Danger Inc.