#1 PDF Engine » Problem with FloodFill and TPdfDocumentGDI » 2019-03-28 12:40:48

markus64
Replies: 3

Hi all,

I'm new to SynPDF and evaluating it for a new project. It's a very nice component and it fills all my need (outlines, jpg/bmp/png, annotations, bookmarks) except for the FloodFill procedure.
I can't get it to work.

procedure TForm1.Button1Click(Sender: TObject);
var filename:string;
   lPdf:TPdfDocumentGDI;
   lPage:TPdfPage;
begin
   filename:='c:\temp\SynPDF.pdf';
   lPdf:=TPdfDocumentGDI.Create();
   try
      lPdf.ScreenLogPixels:=600;
      lPDF.DefaultPaperSize:=psA4;
      lPage:=lPDF.AddPage;

      lPDF.VCLCanvas.Pen.Color:=ClBlack;
      lPDF.VCLCanvas.Pen.Width:=1;
      lPDF.VCLCanvas.Pen.Style:=psSolid;
      lPDF.VCLCanvas.Pen.Mode:=pmCopy;
      lPDF.VCLCanvas.Brush.Color:=clYellow;
      lPDF.VCLCanvas.Brush.Style:=bsSolid;

      lPDF.VCLCanvas.MoveTo(400,400);
      lPDF.VCLCanvas.lineto(600,800);
      lPDF.VCLCanvas.lineto(200,800);
      lPDF.VCLCanvas.lineto(400,400);
      lPDF.VCLCanvas.FloodFill(500,700,ClBlack,fsBorder);

      lPdf.SaveToFile(filename);
   finally
      lPdf.Free;
   end;
   ShellExecute(Handle, nil, PChar(filename), nil, nil, SW_SHOWNORMAL);
end;

Anyone have a clue what I'm doing wrong in the code to get that area filled? The lines are drawn as expected.

Board footer

Powered by FluxBB