[fpc-pascal] Implementing AggPas with PtcGraph
James Richters
james at productionautomation.net
Tue May 30 23:37:56 CEST 2017
> * What parameters does its putimage() function take?
> * Does in support PNG image format natively?
Putimage() takes
Initial X position
Initial Y position
Pointer to beginning of memory bitmap
Method to use (copy, AND, OR, XOR)
See https://www.freepascal.org/docs-html/rtl/graph/putimage.html
Here's an example:
Var Q: Pointer;
Bar(0, 0, (GetMaxX div 3), GetMaxY);
Size := ImageSize(10, 20, 30, 40);
GetMem(Q, Size); { Allocate memory on heap }
GetImage(10, 20, 30, 40, Q^);
Readln;
ClearDevice;
PutImage(100, 100, Q^, NormalPut);
readln;
putimage(0,0,Q^,normalput);
readln;
I can get this to work with getimage and putimage, but I have no idea how to build the image in memory and just use putimage.
I don't think it really supports any 'image formats' it's just the TP compatible graphics thing for DOS style graphics.
I'm looking at it and I think getimage / putimage are just one byte per pixel... maybe? so probably not what I want.
I'm getting the feeling this is apples and oranges here, TP compatible memory map vs tcolor or tfpcolor or some other scheme with 4 bytes per pixel.
Maybe there just isn't anything canned that can do what I want? Maybe I need to put the pixels on the screen myself using a nested loop and getpixel / putpixel and do whatever logic on my own.
James
-----Original Message-----
From: fpc-pascal [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Graeme Geldenhuys
Sent: Tuesday, May 30, 2017 4:55 PM
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph
On 2017-05-30 20:20, James Richters wrote:
> I've re-attached Graeme's sample slightly modified to open the
> ptcgraph window, and attempt to use putimage on line 103 but when I
> run it I get 217- access violation
I haven't downloaded or looked at ptcgraph at all. A few questions:
* What parameters does its putimage() function take?
* Does in support PNG image format natively?
I would imagine that it probably supports BMP only - comping from DOS and Windows background. If so, change the example program to use a BMP image instead of a PNG image. In your code you attached you are actually pushing the c variable, which is a TFPColor record of the last color retrieve from the AggPas buffer - so no surprise you are getting a AV error.
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp _______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list