Recent

Author Topic: Transparency...again  (Read 1926 times)

loaded

  • Full Member
  • ***
  • Posts: 212
  • Either seem as you are or be as you seem.
Re: Transparency...again
« Reply #15 on: March 25, 2021, 01:54:39 pm »
In the link, https://forum.lazarus.freepascal.org/index.php?topic=29498.0 The answer given by derek.john.eva is working.
Installing the spelling, google translate is used :)

circular

  • Hero Member
  • *****
  • Posts: 3712
    • Personal webpage
Re: Transparency...again
« Reply #16 on: April 25, 2021, 08:19:16 am »
I am surprised by the result you get with BGRABitmap. Seems like black becomes transparent.

I suggest try:
Code: [Select]
procedure TMainForm.MakePng(screen:TBitmap;FileName: String; Trans: TColor);
var
  c: TBGRABitmap;
  xcolor: TBGRAPixel;
begin
  xcolor:= ColorToBGRA(trans,255);
  c := TBGRABitmap.Create(screen);
  c.ReplaceColor(color, BGRAPixelTransparent);
  c.ReplaceColor(clBlack, clBlackOpaque); // to fix black being transparent
  c.SaveToFile(FileName);
  c.free;
end;
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018