Bitmap
Constructors
Creates an empty Bitmap without pixels, with ColorType.UNKNOWN, ColorAlphaType.UNKNOWN, and with a width and height of zero. PixelRef origin is set to (0, 0). Bitmap is not volatile.
Properties
Returns number of bytes per pixel required by ColorType. Returns zero if colorType is ColorType.UNKNOWN.
Returns a unique value corresponding to the pixels in PixelRef. Returns a different value after notifyPixelsChanged() has been called. Returns zero if PixelRef is null.
Returns true if pixels can not change.
Returns true if Bitmap can be drawn.
Returns origin of pixels within PixelRef. Bitmap bounds is always contained by PixelRef bounds, which may be the same size or larger. Multiple Bitmap can share the same PixelRef, where each Bitmap has different bounds.
Returns number of pixels that fit on row. Should be greater than or equal to getWidth().
Returns bit shift converting row bytes to row pixels. Returns zero for ColorType.UNKNOWN.
Functions
Sets ImageInfo to width, height, and native color type; and allocates pixel memory. Sets ImageInfo to ColorAlphaType.PREMUL.
Allocates pixel memory with HeapAllocator, and replaces existing PixelRef. The allocation size is determined by ImageInfo width, height, and ColorType.
Sets ImageInfo to info following the rules in .setImageInfo and allocates pixel memory.
Sets ImageInfo to info following the rules in setImageInfo() and allocates pixel memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(), or equal zero.
Sets ImageInfo to info following the rules in setImageInfo() and allocates pixel memory. Memory is zeroed.
Returns minimum memory required for pixel storage. Does not include unused memory on last row when getRowBytesAsPixels() exceeds getWidth(). Returns zero if height() or width() is 0. Returns getHeight() times getRowBytes() if getColorType() is ColorType.UNKNOWN.
Returns true if all pixels are opaque. ColorType determines how pixels are encoded, and whether pixel describes alpha. Returns true for ColorType without alpha in each pixel; for other ColorType, returns true if all pixels have alpha values equivalent to 1.0 or greater.
Returns true if width or height are zero, or if PixelRef is null. If true, Bitmap has no effect when drawn or drawn into.
Replaces pixel values with color, interpreted as being in the sRGB ColorSpace. All pixels contained by getBounds() are affected. If the getColorType() is ColorType.GRAY_8 or ColorType.RGB_565, then alpha is ignored; RGB is treated as opaque. If getColorType() is ColorType.ALPHA_8, then RGB is ignored.
Replaces pixel values inside area with color, interpreted as being in the sRGB ColorSpace. If area does not intersect getBounds(), call has no effect.
Sets dst to alpha described by pixels. Returns false if dst cannot be written to or dst pixels cannot be allocated.
Shares PixelRef with dst. Pixels are not copied; this and dst point to the same pixels; dst.getBounds() are set to the intersection of subset and the original getBounds().
Sets ImageInfo to info following the rules in setImageInfo(), and creates PixelRef containing pixels and rowBytes.
Marks that pixels in PixelRef have changed. Subsequent calls to getGenerationId() return a different value.
Create a pixmap and copy buffer contents into it
Sets alpha type, if argument is compatible with current color type. Returns true unless argument is ColorAlphaType.UNKNOWN and current value is ColorAlphaType.UNKNOWN.
Sets width, height, ColorAlphaType, ColorType, ColorSpace. Frees pixels, and returns true if successful.
Sets width, height, ColorAlphaType, ColorType, ColorSpace, and optional rowBytes. Frees pixels, and returns true if successful.
Sets internal flag to mark Bitmap as immutable. Once set, pixels can not change. Any other bitmap sharing the same PixelRef are also marked as immutable. Once PixelRef is marked immutable, the setting cannot be cleared.
Replaces pixelRef and origin in Bitmap. dx and dy specify the offset within the PixelRef pixels for the top-left corner of the bitmap.