开发者

How do I attach a bitmap to an AggPas image?

开发者 https://www.devze.com 2023-01-07 23:09 出处:网络
I\'m trying to use AggPas but find the documentation to lack code examples of attaching it to a bitmap.

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 thi开发者_开发知识库ngs right. I must be missing something.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消