diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-05-02 15:09:17 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-05-02 15:09:17 +0100 |
commit | b5a824a4aa6c66368f70f09482c3ac423e852f4a (patch) | |
tree | 23b3af907cfb6623cd2db7bf894e51d1c643e12e /src/gui | |
parent | 4b9b59627ca8cd6617180c81a1bae52f1efa184c (diff) | |
parent | 51e554f5d61a3766d1bd00e4440cf9b7cd73b385 (diff) | |
download | fpGUI-b5a824a4aa6c66368f70f09482c3ac423e852f4a.tar.xz |
Merge remote-tracking branch 'dibo/fpgimganim' into develop
This adds the ability to read image data from a in-memmory byte array,
instead of always from a file. Thanks Dibo!
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpg_animation.pas | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/fpg_animation.pas b/src/gui/fpg_animation.pas index 36972877..29a80960 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 ImageFromByteArray(ABmp: Pointer; ASize: longword; AMaskSample: TPoint); end; @@ -161,6 +165,25 @@ begin Repaint; end; +procedure TfpgBaseImgAnim.ImageFromByteArray(ABmp: Pointer; ASize: longword; + AMaskSample: TPoint); +begin + if ABmp=nil then + Exit; + + FTimer.Enabled := False; + FImage.Free; + FImage := CreateImage_BMP(ABmp, ASize); + if FTransparent then + begin + FImage.CreateMaskFromSample(AMaskSample.X, AMaskSample.Y); + 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); |