Drawing Graphics primitives overtop Onscreen BeOS Objects
Or, one possible strategy for Java2D prototyped out in a normal application
I love Rocky & Bullwinkel style titles. Anyhow, I sat down tonight, finally to conquer something that I’ve been tossing around in my head for some time. How to handle blitting graphics primitive calls overtop of existing onscreen objects. The locking is a tad bit tricky, but it seems to be quite responsive. We’ll see how things go when I actually write a Java2D implementation based on this trickery.
Here’s a screenshot of the currently selected strategy (which also provides double-buffering!) in action. I wasn’t handling clipping regions, invalidation, or other obstructions in this code — that’s handled by the existing AWT framework in the real thing, so I didn’t want to triffel with that here. As a side effect, clicking the button dosen’t redraw the pattern overtop, and the lines fade in (since I was using alpha on the lines). The red lines are drawn by one thread, the blue by another thread, both executing outside of the actual thread the BButton is a member of. The two threads draw to a single BBitmap, which is then blitted back to the BButton’s view. I’ve been impressed with how well it runs.
So now that I’ve got a working blit strategy, it’s a matter of making this fit into the internal native Java2D api I have to implement, and from there… well… we’ll see. :-D
Oh yeah, that’s a BButton back there, with the label “A Button”.
