|
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.NinePatch
public class NinePatch
The NinePatch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes. Normally, the middle is transparent so that the patch can provide a selection about a rectangle. Essentially, it allows the creation of custom graphics that will scale the way that you define, when content added within the image exceeds the normal bounds of the graphic. For a thorough explanation of a NinePatch image, read the discussion in the Available Resource Types document.
The Draw 9-patch tool offers an extremely handy way to create your NinePatch images, using a WYSIWYG graphics editor.
| Constructor Summary | |
|---|---|
NinePatch(Bitmap bitmap,
byte[] chunk,
String srcName)
Create a drawable projection from a bitmap to nine patches. |
|
| Method Summary | |
|---|---|
void |
draw(Canvas canvas,
Rect location)
Draw a bitmap to nine patches. |
void |
draw(Canvas canvas,
RectF location)
Draw a bitmap to nine patches. |
void |
draw(Canvas canvas,
Rect location,
Paint paint)
Draw a bitmap to nine patches. |
int |
getHeight()
|
Region |
getTransparentRegion(Rect location)
|
int |
getWidth()
|
boolean |
hasAlpha()
|
static boolean |
isNinePatchChunk(byte[] chunk)
|
void |
setPaint(Paint p)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NinePatch(Bitmap bitmap,
byte[] chunk,
String srcName)
bitmap - The bitmap describing the patches.chunk - The 9-patch data chunk describing how the underlying
bitmap is split apart and drawn.srcName - The name of the source for the bitmap. Might be null.| Method Detail |
|---|
public void setPaint(Paint p)
public void draw(Canvas canvas,
RectF location)
canvas - A container for the current matrix and clip used to draw the bitmap.location - Where to draw the bitmap.
public void draw(Canvas canvas,
Rect location)
canvas - A container for the current matrix and clip used to draw the bitmap.location - Where to draw the bitmap.
public void draw(Canvas canvas,
Rect location,
Paint paint)
canvas - A container for the current matrix and clip used to draw the bitmap.location - Where to draw the bitmap.paint - The Paint to draw through.public int getWidth()
public int getHeight()
public final boolean hasAlpha()
public final Region getTransparentRegion(Rect location)
public static boolean isNinePatchChunk(byte[] chunk)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||