Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

AggPas Perspective ... how to make it work?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Horacio Jamilis

Hi,

I continue fighting with AggPas included with lazarus to use it for a GPS software.
To finish most of the drawing needs, I need to make AggPas to render the map in perspective, to give the software the 3D view (as Igo do or something similar).
I saw the Persepective.dpr demo, and selecting the "Perspective" mode, seems to draw the way I like it... but I don?t know how to apply this effect in a simple sample.

Let?s say this is the simple sample:

procedure TForm1 .Button1Click (Sender : TObject );
const
   fTextAngle = 300;
   fWidth = 200;
   fHeight = 200;
var
         fMap : TBitmap;
         fMapCanvas : TAggLCLCanvas;
begin
       fMap := TBitmap.Create;
       fMap.PixelFormat := pf32bit;
       fMapCanvas := TAggLCLCanvas.Create;
       fMapCanvas.Image.PixelFormat:= afpimRGBA32;
       fMapCanvas.Image.SetSize(fWidth,fHeight);
// Start of drawing routines
       fMapCanvas.FillRect(Rect(0,0,fWidth-1,fHeight-1));
       fMapCanvas.Pen.Color := $FF0000;
       fMapCanvas.Pen.Width := 2;
       fMapCanvas.MoveTo(50,10);
       fMapCanvas.LineTo(50,70);
// in fact lots of lines... one is enaught for the sample
       fMapCanvas.Font.Color := clMaroon;
fMapCanvas.Font.LoadFromFile('Tahoma',12,false,false,AGG_VectorFontCache,degtorad(fTextAngle),True);
       fMapCanvas.Font.AggAlignX := AGG_AlignLeft;
       fMapCanvas.Font.AggAlignY := AGG_AlignCenter;
       fMapcanvas.AggTextOut(10,160,'Sample Angled Text',false,0,0);
// End of drawing routines
         fMap.LoadFromIntfImage(fMapCanvas.Image.IntfImg);
         fMap.SaveToFile('c:\test.bmp');
      fMapCanvas.Free;
     fMap.Free;
end;

What should I do to give to this drawed image some perspective????

Last question about this... once the transformation is applied... the worldtoscreen and screentoworld still works?

I was looking on Internet for any sample for a while without success... or is there a wiki page about AggPas on the lazarus site? It seems it does not exists... after I finish with this step working, I?ll create one... I think AggPas is wonderful and I think it should be more visible (and easy to use).
I know that TaggLCLcanvas makes it easier to use... but more samples and a wiki page with some small tutorial will be better.

Thanks in advance

Horacio

Reply by email