fpvectorial

From Lazarus wiki
Revision as of 14:30, 20 August 2010 by Sekelsenmat (talk | contribs)
Jump to navigationJump to search

Introduction

FPVectorial offers support to read, modify and write vectorial images.

It's counterpart library is fp-image, which works with raster images. FPVectorial comes with a unit which allows to draw a vectorial image to a TFPCustomCanvas, but no routines are provided to convert raster images to vectorial images.

Current file list

FPVectorial is located in Free Pascal 2.3.1+ in the directory fpc/packages/fpvectorial/src

The central unit is fpvectorial.

Readers and writers for various image formats

  • pdfvectorialreader - Read support for PDF files, supports compression, only reads the first page
  • avisocncgcodereader - Read support for the G-Code from the Aviso CNC machine
  • avisocncgcodewriter - Write support for the G-Code from the Aviso CNC machine
  • cdrvectorialreader - Skeleton of a reader support for Corel Draw CDR files
  • svgvectorialwriter - Write support for SVG. Supports lines at the moment

Other units

  • fpvtocanvas - Converts a vectorial document to a TFPCustomCanvas descendent (like TCanvas). Essentially converts the vectorial image to a raster image
  • pdfvrlexico, pdfvrsemantico, pdfvrsintatico, avisozlib - Other units from the PDF reader, don't use directly

Formats

PDF

The PDF format is developed by Adobe (tm) and it is fully documented.

Link to the PDF Reference: http://www.adobe.com/devnet/pdf/pdf_reference.html

CorelDraw

Corel does not release public documentation for it's CorelDraw file format. Any information about this format depends on reverse engineering and guessing.

Usage

  • Loads a PDF, converts it to G-Code and writes the G-Code to a TStrings descendent

<delphi> uses

 fpvectorial, pdfvectorialreader, avisocncgcodewriter;

var

 Vec: TvVectorialDocument;

begin

 if dialogoAbrir.Execute() then
 begin
   Vec := TvVectorialDocument.Create;
   try
     Vec.ReadFromFile(dialogoAbrir.FileName, vfPDF);
     Vec.WriteToStrings(synCodigo.Lines, vfGCodeAvisoCNCPrototipoV5);
   finally
     Vec.Free;
   end;
 end;

end; </delphi>

More examples

Please see in the FPC repository: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fpvectorial/examples/

Go to back Packages List