Sign in Join

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

Mailing lists / lazarus / 2010-03

Raster image data in RGB24 or ARGB32

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Unknown author

Hi.

I'am working on Cairo Canvas implementation
and for implementing StretchDraw function I need
to get RasterImage data in format RGB24 or ARGB32.

CAIRO_FORMAT_ARGB32
each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)

CAIRO_FORMAT_RGB24
each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order.

Can I use TLazIntfImage for this task and how?

Thanks.

Petr

Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Luiz Americo Pereira Camara
to Unknown author
Show quoted text 18 lines
Hi. I'am working on Cairo Canvas implementation and for implementing StretchDraw function I need to get RasterImage data in format RGB24 or ARGB32. CAIRO_FORMAT_ARGB32 each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.) CAIRO_FORMAT_RGB24 each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order. Can I use TLazIntfImage for this task and how?

AFAIK is not possible. Search for thread "How to load aRGBA data from a bitmap file using TLazIntfImage" in Lazarus list.

Also read http://forum.lazarus.freepascal.org/index.php/topic,7771.0.html

BTW: in LuiImage implementation you can find how implement StrechDraw feature in cairo:
http://luipack.googlecode.com/svn/trunk/luicairo/luiimage.pas

There you will find also how to get the appropriate data format for cairo using imaginglib

Luiz

Reply by email