In a command line application I want to create a few images, draw rectangles, text etc and save them as png. I don't want dependency on LCL. Is this possible with aggpas?
Yes it is possible. Simply copy the raw image buffer data to a FCL-Image container (eg: PNG, JPG etc), then save it to file.
BTW: The original open sourced AggPas is a bit out of date. I have made some changes and bug fixes in AggPas included with fpGUI. You can get the latest AggPas code here [https://github.com/fredvs/fpGUI/tree/master/src/corelib/render/software]
Incidentally, the fpGUI repository contains some Agg/AggPas documentation too. There is a demo using pure AGG API (no other GUI dependencies) and shows how it writes the image buffer to a file. As I mentioned above, simple copy the image buffer to a FCL-Image container of choice, and write it to another image file format. See <fpgui>/docs/aggpas/basic_renderers.agdoc.html
I' ve downloaded the new version of aggpas and compiled it. No problems. I' ve read the part of the docs. The code is in cpp, I do not fully understand it, but.... my general idea for the program is:
1. create a TAgg2D
2 create a memory - TfpgImage and attach the Tagg2D to the TfpgImage
3. do the drawing with the methods of the TAgg2D
4. get the pointer to the memory of the memory-TfgpImage
5. create a TFPMemoryImage and fill all pixels with the pixels from the TAgg2D
6. save the TFpMemoryImage to png.
Is this correct?
At step 2, I have a problem. I've found functions like CreateImage_BMP (in fpg_imgfmt_bmp). This function creates a TfpgImage. If I want to work in the same direction as in the docs I need a function CreateImage_PPM.
The memorybuffer is then a PPM buffer and not a bmp structure.
Please help.
Kees