views:

130

answers:

1

I'm trying to use AggPas but find the documentation to lack code examples of attaching it to a bitmap.

I have this code:

procedure DrawScene();
var
  ObjLength,LineLength,Filllength,Obj,lin,angle,i:integer;
  Npoints : array[0..1] of Tpoint;
  VG: Tagg2d;
  DOB:Tobject;
  Objmap,wholemap:TBitmap;
begin
  wholemap := TBitmap.Create;
  wholemap.PixelFormat:=pf32bit;
  VG := Tagg2d.create;
  if VG.attach(wholemap,False) then
  showmessage('true')
  else
  showmessage('false');
  wholemap.Width:=area;
  wholemap.height:=area;

But it's returning false and as far as I can see I'm doing things right. I must be missing something.

+2  A: 

You have to define Bitmap dimension BEFORE attaching a VG onto it. Also, after you do Attach don't change bitmap dimension, it might cause an AV (you have to do a new Attach after dimensions change for rendering purposes).

Milan