2
I have the following structure:
public
FBMP : TBitmap;
...
var
PNG : TPNGImage;
Stream : TMemoryStream;
begin
Stream := TMemoryStream.Create;
Stream.LoadFromFile('foo.png');
PNG := TPNGImage.Create;
PNG.LoadFromStream(Stream);
FBMP := TBitmap.Create;
FBMP.Assign(PNG);
PNG.Free;
Stream.Free;
end;
When I try to draw the image above, I notice that it does not recognize the semi-transparency of the PNG file (showing all opaque colors), a phenomenon that did not happen when I did not use the stream. But how did the need to use the stream, there goes my question: how to activate transparency when loading the image by TMemoryStream
?
Not a read only property?
– Guill
property TransparencyMode: TPNGTransparencyMode read GetTransparencyMode;
It is. This is the statement found in the documentation you posted the link to. And it indicates that it is read-only.– Guill
Anyway, I just tried to set it and the compiler doesn’t let it be read-only. When the documentation says "Use to determine" it is for you to know which is the current type. And not to modify.
– Guill
@Tiagoc Do you mean
Transparent
?– Guill
It worked. But only full transparency and not semi-transparency. But I’ve found a better solution.
– Guill