Graphics: Fix color transparency in 24bpp TRasterImage when Transparent is set before Handle is created. Issue #41726

This commit is contained in:
wp_xyz 2025-08-06 13:11:55 +02:00
parent 33070a7760
commit 4fd3a8e598
2 changed files with 21 additions and 0 deletions

View File

@ -1246,6 +1246,7 @@ type
FUpdateCanvasOnly: Boolean;
FMasked: Boolean;
FTransparentPending: Boolean;
FTransparentDelayed: Boolean;
procedure CanvasChanging(Sender: TObject);
procedure CreateCanvas;

View File

@ -99,6 +99,13 @@ begin
end;
end;
if SrcImage.FTransparentDelayed then
begin
SrcImage.ApplyTransparent;
SrcImage.MaskHandleNeeded;
SrcImage.FTransparentDelayed := false;
end;
if SrcImage.MaskHandleAllocated
then CopyMask(SrcImage.MaskHandle);
@ -234,6 +241,16 @@ begin
BitmapHandleNeeded;
if not BitmapHandleAllocated then Exit;
if FTransparentDelayed then
begin
ApplyTransparent;
if FTransparentColor = clDefault then
Mask(RequestTransparentColor)
else
Mask(FTransparentColor);
FTransparentDelayed := false;
end;
if Masked then
UseMaskHandle:=MaskHandle
else
@ -717,6 +734,9 @@ begin
lTransparent := GetTransparent();
if AValue = lTransparent then Exit;
if not HandleAllocated then
FTransparentDelayed := true;
FTransparentPending := AValue;
ApplyTransparent;
end;