FileDocCategorySizeDatePackage
BitmapFactory_Delegate.javaAPI DocAndroid 5.1 API4421Thu Mar 12 22:22:44 GMT 2015android.graphics

BitmapFactory_Delegate

public 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.

Fields Summary
Constructors Summary
Methods Summary
static BitmapnativeDecodeAsset(long asset, Rect padding, android.graphics.BitmapFactory.Options opts)

        opts.inBitmap = null;
        return null;
    
static BitmapnativeDecodeByteArray(byte[] data, int offset, int length, android.graphics.BitmapFactory.Options opts)

        opts.inBitmap = null;
        return null;
    
static BitmapnativeDecodeFileDescriptor(java.io.FileDescriptor fd, Rect padding, android.graphics.BitmapFactory.Options opts)

        opts.inBitmap = null;
        return null;
    
static BitmapnativeDecodeStream(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 booleannativeIsSeekable(java.io.FileDescriptor fd)

        return true;