Android Programming Press on the image to return to the main documentation page.

BitmapExtended

Written by XverhelstX

List of types:

BitmapExtended

BitmapExtended


Permissions:

android.permission.BIND_WALLPAPER
android.permission.SET_WALLPAPER

Events:

None

Members:


  ALPHA_8 As String

  ARGB_4444 As String

  ARGB_8888 As String

  compress (bitmap As android.graphics.Bitmap, format As String, quality As Int, stream As java.io.OutputStream)

  copyPixelsFromBuffer (bitmap As android.graphics.Bitmap, src As java.nio.Buffer)

  copyPixelsToBuffer (bitmap As android.graphics.Bitmap, dst As java.nio.Buffer)

  createBitmap (source As android.graphics.Bitmap, x As Int, y As Int, width As Int, height As Int, m As android.graphics.Matrix, filter As Boolean) As android.graphics.Bitmap

  createBitmap2 (width As Int, height As Int, config As String) As android.graphics.Bitmap

  createBitmap3 (source As android.graphics.Bitmap, x As Int, y As Int, width As Int, height As Int) As android.graphics.Bitmap

  createBitmap4 (src As android.graphics.Bitmap) As android.graphics.Bitmap

  createBitmap5 (colors() As Int, width As Int, height As Int, config As String) As android.graphics.Bitmap

  createScaledBitmap (src As android.graphics.Bitmap, dstWidth As Int, dstHeight As Int, filter As Boolean) As android.graphics.Bitmap

  eraseColor (bitmap As android.graphics.Bitmap, c As Int)

  extractAlpha (bitmap As android.graphics.Bitmap) As android.graphics.Bitmap

  getConfig (bitmap As android.graphics.Bitmap) As android.graphics.Bitmap.Config

  getDensity (bitmap As android.graphics.Bitmap) As Int

  getHeight (bitmap As android.graphics.Bitmap) As Int

  getNinePatchChunk (bitmap As android.graphics.Bitmap) As Byte()

  getPixel (bitmap As android.graphics.Bitmap, x As Int, y As Int) As Int

  getPixels (bitmap As android.graphics.Bitmap, pixels() As Int, offset As Int, stride As Int, x As Int, y As Int, width As Int, height As Int)

  getRowBytes (bitmap As android.graphics.Bitmap) As Int

  getScaledHeight (bitmap As android.graphics.Bitmap, targetDensity As Int) As Int

  getScaledWidth (bitmap As android.graphics.Bitmap, targetDensity As Int) As Int

  getWidth (bitmap As android.graphics.Bitmap) As Int

  hasAlpha (bitmap As android.graphics.Bitmap) As Boolean

  Initialize (Eventname As String)

  isMutable (bitmap As android.graphics.Bitmap) As Boolean

  isRecycled (bitmap As android.graphics.Bitmap) As Boolean

  JPEG As String

  PNG As String

  prepareToDraw (bitmap As android.graphics.Bitmap)

  recycle (bitmap As android.graphics.Bitmap)

  RGB_565 As String

  rotateBitmap (bitmap As android.graphics.Bitmap, degrees As Float) As android.graphics.Bitmap

  scaleBitmap (bitmap As android.graphics.Bitmap, sx As Float, sy As Float) As android.graphics.Bitmap

  setDensity (bitmap As android.graphics.Bitmap, density As Int)

  setPixel (bitmap As android.graphics.Bitmap, x As Int, y As Int, color As Int)

  setPixels (bitmap As android.graphics.Bitmap, pixels() As Int, offset As Int, stride As Int, x As Int, y As Int, width As Int, height As Int)

  skewBitmap (bitmap As android.graphics.Bitmap, kx As Float, ky As Float) As android.graphics.Bitmap

  translateBitmap (bitmap As android.graphics.Bitmap, dx As Float, dy As Float) As android.graphics.Bitmap

Members description:

ALPHA_8 As String
ARGB_4444 As String
ARGB_8888 As String
compress (bitmap As android.graphics.Bitmap, format As String, quality As Int, stream As java.io.OutputStream)
Write a compressed version of the bitmap to the specified outputstream.

format The format of the compressed image
quality Hint to the compressor, 0-100. 0 meaning compress for small size, 100 meaning compress for max quality. Some formats, like PNG which is lossless, will ignore the quality setting
stream The outputstream to write the compressed data.
copyPixelsFromBuffer (bitmap As android.graphics.Bitmap, src As java.nio.Buffer)
Copy the pixels from the buffer, beginning at the current position, overwriting the bitmap's pixels.
The data in the buffer is not changed in any way (unlike setPixels(), which converts from unpremultipled 32bit to
whatever the bitmap's native format is.
bitmap:
src:
copyPixelsToBuffer (bitmap As android.graphics.Bitmap, dst As java.nio.Buffer)
Copy the bitmap's pixels into the specified buffer (allocated by the caller).
An exception is thrown if the buffer is not large enough to hold all of the pixels
(taking into account the number of bytes per pixel) or if the Buffer subclass is not one of the support types
(ByteBuffer, ShortBuffer, IntBuffer).
bitmap:
dst:
createBitmap (source As android.graphics.Bitmap, x As Int, y As Int, width As Int, height As Int, m As android.graphics.Matrix, filter As Boolean) As android.graphics.Bitmap
Returns an immutable bitmap from subset of the source bitmap, transformed by the optional matrix.
It is initialized with the same density as the original bitmap.
source:
x:
y:
width:
height:
m:
filter:
Return type: @return:
createBitmap2 (width As Int, height As Int, config As String) As android.graphics.Bitmap
Returns a mutable bitmap with the specified width and height.
width:
height:
config:
Return type: @return:
createBitmap3 (source As android.graphics.Bitmap, x As Int, y As Int, width As Int, height As Int) As android.graphics.Bitmap
Returns an immutable bitmap from the specified subset of the source bitmap.
The new bitmap may be the same object as source, or a copy may have been made.
It is initialized with the same density as the original bitmap.
source:
x:
y:
width:
height:
Return type: @return:
createBitmap4 (src As android.graphics.Bitmap) As android.graphics.Bitmap
Returns an immutable bitmap from the source bitmap.
The new bitmap may be the same object as source, or a copy may have been made.
It is initialized with the same density as the original bitmap.
src:
Return type: @return:
createBitmap5 (colors() As Int, width As Int, height As Int, config As String) As android.graphics.Bitmap
createScaledBitmap (src As android.graphics.Bitmap, dstWidth As Int, dstHeight As Int, filter As Boolean) As android.graphics.Bitmap
Creates a new bitmap, scaled from an existing bitmap.
src The source bitmap.
dstWidth The new bitmap's desired width.
dstHeight The new bitmap's desired height.
filter true if the source should be filtered.
Return type: @return:the bitmap
eraseColor (bitmap As android.graphics.Bitmap, c As Int)
Fills the bitmap's pixels with the specified Color.
bitmap: the source bitmap. (must be mutable!)
c: colours
extractAlpha (bitmap As android.graphics.Bitmap) As android.graphics.Bitmap
Returns a new bitmap that captures the alpha values of the original.
bitmap:
getConfig (bitmap As android.graphics.Bitmap) As android.graphics.Bitmap.Config
If the bitmap's internal config is in one of the public formats, return that config, otherwise return null.
bitmap:
Return type: @return:
getDensity (bitmap As android.graphics.Bitmap) As Int
Returns the density for this bitmap.
bitmap:
Return type: @return:
getHeight (bitmap As android.graphics.Bitmap) As Int
Returns the bitmap's height
bitmap:
Return type: @return:
getNinePatchChunk (bitmap As android.graphics.Bitmap) As Byte()
Returns an optional array of private data, used by the UI system for some bitmaps. Not intended to be called by applications.
bitmap:
Return type: @return:
getPixel (bitmap As android.graphics.Bitmap, x As Int, y As Int) As Int
Returns the Color at the specified location.
Throws an exception if x or y are out of bounds (negative or >= to the width or height respectively).
bitmap:
x: The x coordinate (0...width-1) of the pixel to return
y: The y coordinate (0...height-1) of the pixel to return
Return type: @return:The argb Color at the specified coordinate
getPixels (bitmap As android.graphics.Bitmap, pixels() As Int, offset As Int, stride As Int, x As Int, y As Int, width As Int, height As Int)
Returns in pixels[] a copy of the data in the bitmap. Each value is a packed int representing a Color.
The stride parameter allows the caller to allow for gaps in the returned pixels array between rows.
For normal packed results, just pass width for the stride value
bitmap:
pixels: The array to receive the bitmap's colors
offset: The first index to write into pixels[]
stride: The number of entries in pixels[] to skip between rows (must be >= bitmap's width). Can be negative.
x: The x coordinate of the first pixel to read from the bitmap
y: The y coordinate of the first pixel to read from the bitmap
The: number of pixels to read from each row
height: The number of rows to read
getRowBytes (bitmap As android.graphics.Bitmap) As Int
Return the number of bytes between rows in the bitmap's pixels.
Note that this refers to the pixels as stored natively by the bitmap.
If you call getPixels() or setPixels(), then the pixels are uniformly treated as 32bit values,
packed according to the Color class.
bitmap:
Return type: @return:number of bytes between rows of the native bitmap pixels.
getScaledHeight (bitmap As android.graphics.Bitmap, targetDensity As Int) As Int
Convenience method that returns the height of this bitmap divided by the density scale factor.
bitmap:
targetDensity: The density of the target canvas of the bitmap.
Return type: @return:The scaled height of this bitmap, according to the density scale factor.
getScaledWidth (bitmap As android.graphics.Bitmap, targetDensity As Int) As Int
Convenience method that returns the width of this bitmap divided by the density scale factor.
bitmap:
targetDensity: The density of the target canvas of the bitmap.
Return type: @return:The scaled width of this bitmap, according to the density scale factor.
getWidth (bitmap As android.graphics.Bitmap) As Int
Returns the bitmap's width
bitmap:
Return type: @return:
hasAlpha (bitmap As android.graphics.Bitmap) As Boolean
Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values.
For some configs, this is always false (e.g. RGB_565), since they do not support per-pixel alpha.
However, for configs that do, the bitmap may be flagged to be known that all of its pixels are opaque.
In this case hasAlpha() will also return false. If a config such as ARGB_8888 is not so flagged, it will return true by default.
bitmap:
Return type: @return:
Initialize (Eventname As String)
Initializes BitmapExtended Library.
isMutable (bitmap As android.graphics.Bitmap) As Boolean
Returns true if the bitmap is marked as mutable (i.e. can be drawn into)
bitmap:
Return type: @return:
isRecycled (bitmap As android.graphics.Bitmap) As Boolean
Returns true if this bitmap has been recycled. If so, then it is an error to try to access its pixels, and the bitmap will not draw.
bitmap:
Return type: @return:true if the bitmap has been recycled
JPEG As String
PNG As String
prepareToDraw (bitmap As android.graphics.Bitmap)
Rebuilds any caches associated with the bitmap that are used for drawing it.
In the case of purgeable bitmaps, this call will attempt to ensure that the pixels have been decoded.
If this is called on more than one bitmap in sequence, the priority is given in LRU order
(i.e. the last bitmap called will be given highest priority). For bitmaps with no associated caches,
this call is effectively a no-op, and therefore is harmless.
bitmap:
recycle (bitmap As android.graphics.Bitmap)
Free the native object associated with this bitmap, and clear the reference to the pixel data.
This will not free the pixel data synchronously; it simply allows it to be garbage collected if
there are no other references. The bitmap is marked as "dead", meaning it will throw an exception if
getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed,
so it should only be called if you are sure there are no further uses for the bitmap.
This is an advanced call, and normally need not be called, since the normal GC process will free
up this memory when there are no more references to this bitmap.
bitmap:
RGB_565 As String
rotateBitmap (bitmap As android.graphics.Bitmap, degrees As Float) As android.graphics.Bitmap
Rotates the bitmap.
bitmap:
degrees:
Return type: @return:
scaleBitmap (bitmap As android.graphics.Bitmap, sx As Float, sy As Float) As android.graphics.Bitmap
Scales the bitmap.
bitmap:
degrees:
Return type: @return:
setDensity (bitmap As android.graphics.Bitmap, density As Int)
Specifies the density for this bitmap. When the bitmap is drawn to a Canvas that also has a density,
it will be scaled appropriately.
bitmap:
density: The density scaling factor to use with this bitmap or DENSITY_NONE if the density is unknown.
setPixel (bitmap As android.graphics.Bitmap, x As Int, y As Int, color As Int)
Replace pixels in the bitmap with the colors in the array. Each element in the array is a packed int prepresenting a Color
bitmap:
x: The x coordinate of the pixel to replace (0...width-1)
y: The y coordinate of the pixel to replace (0...height-1)
color: The Color to write into the bitmap
setPixels (bitmap As android.graphics.Bitmap, pixels() As Int, offset As Int, stride As Int, x As Int, y As Int, width As Int, height As Int)
Replace pixels in the bitmap with the colors in the array. Each element in the array is a packed int prepresenting a Color
bitmap:
pixels: The colors to write to the bitmap
offset: The index of the first color to read from pixels[]
stride: The number of colors in pixels[] to skip between rows. Normally this value will be the same as the width of the bitmap, but it can be larger (or negative).
x: The x coordinate of the first pixel to write to in the bitmap.
y: The y coordinate of the first pixel to write to in the bitmap.
width: The number of colors to copy from pixels[] per row
height: The number of rows to write to the bitmap
skewBitmap (bitmap As android.graphics.Bitmap, kx As Float, ky As Float) As android.graphics.Bitmap
Skews the bitmap.
bitmap:
kx:
ky:
Return type: @return:
translateBitmap (bitmap As android.graphics.Bitmap, dx As Float, dy As Float) As android.graphics.Bitmap
Skews the bitmap.
bitmap:
degrees:
Return type: @return:
Top