diff options
author | Dibo <dibo20@wp.pl> | 2013-05-01 18:52:26 +0200 |
---|---|---|
committer | Dibo <dibo20@wp.pl> | 2013-05-01 18:52:26 +0200 |
commit | fe2bea132795d293a57e4ce834c179521858d3b4 (patch) | |
tree | 927a997d4f40cf5e5b90bc0bb470a8b569c8f428 | |
parent | f2be5b248a4428f03afeb80392e12326e857715a (diff) | |
download | fpGUI-fe2bea132795d293a57e4ce834c179521858d3b4.tar.xz |
Added method ImageFromByte in TfpgBaseImgAnim. Now animation can be loaded from memory, not only from filename
-rw-r--r-- | src/gui/fpg_animation.pas | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/fpg_animation.pas b/src/gui/fpg_animation.pas index 36972877..ff58f755 100644 --- a/src/gui/fpg_animation.pas +++ b/src/gui/fpg_animation.pas @@ -31,6 +31,8 @@ uses type + { TfpgBaseImgAnim } + TfpgBaseImgAnim = class(TfpgWidget) private FFrameCount: integer; @@ -58,6 +60,8 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + + procedure ImageFromByte(ABmp: Pointer; ASize: longword); end; @@ -161,6 +165,24 @@ begin Repaint; end; +procedure TfpgBaseImgAnim.ImageFromByte(ABmp: Pointer; ASize: longword); +begin + if ABmp=nil then + Exit; + + FTimer.Enabled := False; + FImage.Free; + FImage := CreateImage_BMP(ABmp, ASize); + if FTransparent then + begin + FImage.CreateMaskFromSample(0, 0); + FImage.UpdateImage; + end; + FImageFilename := 'byte'; // because handle paint check if file is set + RecalcImageWidth; + Repaint; +end; + constructor TfpgBaseImgAnim.Create(AOwner: TComponent); begin inherited Create(AOwner); |