I'm wondering if fcl-image has support for the alpha layer of PNGs (or any image format, really). I have a need to create a transparent memory image, then being able to draw to it with partially transparent images.
I made a quick test project, and it seems that fcl-image doesn't support the alpha, at least by default:
procedure TForm1.Button1Click(Sender: TObject);
var
canv: TFPimagecanvas;
ima,td: TFPmemoryimage;
writ: TFPcustomimagewriter;
begin
try
ima := TFPmemoryImage.Create(200,200);
ima.UsePalette := false;
ima.LoadFromFile('in2.png');
ima.UsePalette := false;
td := TFPmemoryImage.Create(100,100);
td.LoadFromFile('in1.png');
canv := tfpimagecanvas.create(ima);
canv.Draw(0,0,td);
writ := tfpwriterpng.create;
ima.savetofile('test.png', writ);
finally
ima.Free;
td.free;
canv.Free;
writ.Free;
end;
end;
in2.png is a 200x200 fully transparent image. in1.png is a 100x100 black image. Upon drawing in1 on top of in2 and saving it as test.png, the image is fully black, meaning the alpha was not kept upon drawing or saving.
In a somewhat related problem, how can I save PNGs without having them automatically indexed? I tried setting the property UsePalette twice, but it still saves it as indexed.