If you need png reading, why not use http://www.pascalgamedevelopment.com...ete-PNG-loader ?
If you need png reading, why not use http://www.pascalgamedevelopment.com...ete-PNG-loader ?
my projects https://github.com/dpethes
For once, it seems confusing to use. Secondly, I don't see how I can use it to directly load PNG into Allegro.pas' al_Bitmapptr structure.
As Silver Warrior said, I tried it but I failed.
Unfortunatelly, Allegro 4.x internals are quite obscured, and the library wasn't designed to be used in other languages than C and C++. That's why I didn't ported any of the original add-ons included with Allegro 4.4 (I tried to port AllegroGL too ).
Also I tried to use BeRoPNG but I failed too. It was quite confusing.
Now, I'll answer your message here.
No signature provided yet.
There's only one function to use and you need to load the png file into memory before calling it. It'll return the image in an RGBA array. Example:
I don't know allegro, but looks like the only thing you need to do is to create a 32 bit bitmap (al_bitmap) and copy the read data into its line pointers (see https://www.allegro.cc/manual/4/api/...allegro/bitmap )Code:var f: file; fsize: longword; buffer: pbyte; ImageData: PPNGPixel; ImageWidth, ImageHeight:longint; begin AssignFile(f, 'some.png'); Reset(f, 1); fsize := FileSize(f); buffer := getmem(fsize); blockread(f, buffer^, fsize); CloseFile(f); BeRoPNG.LoadPNG(buffer, fsize, ImageData, ImageWidth, ImageHeight, false); writeln(ImageWidth, 'x', ImageHeight); freemem(buffer); freemem(ImageData);
my projects https://github.com/dpethes
Bookmarks