Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-02

Fastest way to draw TFPMemoryImage

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszyk

What is the fastest way to draw a TFPMemoryImage on a TCanvas in the LCL? I've looked for some examples but sofar I just couldn't find any.

TCanvas is a descendent from an fcl-image one, but I couldn't get it to work for some strange reason.

Any ideas?

Regards, Darius

Reply by email

Unknown author
to Felipe Monteiro de Carvalho

Unfortunately yes. I use a TFPMemoryImage descendant as internal datastructure in my application. Alternatively I could use OpenGL context to draw the images (thumbnails), but I would prefer TCanvas if possible. For now I'm just copying the data over to a bitmap, but this is of course far from ideal.

Gr. Darius

Felipe Monteiro de Carvalho wrote
Does it have to be TFPMemoryImage?

You can use TLazCanvas+TLazIntfImage+RawImage, like this wiki example

demonstrates:

http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Using_the_non-native_StretchDraw_from_LazCanvas [1]

Links:
------
[1]
http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Using_the_non-native_StretchDraw_from_LazCanvas -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120204/c47aa61f/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Unknown author

2012/2/4 :

Show quoted text 5 lines
Unfortunately yes. I use a TFPMemoryImage descendant as internal datastructure in my application. Alternatively I could use OpenGL context to draw the images (thumbnails), but I would prefer TCanvas if possible. For now I'm just copying the data over to a bitmap, but this is of course far from ideal.

How are you doing the copy of the data to a TBitmap? This step is necessary anyway, but you cannot do it reliably in all supported platform without TLazIntfImage.

TLazIntfImage+RawImage does the same job as TFPMemoryImage, they even come from the same base class:

TLazIntfImage = class(TFPCustomImage)

So I bet you could use that internally instead of TFPMemoryImage. And then you get better LCL integration.

Felipe Monteiro de Carvalho

Reply by email