jvcllaz: Fix transparency issue of TJvAnimatedImage in Linux

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6732 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-11-20 23:07:58 +00:00
parent fda7b5211c
commit 11fc7ff5b9
2 changed files with 27 additions and 4 deletions

View File

@ -101,7 +101,6 @@ procedure CopyParentImage(Control: TControl; Dest: TCanvas);
{ Windows resources (bitmaps and icons) VCL-oriented routines }
procedure DrawBitmapTransparent(Dest: TCanvas; DstX, DstY: Integer;
Bitmap: TBitmap; TransparentColor: TColor);
//(******************** NOT CONVERTED
procedure DrawBitmapRectTransparent(Dest: TCanvas; DstX, DstY: Integer;
SrcRect: TRect; Bitmap: TBitmap; TransparentColor: TColor);
procedure StretchBitmapRectTransparent(Dest: TCanvas; DstX, DstY, DstW,
@ -1829,6 +1828,7 @@ begin
end;
******************** NOT CONVERTED*)
{$IFDEF MSWINDOWS}
procedure StretchBitmapTransparent(Dest: TCanvas; Bitmap: TBitmap;
TransparentColor: TColor; DstX, DstY, DstW, DstH, SrcX, SrcY,
SrcW, Srch: Integer);
@ -1874,6 +1874,27 @@ begin
Bitmap.Canvas.Unlock;
end;
end;
{$ELSE}
procedure StretchBitmapTransparent(Dest: TCanvas; Bitmap: TBitmap;
TransparentColor: TColor; DstX, DstY, DstW, DstH, SrcX, SrcY,
SrcW, Srch: Integer);
var
bmp: TBitmap;
dstRect: TRect;
begin
bmp := TBitmap.Create;
try
bmp.TransparentColor := TransparentColor;
bmp.Transparent := true;
bmp.SetSize(SrcW, SrcH);
bmp.Canvas.Draw(-SrcX, -SrcY, Bitmap);
dstRect := Rect(DstX, DstY, DstX + DstW, DstY + DstH);
Dest.StretchDraw(dstRect, bmp);
finally
bmp.Free;
end;
end;
{$ENDIF}
procedure StretchBitmapRectTransparent(Dest: TCanvas; DstX, DstY,
DstW, DstH: Integer; SrcRect: TRect; Bitmap: TBitmap;

View File

@ -111,13 +111,13 @@ type
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
function GetPalette: HPALETTE; override;
procedure AdjustSize; override;
procedure Loaded; override;
procedure BufferedPaint; override;
procedure DefineProperties(Filer: TFiler); override;
procedure DoPaintImage; override;
procedure FrameChanged; dynamic;
procedure Loaded; override;
procedure Start; dynamic;
procedure Stop; dynamic;
procedure DefineProperties(Filer: TFiler); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -646,12 +646,14 @@ begin
else
DstRect := Rect(0, 0, FImageWidth, FImageHeight);
{$IFDEF WINDOWS}
// {$IFDEF WINDOWS}
StretchBitmapRectTransparent(Canvas, DstRect.Left, DstRect.Top, DstRect.Right - DstRect.Left,
DstRect.Bottom - DstRect.Top, SrcRect, FGlyph, FTransparentColor);
(*
{$ELSE}
Canvas.CopyRect(DstRect, FGlyph.Canvas, SrcRect);
{$ENDIF}
*)
end;
end;