public class

FastBitmapDrawable

extends Drawable
java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ com.droidux.pack.layouts.drawable.FastBitmapDrawable

Class Overview

A simple Drawable to draw bitmap object.

Summary

Public Constructors
FastBitmapDrawable(Bitmap b)
Public Methods
void draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
Bitmap getBitmap()
int getIntrinsicHeight()
Return the intrinsic height of the underlying drawable object.
int getIntrinsicWidth()
Return the intrinsic width of the underlying drawable object.
int getMinimumHeight()
Returns the minimum height suggested by this Drawable.
int getMinimumWidth()
Returns the minimum width suggested by this Drawable.
int getOpacity()
Return the opacity/transparency of this Drawable.
void setAlpha(int alpha)
Specify an alpha value for the drawable.
void setBitmap(Bitmap b)
void setColorFilter(ColorFilter cf)
Specify an optional color filter for the drawable.
[Expand]
Inherited Methods
From class android.graphics.drawable.Drawable
From class java.lang.Object

Public Constructors

public FastBitmapDrawable (Bitmap b)

Since: API Level 2.5

Public Methods

public void draw (Canvas canvas)

Since: API Level 2.5

Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).

Parameters
canvas The canvas to draw into

public Bitmap getBitmap ()

Since: API Level 2.5

public int getIntrinsicHeight ()

Since: API Level

Return the intrinsic height of the underlying drawable object. Returns -1 if it has no intrinsic height, such as with a solid color.

public int getIntrinsicWidth ()

Since: API Level

Return the intrinsic width of the underlying drawable object. Returns -1 if it has no intrinsic width, such as with a solid color.

public int getMinimumHeight ()

Since: API Level

Returns the minimum height suggested by this Drawable. If a View uses this Drawable as a background, it is suggested that the View use at least this value for its height. (There will be some scenarios where this will not be possible.) This value should INCLUDE any padding.

Returns
  • The minimum height suggested by this Drawable. If this Drawable doesn't have a suggested minimum height, 0 is returned.

public int getMinimumWidth ()

Since: API Level

Returns the minimum width suggested by this Drawable. If a View uses this Drawable as a background, it is suggested that the View use at least this value for its width. (There will be some scenarios where this will not be possible.) This value should INCLUDE any padding.

Returns
  • The minimum width suggested by this Drawable. If this Drawable doesn't have a suggested minimum width, 0 is returned.

public int getOpacity ()

Since: API Level 2.5

Return the opacity/transparency of this Drawable. The returned value is one of the abstract format constants in PixelFormat: UNKNOWN, TRANSLUCENT, TRANSPARENT, or OPAQUE.

Generally a Drawable should be as conservative as possible with the value it returns. For example, if it contains multiple child drawables and only shows one of them at a time, if only one of the children is TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be returned. You can use the method resolveOpacity(int, int) to perform a standard reduction of two opacities to the appropriate single output.

Note that the returned value does not take into account a custom alpha or color filter that has been applied by the client through the setAlpha(int) or setColorFilter(ColorFilter) methods.

Returns
  • int The opacity class of the Drawable.

public void setAlpha (int alpha)

Since: API Level 2.5

Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.

public void setBitmap (Bitmap b)

Since: API Level 2.5

public void setColorFilter (ColorFilter cf)

Since: API Level 2.5

Specify an optional color filter for the drawable. Pass null to remove any existing color filter.

Parameters
cf the color filter to apply, or null to remove the existing color filter