mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 02:29:21 +02:00
lcl: added RawImageNeeded to the TIconImage. Now accessing of the Canvas for the just added image works. partially fixes #0011983
git-svn-id: trunk@16325 -
This commit is contained in:
parent
7329c36e1f
commit
caf7b07e05
@ -1424,6 +1424,7 @@ type
|
|||||||
FPalette: HPALETTE;
|
FPalette: HPALETTE;
|
||||||
function GetPalette: HPALETTE;
|
function GetPalette: HPALETTE;
|
||||||
protected
|
protected
|
||||||
|
procedure RawImageNeeded(ADescOnly: Boolean);
|
||||||
public
|
public
|
||||||
constructor Create(AFormat: TPixelFormat; AHeight, AWidth: Word);
|
constructor Create(AFormat: TPixelFormat; AHeight, AWidth: Word);
|
||||||
constructor Create(const AImage: TRawImage);
|
constructor Create(const AImage: TRawImage);
|
||||||
|
@ -210,6 +210,40 @@ begin
|
|||||||
Result := FPalette
|
Result := FPalette
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIconImage.RawImageNeeded(ADescOnly: Boolean);
|
||||||
|
var
|
||||||
|
ImagePtr: PRawImage;
|
||||||
|
Flags: TRawImageQueryFlags;
|
||||||
|
begin
|
||||||
|
ImagePtr := @FImage;
|
||||||
|
if ImagePtr^.Description.Format <> ricfNone
|
||||||
|
then begin
|
||||||
|
// description valid
|
||||||
|
if ADescOnly then Exit;
|
||||||
|
if (ImagePtr^.Data <> nil) and (ImagePtr^.DataSize > 0) then Exit;
|
||||||
|
if ImagePtr^.Description.Width = 0 then Exit; // no data
|
||||||
|
if ImagePtr^.Description.Height = 0 then Exit; // no data
|
||||||
|
end;
|
||||||
|
|
||||||
|
if FHandle <> 0
|
||||||
|
then begin
|
||||||
|
if ADescOnly
|
||||||
|
or not RawImage_FromBitmap(ImagePtr^, FHandle, FMaskHandle)
|
||||||
|
then ImagePtr^.Description := GetDescriptionFromBitmap(FHandle);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
case PixelFormat of
|
||||||
|
pf1bit: Flags := [riqfMono, riqfMask];
|
||||||
|
pf4bit,
|
||||||
|
pf8bit: Flags := [riqfRGB, riqfMask, riqfPalette];
|
||||||
|
pf32bit: Flags := [riqfRGB, riqfMask, riqfAlpha];
|
||||||
|
else
|
||||||
|
Flags := [riqfRGB, riqfMask];
|
||||||
|
end;
|
||||||
|
ImagePtr^.Description := QueryDescription(Flags, Width, Height);
|
||||||
|
end;
|
||||||
|
|
||||||
function TIconImage.ReleaseHandle: HBITMAP;
|
function TIconImage.ReleaseHandle: HBITMAP;
|
||||||
begin
|
begin
|
||||||
Result := Handle;
|
Result := Handle;
|
||||||
@ -472,14 +506,20 @@ function TCustomIcon.GetRawImagePtr: PRawImage;
|
|||||||
begin
|
begin
|
||||||
if FCurrent = -1
|
if FCurrent = -1
|
||||||
then Result := nil
|
then Result := nil
|
||||||
else Result := @TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).FImage;
|
else begin
|
||||||
|
TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).RawImageNeeded(False);
|
||||||
|
Result := @TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).FImage;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomIcon.GetRawImageDescriptionPtr: PRawImageDescription;
|
function TCustomIcon.GetRawImageDescriptionPtr: PRawImageDescription;
|
||||||
begin
|
begin
|
||||||
if FCurrent = -1
|
if FCurrent = -1
|
||||||
then Result := nil
|
then Result := nil
|
||||||
else Result := @TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).FImage.Description;
|
else begin
|
||||||
|
TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).RawImageNeeded(True);
|
||||||
|
Result := @TIconImage(TSharedIcon(FSharedImage).FImages[FCurrent]).FImage.Description;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomIcon.GetTransparent: Boolean;
|
function TCustomIcon.GetTransparent: Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user