[lazarus] started porting Delphi PNG unit to FPC/Lazarus

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sat Jun 28 11:05:48 EDT 2003




On Sat, 28 Jun 2003, Stefan Weber wrote:

> I've started porting the native Delphi PNG sources available at
> http://pngdelphi.sourceforge.net/pngimage143.zip.
> The unit compiles with FPC after applying the diff from the attachment.
> (The source is freeware, but I cannot distribute the modified source
> without permisson from the author.)
>
> It is possible to load and save PNG Images, but the drawing functions do
> not work. This is due to the lack of support for DIB-related Windows API
> functions in the LCL. Those functions are not yet implemented. I've
> tried a little to find a simple way to assign the png to a bitmap but
> failed.
>
> Finally I've used a simple loop to draw the picture inside TPaintBox.Paint:
>
>     for y := 0 to png.Height - 1 do
>       for x := 0 to png.Width - 1 do
>         aCanvas.Pixels[x,y] := png.Pixels[x,y];
>
> While trying to draw to an offscreen TBitmap, I found that setting
> Pixels does not work if there's no Widget associated with the Bitmap
>
> Since I don't have the time to work on this in the next days, I decided
> to post the source ... maybe one of you wants to give it a try?
>
> My test source is included with this mail.
>
> Probably it would be better to get the LCL DIB stuff working instead of
> trying to work around it ... what do you think?

We're working on a solution in the FCL itself. It includes a PNG and XPM
reader/writer, with support for all PNG features.

Michael.






More information about the Lazarus mailing list