[haiku-development] Blitting

  • From: Caitlin Shaw <rogueeve@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 14 Sep 2009 12:35:27 -0700

I'm wondering what kind of support does Haiku offer for what's commonly 
called "bit-block-transfer" or "copybits" (within normal applications, 
not talking about the Game Kit).

I've managed to:

* Implement an off-screen buffer by creating a BBitmap and associating 
it with a BView, then blitting the buffer to the screen by calling 
DrawBitmap on the target BView, and,

* Move data around within a single BView by calling it's CopyBits function.

Am I missing something? Am I thinking using the wrong methodology? But 
these methods seem to missing some important flexibility, namely, it 
doesn't seem to offer any way to blit OUT of a BView, only IN, and then 
there's special rules about where the source data can come from.

It seems that surely there would be some function which takes two BViews 
and copies between them. The existing methods (that I know of) just seem 
kind of uncomfortable and inflexible. Is there a way to have a 
BBitmap-enabled BView, which is also visible onscreen? And, is 
"DrawBitmap" the recommended way to perform blits (is it optimized for 
speed in the same way that a bit-blit-specific function would be on 
other systems).

BTW, the application for this is that I have an on-screen image, which 
has a user-movable cursor in it. The cursor was supposed to have a 
backbuffer, which would contain the contents of the screen behind it, so 
that the screen could be restored when the cursor is moved. The only way 
I have found to implement this technique on Haiku is to backbuffer the 
entire screen, but that means that instead of two teensy tiny blits I 
have to do one HUGE blit every time the screen is updated, which is very 
inefficient; so instead, I have taken to simply recalculating the 
missing image data, but that is also fairly inefficient.




Other related posts: