BitmapFactory_Delegatepublic class BitmapFactory_Delegate extends Object Delegate implementing the native methods of android.graphics.BitmapFactory
Through the layoutlib_create tool, the original native methods of BitmapFactory have been
replaced by calls to methods of the same name in this delegate class.
Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager}
around to map int to instance of the delegate. |
Methods Summary |
---|
static Bitmap | nativeDecodeAsset(long asset, Rect padding, android.graphics.BitmapFactory.Options opts)
opts.inBitmap = null;
return null;
| static Bitmap | nativeDecodeByteArray(byte[] data, int offset, int length, android.graphics.BitmapFactory.Options opts)
opts.inBitmap = null;
return null;
| static Bitmap | nativeDecodeFileDescriptor(java.io.FileDescriptor fd, Rect padding, android.graphics.BitmapFactory.Options opts)
opts.inBitmap = null;
return null;
| static Bitmap | nativeDecodeStream(java.io.InputStream is, byte[] storage, Rect padding, android.graphics.BitmapFactory.Options opts)
Bitmap bm = null;
Density density = Density.MEDIUM;
Set<BitmapCreateFlags> bitmapCreateFlags = EnumSet.of(BitmapCreateFlags.MUTABLE);
if (opts != null) {
density = Density.getEnum(opts.inDensity);
if (opts.inPremultiplied) {
bitmapCreateFlags.add(BitmapCreateFlags.PREMULTIPLIED);
}
}
try {
if (is instanceof NinePatchInputStream) {
NinePatchInputStream npis = (NinePatchInputStream) is;
npis.disableFakeMarkSupport();
// load the bitmap as a nine patch
com.android.ninepatch.NinePatch ninePatch = com.android.ninepatch.NinePatch.load(
npis, true /*is9Patch*/, false /*convert*/);
// get the bitmap and chunk objects.
bm = Bitmap_Delegate.createBitmap(ninePatch.getImage(), bitmapCreateFlags,
density);
NinePatchChunk chunk = ninePatch.getChunk();
// put the chunk in the bitmap
bm.setNinePatchChunk(NinePatch_Delegate.serialize(chunk));
if (padding != null) {
// read the padding
int[] paddingArray = chunk.getPadding();
padding.left = paddingArray[0];
padding.top = paddingArray[1];
padding.right = paddingArray[2];
padding.bottom = paddingArray[3];
}
} else {
// load the bitmap directly.
bm = Bitmap_Delegate.createBitmap(is, bitmapCreateFlags, density);
}
} catch (IOException e) {
Bridge.getLog().error(null, "Failed to load image", e, null);
}
return bm;
| static boolean | nativeIsSeekable(java.io.FileDescriptor fd)
return true;
|
|