I have come across a situation where I need to
dynamically resize my offscreen bitmap/view
combination, and come across an interesting
bug/feature(?).
Since there is no way to dynamically resize a
BBitmap (as far as I know ... please feel free to
enlighten me) you have to 'delete' the old one
and then create a 'new' one with the desired
size.
So here is the steps of what I wanted to do:
1-Resize the BView attached to the offscreen
bitmap to the new size.
2-Detach/RemoveChild() the BView from the
offscreen BBitmap.
3-Delete the BBitmap.
4-Create the new BBitmap with the proper size.
5-Re-attach the BView as a child of the BBitmap.
And this all "worked" in that it didn't report
any failures and calls to Bounds() for both the
BView and the BBitmap reported the right size.
However, if you were to draw to the BView you
find that it will not extend out of the original
bounds that the first BBitmap was created with.
However this sequence of events works just fine:
1-Detach/RemoveChild() the BView from the
offscreen BBitmap.
2-Delete the BView attached to the offscreen
bitmap
3-Delete the BBitmap.
4-Create a new BBitmap and BView with the required
proper size.
5-Re-attach the BView as a child of the BBitmap.
This is a real pain since it means that you have
to allocate a new BView every time you want to
resize the bitmap (resizing the bitmap is bad
enough!).
Anyone care to provide their opinions on this
behaviour. I can send you code to demonstrate
this behaviour.
Thanks,
Thomas
------------------------------------------------------
Thomas Fletcher Computer Engineering
tfle...@engr.uvic.ca University of Victoria
http://www.engr.uvic.ca
: This is a real pain since it means that you have
: to allocate a new BView every time you want to
: resize the bitmap (resizing the bitmap is bad
: enough!).
BView allocation isn't a big deal, but reallocating the bitmap'll kill
you. BBitmap reallocation is *slow*. My solution to the problem with
ProcLoad was to create a bitmap as big as I let the window get, then
just use part of the bitmap if the window is smaller. Yes, this is
slightly inefficient memory-wise, but much more processor-efficient.
__________________________________________________________________________
`-._ Jonathan Booth - kami...@imsa.edu _ "You can't have any; you're _.-'
`-.__ http://www.imsa.edu/~kamikaze ___ too young!" -Porthos- __.-'