Skip to content

Conversation

@carlosen14
Copy link

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!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants