Example usage for Java android.graphics Bitmap fields, constructors, methods, implement or subclass
The text is from its open source code.
int | DENSITY_NONE Indicates that the bitmap was created for an unknown pixel density. |
Parcelable.Creator | CREATOR |
boolean | compress(CompressFormat format, int quality, OutputStream stream) Write a compressed version of the bitmap to the specified outputstream. |
Bitmap | copy(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). |
Bitmap | createBitmap(@NonNull Bitmap source, int x, int y, int width, int height) Returns an immutable bitmap from the specified subset of the source bitmap. |
Bitmap | createBitmap(int width, int height, @NonNull Config config, boolean hasAlpha, @NonNull ColorSpace colorSpace) Returns a mutable bitmap with the specified width and height. |
Bitmap | createBitmap(@Nullable DisplayMetrics display, int width, int height, @NonNull Config config, boolean hasAlpha) Returns a mutable bitmap with the specified width and height. |
Bitmap | createBitmap(@Nullable DisplayMetrics display, @NonNull @ColorInt int colors[], int width, int height, @NonNull 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. |
Bitmap | createBitmap(int width, int height, @NonNull Config config) Returns a mutable bitmap with the specified width and height. |
Bitmap | createBitmap(@NonNull Bitmap source, int x, int y, int width, int height, @Nullable Matrix m, boolean filter) Returns an immutable bitmap from subset of the source bitmap, transformed by the optional matrix. |
Bitmap | createBitmap(@NonNull DisplayMetrics display, @NonNull @ColorInt int[] colors, int offset, int stride, int width, int height, @NonNull 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. |
Bitmap | createBitmap(@NonNull Bitmap src) Returns an immutable bitmap from the source bitmap. |
Bitmap | createBitmap(@NonNull Picture source) Creates a Bitmap from the given Picture source of recorded drawing commands. |
Bitmap | createBitmap(@Nullable DisplayMetrics display, int width, int height, @NonNull Config config) Returns a mutable bitmap with the specified width and height. |
Bitmap | createBitmap(int width, int height, @NonNull Config config, boolean hasAlpha) Returns a mutable bitmap with the specified width and height. |
Bitmap | createBitmap(@NonNull @ColorInt int[] colors, int width, int height, 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. |
Bitmap | createBitmap(@NonNull Picture source, int width, int height, @NonNull Config config) Creates a Bitmap from the given Picture source of recorded drawing commands. |
Bitmap | createScaledBitmap(@NonNull Bitmap src, int dstWidth, int dstHeight, boolean filter) Creates a new bitmap, scaled from an existing bitmap, when possible. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
void | eraseColor(@ColorInt 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. |
int | getAllocationByteCount() Returns the size of the allocated memory used to store this bitmap's pixels. |
int | getByteCount() Returns the minimum number of bytes that can be used to store this bitmap's pixels. |
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. The default density is the same density as the current display, unless the current application does not support different screen densities in which case it is android.util.DisplayMetrics#DENSITY_DEFAULT . |
int | getGenerationId() Returns the generation ID of this bitmap. |
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(@ColorInt 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. |
int | getRowBytes() Return the number of bytes between rows in the bitmap's pixels. |
int | getScaledHeight(Canvas canvas) Convenience for calling #getScaledHeight(int) with the target density of the given Canvas . |
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 | getScaledWidth(Canvas canvas) Convenience for calling #getScaledWidth(int) with the target density of the given Canvas . |
int | getScaledWidth(DisplayMetrics metrics) Convenience for calling #getScaledWidth(int) with the target density of the given DisplayMetrics . |
int | getScaledWidth(int targetDensity) Convenience method that returns the width of this bitmap divided by the density scale factor. |
int | getWidth() Returns the bitmap's width |
boolean | hasAlpha() Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values. |
int | hashCode() Returns a hash code value for the object. |
boolean | isMutable() Returns true if the bitmap is marked as mutable (i.e. can be drawn into) |
boolean | isPremultiplied() Indicates whether pixels stored in this bitmaps are stored pre-multiplied. |
boolean | isRecycled() Returns true if this bitmap has been recycled. |
void | prepareToDraw() Builds caches associated with the bitmap that are used for drawing it. |
void | reconfigure(int width, int height, Config config) Modifies the bitmap to have a specified width, height, and Config , without affecting the underlying allocation backing the bitmap. |
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 | 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). |
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 | setPixel(int x, int y, @ColorInt int color) Write the specified Color into the bitmap (assuming it is mutable) at the x,y coordinate. |
void | setPixels(@ColorInt 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 | setPremultiplied(boolean premultiplied) Sets whether the bitmap should treat its data as pre-multiplied. |
String | toString() Returns a string representation of the object. |