Recent

Author Topic: Using TBGRABitmap  (Read 9496 times)

PeteS

  • New Member
  • *
  • Posts: 14
Using TBGRABitmap
« on: June 08, 2011, 08:25:43 pm »
Firstly, thanks a lot to the TBGRABitmap developers - it is a great library and your efforts are much appreciated!

What is the best (fastest) way to display a TBGRABitmap - draw to the canvas of a TForm or a TPanel, or assign to the bitmap of a TImage or a TPaintBox?  What about using the TBGRAVirtualScreen?

I'll be wanting to display a BM, zoom it and scroll it, so speed is the key issue.


circular

  • Hero Member
  • *****
  • Posts: 4457
    • Personal webpage
Re: Using TBGRABitmap
« Reply #1 on: June 08, 2011, 08:56:45 pm »
You're welcome. I hope it is useful.

The fastest way is to draw a TBGRABitmap is to draw it on a canvas like this :
Quote
  bgraBmp.Draw(Canvas,0,0);

As far as I know, the surface does not matter (TForm, TPanel or TPaintBox).

Using a TImage is slower, because it is copies on a TBitmap which is then drawn to the screen.

If you want to use a surface and keep what you are drawing, you can use TBGRAVirtualScreen. It handles the changes of the size and avoids flickering.

So basically you have two ways :
- creating your own TBGRABitmap and draw it on a TForm in the OnPaint event. When you want to update the image, modify TBGRABitmap content and call TForm.Invalidate
- use a TBGRAVirtualScreen and update the content in the OnRedraw event. When you want to update the image, just call TBGRAVirtualScreen.RedrawBitmap
Conscience is the debugger of the mind

PeteS

  • New Member
  • *
  • Posts: 14
Re: Using TBGRABitmap
« Reply #2 on: June 08, 2011, 09:14:36 pm »
Goodness circular, that was quick, I barely had time for a small glass of wine!  Many thanks for the tips.

Next question - from your experience is it quicker to run through the BM using only the pixel pointer, or using the scanline per row?  I've written a colour counting routine and instinctively used the first approach, but was wondering if there would be much difference.

circular

  • Hero Member
  • *****
  • Posts: 4457
    • Personal webpage
Re: Using TBGRABitmap
« Reply #3 on: June 09, 2011, 12:12:10 pm »
If there is no need to take the line order into account, you can use the Data pointer. Otherwise, you need to use Scanline. There is not much difference, but using Data is slightely faster and also simpler to implement.
Conscience is the debugger of the mind

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: Using TBGRABitmap
« Reply #4 on: June 11, 2011, 12:27:18 am »
Hi Circular,

I attempted to install BgraBitmap via svn using Synaptic in Debian. and the sytnax for the repository address I gave wasn't correct apparently (i just pasted from the Wiki installation instructions the "deb ...." command line listing)

Do you know the correct syntax to install via synaptic?

Recommend any particular svn client (rabbitsvn? synaptic? etc)

Thanks




circular

  • Hero Member
  • *****
  • Posts: 4457
    • Personal webpage
Re: Using TBGRABitmap
« Reply #5 on: June 11, 2011, 10:10:45 am »
I don't know, i'm using Windows.
Conscience is the debugger of the mind

mica

  • Full Member
  • ***
  • Posts: 196
Re: Using TBGRABitmap
« Reply #6 on: June 11, 2011, 01:58:56 pm »
Hi Circular,

I attempted to install BgraBitmap via svn using Synaptic in Debian. and the sytnax for the repository address I gave wasn't correct apparently (i just pasted from the Wiki installation instructions the "deb ...." command line listing)

Do you know the correct syntax to install via synaptic?

Recommend any particular svn client (rabbitsvn? synaptic? etc)

Thanks





there are no deb packages so you cant install it with synaptic

for svn download just use plain svn
http://linux.die.net/man/1/svn

 

TinyPortal © 2005-2018