[interfacekit] Re: :) Again - BBitmap

On Mon, 28 Jul 2003 11:47:07 +0200 "Marc Flerackers" <
mflerackers@xxxxxxxxxx> wrote:
> > > Look for example at BPrintJob,
> > > BPrintJob::DrawView() needs the given view to be attached to a 
> > > window
> > > because the drawing commands need to reach the app_server. "The 
> > > view
> > > must be
> > > attached to a window; that is, it must be known to the 
> > > Application
> > > Server."
> >
> > I fail to get what BPrintJob has to do with bitmap drawing.
> 
> It's quite simple. When you attach a view to a bitmap, which accepts 
> views,
> the view is attached to an offscreen window, which means it gets a 
> server
> counterpart, and a connection to the app_server.
> This connection is needed to print the view.

Ah, OK. It never occurred to me, that one could print the view used for 
drawing the bitmap.

> With a local drawing library, you don't have a connection, which 
> means that
> a view attached to this "local drawing bitmap" cannot be printed, 
> which
> means it's not backwards compatible.

Yep. The app server connection could be established on demand, but I 
have to admit, that this would overly complicate this `small footprint' 
approach. :-(

> This is just one example of something
> which has to be changed if you make the BBitmap change. I'm now 
> almost
> working for two years on my app_server. I noticed there are lots of 
> "hidden"
> connections in the Be API, so a change which looks simple can take 
> lots of
> work on many other seemingly unrelated things to make it all work 
> again.

That's not so nice.

> > > I would write an API like the BPicture one,
> > > a BeginDrawBitmap(bitmap) and EndDrawBitmap(). All the drawing
> > > instructions
> > > received between those calls would be rendered into the bitmap
> > > instead of
> > > the window. This would make a lot of sense, since you would most
> > > likely call
> > > view->Draw(view->Bounds()) from a window thread anyway, so why 
> > > not
> > > let that
> > > server thread do the work?
> >
> > Though I don't get the last part,
> 
> I R5, when you draw in a BBitmap, you often call the views drawing 
> functions
> from another BWindow thread.
> 
> BWindow::something()
> {
>       fBitmap->Lock();
>       fViewAttachedToTheBitmap->Draw(someRect);
>       fBitmap->Unlock();
> }
> 
> That's why I proposed this, it's the same thread that's occupied with 
> the
> drawing, and there are no BBitmap threads needed and rendering still 
> happens
> on the server, in one place (Btw, rendering also includes all 
> clipping
> calculations, and the management of clipping regions).
> 
> BWindow::something()
> {
>       BeginDrawBitmap(fBitmap);
>       fViewAttachedToTheWindow->Draw(someRect);
>       EndDrawBitmap();
> }
> 
> I know you still need a BWindow, but at least you can use one window 
> to draw
> in any bitmap you want.

OK, I see.

CU, Ingo


Other related posts: