Recent

Author Topic: AggPas transparent background  (Read 5000 times)

scrat

  • New member
  • *
  • Posts: 8
AggPas transparent background
« on: June 04, 2010, 09:09:09 am »
hello,

I try to draw some ellipes with aggpas and draw it on a Tpicture with background transparent.

Drawing is ok but i can't get a transparent background

Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
var
  memstream:tmemorystream;
begin

   Bmp1:=TBitmap.Create;

  AggLCLCanvas:=TAggLCLCanvas.Create;
  with AggLCLCanvas do begin
    Image.PixelFormat:=afpimRGBA32;
    Image.SetSize(100,100);

    // solid black background
    Brush.Color:=clblack;
    FillRect(0,0,Width,Height);

    //solid ellipse
    Brush.Color:=clYellow;
    Pen.Color:=clBlue;
    Pen.Width:=8;
    Ellipse(5,5,80,60);

    //transparent ellipse
    Brush.FPColor:=FPColor($ffff,$ffff,0,$5000);
    Pen.FPColor:=FPColor(0,0,$ffff,$5000);
    Ellipse(15,15,60,85);

   end;

    // convert to LCL native pixel format
   Bmp1.LoadFromIntfImage(AggLCLCanvas.Image.IntfImg);


  memstream := TMemoryStream.create;
  try
    bmp1.SaveToStream(memstream);
    memstream.position := 0;
    bmp1.LoadFromStream(memstream);
  finally
    memstream.free;
  end;


  Bmp1.Transparent:=true;
  Bmp1.TransparentColor:=clblack;
  image1.picture.Bitmap.Assign(bmp1);
end;

Any idea ?

Thanks

EDIT : I specified that I use linux and fpc251 SVN and Lazarus 0.9.29 SVN 25892
« Last Edit: June 05, 2010, 02:13:09 pm by scrat »

 

TinyPortal © 2005-2018