Drawable::getBounds question


what is exactly returned by:

getBounds ( float & x,
float & y,
float & width,
float & height

… and what’s the impact on Drawable::draw()

Does JUCE check if there’s “nothing around” the drawable (empty regions), and only return a rectangular region where something is lying in by getBounds() ?

And if yes, does Drawable::draw() draw from point (x,y) on, thus considering it as drawing origin or does one have to manually adjust that?


Sorry, don’t really understand the question? A drawable is some kind of image or shape, so like it says in the comments, getBounds returns the rectangle that encloses the whole of that image or shape. It has no impact on drawing or anything else (…?)


Ok, so when I want some Image (width and height being the ones returned by getBounds())to be drawn of the drawable, I have to use drawAt(image,-x-y) ?
x and y being the coordinates returned by getBounds() ?


Ah, I see. The drawable bounds are returned relative to its own origin. The co-ordinates you pass to drawAt are added to that origin before it’s drawn.