ADD: DrawBitmapAlpha function

This commit is contained in:
Alexander Koblov 2018-07-22 13:41:06 +00:00
commit 5d8b50ad82

View file

@ -238,6 +238,7 @@ type
}
function GetBitmap(iIndex : PtrInt) : TBitmap;
function DrawBitmap(iIndex: PtrInt; Canvas : TCanvas; X, Y: Integer) : Boolean;
function DrawBitmapAlpha(iIndex: PtrInt; Canvas : TCanvas; X, Y: Integer) : Boolean;
{en
Draws bitmap stretching it if needed to Width x Height.
If Width is 0 then full bitmap width is used.
@ -1544,6 +1545,22 @@ begin
Result := DrawBitmap(iIndex, Canvas, X, Y, gIconsSize, gIconsSize); // No bitmap stretching.
end;
function TPixMapManager.DrawBitmapAlpha(iIndex: PtrInt; Canvas: TCanvas; X, Y: Integer): Boolean;
var
ARect: TRect;
ABitmap: Graphics.TBitmap;
begin
ABitmap:= GetBitmap(iIndex);
Result := Assigned(ABitmap);
if Result then
begin
BitmapAlpha(ABitmap, 0.5);
ARect := Classes.Bounds(X, Y, gIconsSize, gIconsSize);
Canvas.StretchDraw(aRect, ABitmap);
ABitmap.Free;
end;
end;
function TPixMapManager.DrawBitmap(iIndex: PtrInt; Canvas: TCanvas; X, Y, Width, Height: Integer): Boolean;
procedure TrySetSize(aWidth, aHeight: Integer);