Forum > Graphics

AggPas transparent background

(1/1)

scrat:
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: ---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;

--- End code ---

Any idea ?

Thanks

EDIT : I specified that I use linux and fpc251 SVN and Lazarus 0.9.29 SVN 25892

Navigation

[0] Message Index

Go to full version