gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > PCX functions

#132726 - ThousandKnives - Thu Jun 28, 2007 10:57 pm

Hi there.
I see use of a lot of PCX functions such as LoadPCX in the code samples people throw around but I don't see where in libgba these are defined. Also it seems that they involve the use of an "image" struct. pcx.h only includes a definition of DecodePCX, which is a useful function but hardly complete functionality. The header that bin2o creates doesn't even include a way of accessing the width of the image, which is vital for the functions I have been using to slice up tiles and frames.

I've googled and searched the forums but haven't come up with anything useful referencing these functions and nothing about them is included in the examples. So I'm thinking maybe its a seperate library? Or maybe they are just hand written?

If someone can point me to a file or web page referencing this stuff I would appreciate it. Thanks.

#134578 - jonnyhilly - Sat Jul 14, 2007 9:14 am

I am also looking for this info
does loadPCX just load the header to ram ? or does it also malloc space for the image some place and load that also ?

#134776 - ScottLininger - Mon Jul 16, 2007 5:38 pm

There are other PCX conversion tools besides bin2o that will output a header file with the width and height of the image. So that's another approach. I wish I could remember which ones are good. If you go to the main site, there are numerous tools to try.

Another option is to write your own image conversion scripts using PHP and the GD2 library. Both are available for free. Once you have control over the output, you can make much smarter conversion functionality that saves you time in the long run. Plus, it's a good way to learn about graphics formats.

-Scott

#134780 - jonnyhilly - Mon Jul 16, 2007 6:33 pm

ThousandKnives

I got the loadPCX working.
The image structure is defined in image.h or pcx.h I think,
its in the SDK include folder.... just do a folder search and it will find it.

I think there is also a way to setup projects in DevStudio that will search both your project and the SDK for structures, but I don't know how to set that up yet.

The function seems to copy the image and palette data to ram (though I'm not 100% sure on this... the header pointer may still point to rom) and sets up the structure with width/height, and pointers to the palette and graphic data.

#134782 - ThousandKnives - Mon Jul 16, 2007 6:39 pm

I personally have opted to use GIT and store my graphics in PNG format, which I find easier to use than PCX at any rate. I suppose an edit was in order for that update. At any rate I'm glad someone else has figured out how to use PCX and hopefully this can be of use to others.