Build 1.0_r1(from source)

android.graphics.drawable
Class PictureDrawable

java.lang.Object
  extended by android.graphics.drawable.Drawable
      extended by android.graphics.drawable.PictureDrawable

public class PictureDrawable
extends Drawable

Drawable subclass that wraps a Picture, allowing the picture to be used whereever a Drawable is supported.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
 
Field Summary
 
Fields inherited from class android.graphics.drawable.Drawable
mCallback
 
Constructor Summary
PictureDrawable(Picture picture)
          Construct a new drawable referencing the specified picture.
 
Method Summary
 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).
 int getIntrinsicHeight()
          Return the intrinsic height of the underlying drawable object.
 int getIntrinsicWidth()
          Return the intrinsic width of the underlying drawable object.
 int getOpacity()
          Return the opacity/transparency of this Drawable.
 Picture getPicture()
          Return the picture associated with the drawable.
 void setAlpha(int alpha)
          Specify an alpha value for the drawable.
 void setColorFilter(ColorFilter colorFilter)
          Specify an optional colorFilter for the drawable.
 void setDither(boolean dither)
          Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component.
 void setFilterBitmap(boolean filter)
          Set to true to have the drawable filter its bitmap when scaled or rotated (for drawables that use bitmaps).
 void setPicture(Picture picture)
          Associate a picture with this drawable.
 
Methods inherited from class android.graphics.drawable.Drawable
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromStream, createFromXml, createFromXmlInner, getBounds, getChangingConfigurations, getConstantState, getCurrent, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, getTransparentRegion, inflate, inflateWithAttributes, invalidateSelf, isStateful, isVisible, onBoundsChange, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setLevel, setState, setVisible, unscheduleSelf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PictureDrawable

public PictureDrawable(Picture picture)
Construct a new drawable referencing the specified picture. The picture may be null.

Parameters:
picture - The picture to associate with the drawable. May be null.
Method Detail

getPicture

public Picture getPicture()
Return the picture associated with the drawable. May be null.

Returns:
the picture associated with the drawable, or null.

setPicture

public void setPicture(Picture picture)
Associate a picture with this drawable. The picture may be null.

Parameters:
picture - The picture to associate with the drawable. May be null.

draw

public void draw(Canvas canvas)
Description copied from class: Drawable
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).

Specified by:
draw in class Drawable
Parameters:
canvas - The canvas to draw into

getIntrinsicWidth

public int getIntrinsicWidth()
Description copied from class: Drawable
Return the intrinsic width of the underlying drawable object. Returns -1 if it has no intrinsic width, such as with a solid color.

Overrides:
getIntrinsicWidth in class Drawable

getIntrinsicHeight

public int getIntrinsicHeight()
Description copied from class: Drawable
Return the intrinsic height of the underlying drawable object. Returns -1 if it has no intrinsic height, such as with a solid color.

Overrides:
getIntrinsicHeight in class Drawable

getOpacity

public int getOpacity()
Description copied from class: Drawable
Return the opacity/transparency of this Drawable. The returned value is one of the abstract format constants in PixelFormat: PixelFormat.UNKNOWN, PixelFormat.TRANSLUCENT, PixelFormat.TRANSPARENT, or PixelFormat.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 Drawable.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 Drawable.setAlpha(int) or Drawable.setColorFilter(android.graphics.ColorFilter) methods.

Specified by:
getOpacity in class Drawable
Returns:
int The opacity class of the Drawable.
See Also:
PixelFormat

setFilterBitmap

public void setFilterBitmap(boolean filter)
Description copied from class: Drawable
Set to true to have the drawable filter its bitmap when scaled or rotated (for drawables that use bitmaps). If the drawable does not use bitmaps, this call is ignored. This can improve the look when scaled or rotated, but also slows down the drawing.

Overrides:
setFilterBitmap in class Drawable

setDither

public void setDither(boolean dither)
Description copied from class: Drawable
Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component. This can improve the look on those devices, but can also slow down the drawing a little.

Overrides:
setDither in class Drawable

setColorFilter

public void setColorFilter(ColorFilter colorFilter)
Description copied from class: Drawable
Specify an optional colorFilter for the drawable. Pass null to remove any filters.

Specified by:
setColorFilter in class Drawable

setAlpha

public void setAlpha(int alpha)
Description copied from class: Drawable
Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.

Specified by:
setAlpha in class Drawable

Build 1.0_r1(from source)

Please submit a feedback, bug or feature