ImageLayout icon indicating copy to clipboard operation
ImageLayout copied to clipboard

Add the option to set a Bitmap as ImageResource

Open carlosen14 opened this issue 9 years ago • 0 comments

you have these methods..

    /**
     * Changes the background image and its layout dimensions.
     */
    public void setImageResource(int imageResource, int imageWidth, int imageHeight) {
        bitmap = extractBitmapFromDrawable(getResources().getDrawable(imageResource));
        bitmapSrcRect = bitmapRect(bitmap);

        this.imageWidth = imageWidth;
        this.imageHeight = imageHeight;

        rebuildFitter();
    }

    private static Bitmap extractBitmapFromDrawable(Drawable drawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

But you have to pass the image as int from the resources, there's should be a way to set a Bitmap directly as ImageResource, i think it is possible and it is not a big deal, but i want to set it programmatically depending on the situation and it will be very helpful in my needs..

Great tool, by the way!!

carlosen14 avatar Jun 02 '16 17:06 carlosen14