Board index » delphi » Which is quicker: Canvas or BitBlt

Which is quicker: Canvas or BitBlt

What is the "fastest" way to paint a background on a form?   An example in
Lloyd's help file uses "Canvas.Draw".  I was under the impression just
bitblting everything to the form would be quicker.  Any suggestions/ideas?

Also, on a slightly different note, I'm trapping the WM_NCPAINT message and
doing my own Caption/Border.  This looks way cool, as it gives a drag-able
form without an annoying winbloze bar.  (Yes, I know, you can get rid of that
with bsSingle, but then you can't move it around).  I had a lot of problems
trying to paint the frame..but it works well enough now. The problem is that
when one clicks on the main app (the form in question is a subwindow) it
repaints the caption bar.  How is it?  I'm doing a custom ncpaint, so where is
it pointing to paint the caption?  It happens when the form looses and gets
focus.  I tried trapping WM_ENABLE to no avail.  Anyone know which message is
the culprit, and how to get around it? Thanks in advance,
-Seth.

 

Re:Which is quicker: Canvas or BitBlt


Quote
Seth Stahlman wrote:

> What is the "fastest" way to paint a background on a form?   An example in
> Lloyd's help file uses "Canvas.Draw".  I was under the impression just
> bitblting everything to the form would be quicker.  Any suggestions/ideas?

        A person might say that using API calls with DC's must be faster,
since the Delphi methods do stuff and then make those same API calls.

        If a person said that there would be two things to say in reply:
First, it seems likely that except under extraordinary circumstances the
performance hit will be negligible, compared to the amount of time it takes
to draw to the screen in the first place. There's a reason you're not
writing your Windows programs in assembler, right? Second, it might not
even be true that using the API is faster: If you go the API route you'll
presumably be calling GetDC, which takes some time; Delphi is said to
cache resources to accelerate such things.

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Other Threads