summaryrefslogtreecommitdiff
path: root/src/gui/fpg_animation.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-05-02 15:09:17 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-05-02 15:09:17 +0100
commitb5a824a4aa6c66368f70f09482c3ac423e852f4a (patch)
tree23b3af907cfb6623cd2db7bf894e51d1c643e12e /src/gui/fpg_animation.pas
parent4b9b59627ca8cd6617180c81a1bae52f1efa184c (diff)
parent51e554f5d61a3766d1bd00e4440cf9b7cd73b385 (diff)
downloadfpGUI-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/fpg_animation.pas')
-rw-r--r--src/gui/fpg_animation.pas23
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);