PNG2C

8 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2014-04-21 21:15
PNG2C

Has anyone used PNG2C from OS4Depot? The author doesn't give an example on how to use it in your program. Is there a newer program than this? I would like to then take that C code and make a BitMapClass object with it. 24/32bit is a must.

broadblues
broadblues's picture
Offline
Last seen: 4 years 10 months ago
Joined: 2012-05-02 21:48
Re: PNG2C

It seems to just extract the raw data into an array and provide dimension info as defines.

BitMap.image doesn't take raw ARGB32 data as src type, so if you want to use that sort of data you would need an intermediate step.

Create pcuture.datatypes object and import via PDTA_READPIXELARRAY, or create a bit map and use WritePixelArray or something like that.

I don't think it's letting too many cats of the bag to say that there is a image class on the forth coming A-Eon Enhancer CD that can slurp in ARGB 32 data direct, but then you would need your users to buy that product before they can use yours, so that may not be your ideal solution.

mritter0
mritter0's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2014-04-21 21:15
Re: PNG2C

Thomas Rapp's example on his site would be ideal since it creates a struct BitMap * that could be used in a BitMapClass with BITMAP_BitMap,BitMap. But can't do 24/32bits.

Such is the problem with the forthcoming CD. I will buy it for sure, but then I could be limited in my programming if I can't distribute it with the new stuff. Understandable, but not great.

broadblues
broadblues's picture
Offline
Last seen: 4 years 10 months ago
Joined: 2012-05-02 21:48
Re: PNG2C


Thomas Rapp's example on his site would be ideal since it creates a struct BitMap * that could be used in a BitMapClass with BITMAP_BitMap,BitMap. But can't do 24/32bits.

You certainly can do 24/32 bits you just need to allocate the BitMap with the right format.
See AllocBitMapTags() or p96API for older compatabilty.

Bear in mind that bit,ap.image does this internally.

mritter0
mritter0's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2014-04-21 21:15
Re: PNG2C

I will look into it. I really need this.

thomas
thomas's picture
Offline
Last seen: 1 week 5 days ago
Joined: 2011-05-16 14:23
Re: PNG2C

Here is a small test program which shows how to draw an RGB array into a window: http://thomas-rapp.homepage.t-online.de/examples/dt2c.lha

The archive also contains a dt2c program with source code which works similar to the png2c program but can read any type of image through datatypes rather than only PNG.

xenic
xenic's picture
Offline
Last seen: 2 years 8 months ago
Joined: 2011-05-07 04:52
Re: PNG2C

@thomas
Thanks for that example. It might be useful for me too. I don't know how many images or how large of images mritter0 wants to include in his program but it seems like it could make his program much smaller to convert the image files (not extracting them to bitmaps) to C arrays with something like bin2c and using datatypes to extract the bitmaps from memory. I've used that technique for sound files but I've never tried it with image files. Do you think it would be possible?

X1000 - OS 4.1FE

mritter0
mritter0's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2014-04-21 21:15
Re: PNG2C

Thanks, Thomas. It looks like what I need. You should upload that to OS4Depot.

@xenic: I just want to add maybe 1 or 2 small images, logos for the program.

Log in or register to post comments