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.(複製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(DisplayMetrics display,
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 |
createBitmap(DisplayMetrics display,
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 source,
int x, int y, int width, int height) Returns an immutable bitmap from the specified subset of the source bitmap.
|
static Bitmap |
createBitmap(Bitmap src) Returns an immutable bitmap from the source bitmap.(對原圖的複製)
|
static Bitmap |
createBitmap(DisplayMetrics display,
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, 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(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(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, when possible.(將原有的圖按比例縮放保存)
|
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 int |
getAllocationByteCount() Returns the size of the allocated memory used to store this bitmap's pixels.
|
final int |
getByteCount() Returns the minimum number of bytes that can be used to store this bitmap's pixels.
|
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. |
int |
getGenerationId() Returns the generation ID of 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(DisplayMetrics metrics) Convenience for calling
getScaledHeight(int) with
the target density of the given DisplayMetrics . |
int |
getScaledHeight(int
targetDensity) Convenience method that returns the height of this bitmap divided by the density scale factor.
|
int |
getScaledHeight(Canvas canvas) Convenience for calling
getScaledHeight(int) with
the target density of the given Canvas . |
int |
getScaledWidth(int
targetDensity) Convenience method that returns the width of this bitmap divided by the density scale factor.
|
int |
getScaledWidth(DisplayMetrics metrics) Convenience for calling
getScaledWidth(int) with
the target density of the given DisplayMetrics . |
int |
getScaledWidth(Canvas canvas) Convenience for calling
getScaledWidth(int) with
the target density of the given 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 |
hasMipMap() Indicates whether the renderer responsible for drawing this bitmap should attempt to use mipmaps when this bitmap is drawn scaled down.
|
final boolean |
isMutable() Returns true if the bitmap is marked as mutable可變的 (i.e. can be drawn into)
|
final boolean |
isPremultiplied() Indicates whether pixels stored in this bitmaps are stored pre-multiplied. |
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 |
reconfigure(int
width, int height, Bitmap.Config config) Modifies the bitmap to have a specified width, height, and |
void |
recycle() Free the native object associated with this bitmap, and clear the reference to the pixel data.
|
boolean |
sameAs(Bitmap other) Given another bitmap, return true if it has the same dimensions, config, and pixel data as this bitmap.
|
void |
setConfig(Bitmap.Config config) Convenience method for calling |
void |
setDensity(int
density) Specifies the density for this bitmap. |
void |
setHasAlpha(boolean
hasAlpha) Tell the bitmap if all of the pixels are known to be opaque (false) or if some of the pixels may contain non-opaque alpha values (true).
|
final void |
setHasMipMap(boolean
hasMipMap) Set a hint for the renderer responsible for drawing this bitmap indicating that it should attempt to use mipmaps when this bitmap is drawn scaled down.
|
void |
setHeight(int
height) Convenience method for calling |
void |
setPixel(int
x, int y, int color) Write the specified |
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. |
final void |
setPremultiplied(boolean
premultiplied) Sets whether the bitmap should treat its data as pre-multiplied.
|
void |
setWidth(int
width) Convenience method for calling |
void |
writeToParcel(Parcel p,
int flags) Write the bitmap and its pixels to the parcel.
|
Android的Bitmap類中常用方法
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.