Does setSize work for bitmaps?

Sorry if this is a dumb question, but does setSize() work for bitmaps?

  • It isn't a dumb question. It does do something, but it doesn't actually do what you are expecting it to do.

    A Drawable has a location (locX, locY) and a size (width, height). When you call Drawable.setSize(), you are just modifying the width/height attributes.

    When a Bitmap is drawn (with Graphics.drawBitmap() and via Bitmap.draw() functions) the entire bitmap is drawn, regardless of the current width/height attribute values.

    We don't do any image scaling on render, so if you were to set the dimension to something other than the size of the bitmap we can't really scale the bitmap (I'm assuming this is the behavior you were expecting).