[Lazarus] Looking for vectors library

Leonardo M. Ramé l.rame at griensu.com
Wed Jun 1 15:44:40 CEST 2011


On 2011-06-01 14:38:34 +0200, Felipe Monteiro de Carvalho wrote:
> On Wed, Jun 1, 2011 at 2:11 PM, Leonardo M. Ramé <l.rame at griensu.com> wrote:
> > Felipe, I can't find the functions/methods to map world coordinates to
> > screen
> 
> In fpvectorial all coordinates are in milimiters.
> 
> When rendering on Screen you can use the unit fpvtocanvas and this function:
> 
> procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
>   {$ifdef USE_LCL_CANVAS}ADest: TCanvas;{$else}ADest: TFPCustomCanvas;{$endif}
>   ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0;
> AMulY: Double = 1.0);
> 
> Which allows you to set a multiplier to be applied in the coordinates.
> 1.0 means that there is 1 pixel per milimiter. 2.0 means 2 pixels per
> milimiter, etc.
> 
> This function also allows you to set where the drawing will be placed,
> which is the viewport (ADestX, ADestY)
> 
> > nor to create a viewport on the drawing. Does fpVectorial
> > includes that?.
> 
> What do you mean by "create a viewport on the drawing"?
> 
> In fpvectorial the drawing itself has no viewport, but you can set a
> viewport for the whole drawing when rendering on screen, which is
> (ADestX, ADestY)
> 

To me a viewport is a "window" that let you see an area of the drawing, just
like any vector drawing app does.

I thing DrawFPVectorialToCanvas does what I want. Let me try to
understand what it does.

For example, you have drawing of 1000 x 1000 mm, but you want to show in
a canvas an area of 100 x 100 pixels, starting from the point 50, 50. To
do this, you have to call DrawFPVectorialToCanvas(source, dest, 50, 50);

To zoom in/out you have to change AMultX and AMultY.

Am I right?.

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list