[fpc-pascal]Easy graphics<

Marco van de Voort marcov at stack.nl
Fri Apr 23 09:31:29 CEST 2004


> On Thu, 22 Apr 2004, Alan Mead wrote:
> 
> > Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:
> >
> > > Yes. You need at least 1.9.2.
> > > The best would even be to download the latest CVS, as it supports
> > > more formats.
> > > Or you can try to download the FCL sources and recompile them with
> > > FPC 1.0.10.
> >
> > I appreciate your help with this.  I installed 1.9.2 on my other
> > machine and I see most of the units (the writejpg is not found)...
> > you indicated that your code was only a rough sketch but I cannot get
> > it to compile:

I just patched the sketch:

uses fpimage,fpcanvas,fpwritepng, fpwritejpeg,fpimgcanv;

Var
  Image : TFPMemoryImage;
  Canvas : TFPimageCanvas;

begin
  // Create image,
  Image:=TFPMemoryImage.Create(640,480);
  Image.UsePalette:=False;
  // Create canvas.
  Canvas:=TFPImageCanvas.Create(Image);
  Canvas.Pen.Color:=colRed;
  Canvas.Ellipse(50,50,150,150);
  Canvas.Rectangle(50,50,150,150);
  // Free canvas
  Canvas.Free;
  Image.SaveToFile('myfile.png',TFPWriterPNG.Create); // Write as png
  Image.SaveToFile('myfile.jpg',TFPWriterPNG.Create); // Alternatively, write as jpg
  // Free Image.
  Image.Free;
end.




More information about the fpc-pascal mailing list