Methods Summary |
---|
public void | draw(Canvas canvas, Rect location)Draws the NinePatch. This method will use the paint returned by {@link #getPaint()}.
canvas.drawPatch(this, location, mPaint);
|
public void | draw(Canvas canvas, Rect location, Paint paint)Draws the NinePatch. This method will ignore the paint returned
by {@link #getPaint()} and use the specified paint instead.
canvas.drawPatch(this, location, paint);
|
public void | draw(Canvas canvas, RectF location)Draws the NinePatch. This method will use the paint returned by {@link #getPaint()}.
canvas.drawPatch(this, location, mPaint);
|
void | drawSoftware(Canvas canvas, RectF location, Paint paint)
nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap.ni(), mNativeChunk,
paint != null ? paint.mNativePaint : 0, canvas.mDensity, mBitmap.mDensity);
|
void | drawSoftware(Canvas canvas, Rect location, Paint paint)
nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap.ni(), mNativeChunk,
paint != null ? paint.mNativePaint : 0, canvas.mDensity, mBitmap.mDensity);
|
protected void | finalize()
try {
if (mNativeChunk != 0) {
// only attempt to destroy correctly initilized chunks
nativeFinalize(mNativeChunk);
}
} finally {
super.finalize();
}
|
public Bitmap | getBitmap()Returns the bitmap used to draw this NinePatch.
return mBitmap;
|
public int | getDensity()Return the underlying bitmap's density, as per
{@link Bitmap#getDensity() Bitmap.getDensity()}.
return mBitmap.mDensity;
|
public int | getHeight()Returns the intrinsic height, in pixels, of this NinePatch. This is equivalent
to querying the height of the underlying bitmap returned by {@link #getBitmap()}.
return mBitmap.getHeight();
|
public java.lang.String | getName()Returns the name of this NinePatch object if one was specified
when calling the constructor.
return mSrcName;
|
public Paint | getPaint()Returns the paint used to draw this NinePatch. The paint can be null.
return mPaint;
|
public final Region | getTransparentRegion(Rect bounds)Returns a {@link Region} representing the parts of the NinePatch that are
completely transparent.
long r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
return r != 0 ? new Region(r) : null;
|
public int | getWidth()Returns the intrinsic width, in pixels, of this NinePatch. This is equivalent
to querying the width of the underlying bitmap returned by {@link #getBitmap()}.
return mBitmap.getWidth();
|
public final boolean | hasAlpha()Indicates whether this NinePatch contains transparent or translucent pixels.
This is equivalent to calling getBitmap().hasAlpha() on this
NinePatch.
return mBitmap.hasAlpha();
|
public static native boolean | isNinePatchChunk(byte[] chunk)Verifies that the specified byte array is a valid 9-patch data chunk.
|
private static native void | nativeDraw(long canvas_instance, RectF loc, long bitmap_instance, long c, long paint_instance_or_null, int destDensity, int srcDensity)
|
private static native void | nativeDraw(long canvas_instance, Rect loc, long bitmap_instance, long c, long paint_instance_or_null, int destDensity, int srcDensity)
|
private static native void | nativeFinalize(long chunk)
|
private static native long | nativeGetTransparentRegion(long bitmap, long chunk, Rect location)
|
public void | setPaint(Paint p)Sets the paint to use when drawing the NinePatch.
mPaint = p;
|
private static native long | validateNinePatchChunk(long bitmap, byte[] chunk)Validates the 9-patch chunk and throws an exception if the chunk is invalid.
If validation is successful, this method returns a native Res_png_9patch*
object used by the renderers.
|