|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.graphics.drawable.Drawable
android.graphics.drawable.BitmapDrawable
public class BitmapDrawable
| Nested Class Summary | |
|---|---|
(package private) static class |
BitmapDrawable.BitmapState
|
| 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 | |
|---|---|
BitmapDrawable()
|
|
BitmapDrawable(Bitmap bitmap)
|
|
BitmapDrawable(InputStream is)
|
|
BitmapDrawable(String filepath)
|
|
| 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). |
Bitmap |
getBitmap()
|
int |
getChangingConfigurations()
Return a mask of the configuration parameters for which this drawable mau change, requiring that it be re-created. |
Drawable.ConstantState |
getConstantState()
|
int |
getGravity()
Get the gravity used to position/stretch the bitmap within its bounds. |
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. |
Paint |
getPaint()
|
Shader.TileMode |
getTileModeX()
|
Shader.TileMode |
getTileModeY()
|
void |
inflate(Resources r,
XmlPullParser parser,
AttributeSet attrs)
|
protected void |
onBoundsChange(Rect bounds)
Override this in your subclass to change appearance if you recognize the specified state. |
void |
setAlpha(int alpha)
Specify an alpha value for the drawable. |
void |
setAntiAlias(boolean aa)
|
void |
setColorFilter(ColorFilter cf)
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 |
setGravity(int gravity)
Set the gravity used to position/stretch the bitmap within its bounds. |
void |
setTileModeX(Shader.TileMode mode)
|
void |
setTileModeXY(Shader.TileMode xmode,
Shader.TileMode ymode)
|
void |
setTileModeY(Shader.TileMode mode)
|
| Methods inherited from class android.graphics.drawable.Drawable |
|---|
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromStream, createFromXml, createFromXmlInner, getBounds, getCurrent, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, getTransparentRegion, inflateWithAttributes, invalidateSelf, isStateful, isVisible, 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 |
|---|
public BitmapDrawable()
public BitmapDrawable(Bitmap bitmap)
public BitmapDrawable(String filepath)
public BitmapDrawable(InputStream is)
| Method Detail |
|---|
public final Paint getPaint()
public final Bitmap getBitmap()
public int getGravity()
public void setGravity(int gravity)
gravity - the gravitypublic void setAntiAlias(boolean aa)
public void setFilterBitmap(boolean filter)
Drawable
setFilterBitmap in class Drawablepublic void setDither(boolean dither)
Drawable
setDither in class Drawablepublic Shader.TileMode getTileModeX()
public Shader.TileMode getTileModeY()
public void setTileModeX(Shader.TileMode mode)
public final void setTileModeY(Shader.TileMode mode)
public void setTileModeXY(Shader.TileMode xmode,
Shader.TileMode ymode)
public int getChangingConfigurations()
DrawableDrawable.setChangingConfigurations(int) or 0 by default. Subclasses
may extend this to or in the changing configurations of any other
drawables they hold.
getChangingConfigurations in class DrawableConfiguration.Configurationprotected void onBoundsChange(Rect bounds)
Drawable
onBoundsChange in class Drawablepublic void draw(Canvas canvas)
Drawable
draw in class Drawablecanvas - The canvas to draw intopublic void setAlpha(int alpha)
Drawable
setAlpha in class Drawablepublic void setColorFilter(ColorFilter cf)
Drawable
setColorFilter in class Drawable
public void inflate(Resources r,
XmlPullParser parser,
AttributeSet attrs)
throws XmlPullParserException,
IOException
inflate in class DrawableXmlPullParserException
IOExceptionpublic int getIntrinsicWidth()
Drawable
getIntrinsicWidth in class Drawablepublic int getIntrinsicHeight()
Drawable
getIntrinsicHeight in class Drawablepublic int getOpacity()
DrawablePixelFormat:
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.
getOpacity in class DrawablePixelFormatpublic final Drawable.ConstantState getConstantState()
getConstantState in class Drawable
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||