公有方法 |
boolean |
compress(Bitmap.CompressFormat format,
int quality, OutputStream stream)
Write a compressed version of the bitmap to the specified outputstream.
|
Bitmap |
copy(Bitmap.Config config,
boolean isMutable)
Tries to make a new bitmap based on the dimensions of this bitmap, setting the new bitmap‘s config to the one specified, and then copying this bitmap‘s pixels into the new bitmap.
|
void |
copyPixelsFromBuffer(Buffer src)
Copy the pixels from the buffer, beginning at the current position, overwriting the bitmap‘s pixels.
|
void |
copyPixelsToBuffer(Buffer dst)
Copy the bitmap‘s pixels into the specified buffer (allocated by the caller).
|
static Bitmap |
createBitmap(Bitmap source,
int x, int y, int width, int height, Matrix m, boolean filter)
Returns an immutable bitmap from subset of the source bitmap, transformed by the optional matrix.
|
static Bitmap |
createBitmap(int
width, int height, Bitmap.Config config)
Returns a mutable bitmap with the specified width and height.
|
static Bitmap |
createBitmap(Bitmap source,
int x, int y, int width, int height)
Returns an immutable bitmap from the specified subset of the source bitmap.
|
static Bitmap |
createBitmap(int[]
colors, int offset, int stride, int width, int height, Bitmap.Config config)
Returns a immutable bitmap with the specified width and height, with each pixel value set to the corresponding value in the colors array.
|
static Bitmap |
createBitmap(Bitmap src)
Returns an immutable bitmap from the source bitmap.
|
static Bitmap |
createBitmap(int[]
colors, int width, int height, Bitmap.Config config)
Returns a immutable bitmap with the specified width and height, with each pixel value set to the corresponding value in the colors array.
|
static Bitmap |
createScaledBitmap(Bitmap src,
int dstWidth, int dstHeight, boolean filter)
Creates a new bitmap, scaled from an existing bitmap.
|
int |
describeContents()
No special parcel contents.
|
void |
eraseColor(int c)
Fills the bitmap‘s pixels with the specified Color .
|
Bitmap |
extractAlpha()
Returns a new bitmap that captures the alpha values of the original.
|
Bitmap |
extractAlpha(Paint paint,
int[] offsetXY)
Returns a new bitmap that captures the alpha values of the original.
|
final Bitmap.Config |
getConfig()
If the bitmap‘s internal config is in one of the public formats, return that config, otherwise return null.
|
int |
getDensity()
Returns the density for this bitmap.
|
final int |
getHeight()
Returns the bitmap‘s height
|
byte[] |
getNinePatchChunk()
Returns an optional array of private data, used by the UI system for some bitmaps.
|
int |
getPixel(int x, int y)
Returns the Color at
the specified location.
|
void |
getPixels(int[]
pixels, int offset, int stride, int x, int y, int width, int height)
Returns in pixels[] a copy of the data in the bitmap.
|
final int |
getRowBytes()
Return the number of bytes between rows in the bitmap‘s pixels.
|
int |
getScaledHeight(int targetDensity)
Convenience method that returns the height of this bitmap divided by the density scale factor.
|
int |
getScaledHeight(DisplayMetrics metrics)
|
int |
getScaledHeight(Canvas canvas)
|
int |
getScaledWidth(DisplayMetrics metrics)
|
int |
getScaledWidth(int targetDensity)
Convenience method that returns the width of this bitmap divided by the density scale factor.
|
int |
getScaledWidth(Canvas canvas)
|
final int |
getWidth()
Returns the bitmap‘s width
|
final boolean |
hasAlpha()
Returns true if the bitmap‘s config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values.
|
final boolean |
isMutable()
Returns true if the bitmap is marked as mutable (i.e.
|
final boolean |
isRecycled()
Returns true if this bitmap has been recycled.
|
void |
prepareToDraw()
Rebuilds any caches associated with the bitmap that are used for drawing it.
|
void |
recycle()
Free up the memory associated with this bitmap‘s pixels, and mark the bitmap as "dead", meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing.
|
void |
setDensity(int density)
Specifies the density for this bitmap.
|
void |
setPixel(int x, int y, int color)
Write the specified Color into
the bitmap (assuming it is mutable) at the x,y coordinate.
|
void |
setPixels(int[]
pixels, int offset, int stride, int x, int y, int width, int height)
Replace pixels in the bitmap with the colors in the array.
|
void |
writeToParcel(Parcel p,
int flags)
Write the bitmap and its pixels to the parcel.
|