Class TBGRAAnimatedGif
Unit
Declaration
type TBGRAAnimatedGif = class(TGraphic)
Description
Class to read/write animated GIF, supports animated PNG as well when specified
Hierarchy
- TBGRAAnimatedGif
Overview
Fields
BackgroundMode: TGifBackgroundMode; |
|
EraseColor: TColor; |
|
FDestroying: boolean; |
|
FImages: TGifSubImageArray; |
|
LoopCount: Word; |
|
LoopDone: Integer; |
Methods
constructor Create; overload; override; |
|
constructor Create(stream: TStream; AMaxImageCount: integer); overload; |
|
constructor Create(stream: TStream); overload; |
|
constructor Create(filenameUTF8: string); overload; |
|
destructor Destroy; override; |
|
function AddFrame(AImage: TFPCustomImage; X,Y: integer; ADelayMs: integer; ADisposeMode: TDisposeMode = dmErase; AHasLocalPalette: boolean = false; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false) : integer; |
|
function AddFullFrame(AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false): integer; |
|
function Duplicate: TBGRAAnimatedGif; |
|
class function GetFileExtensions: string; override; |
|
function MakeBitmapCopy(ABackground: TColor = clNone): TBitmap; |
|
function GetEmpty: boolean; override; |
|
function GetHeight: integer; override; |
|
function GetTransparent: boolean; override; |
|
function GetWidth: integer; override; |
|
procedure Assign(ASource: TPersistent); override; |
|
procedure Clear; override; |
|
procedure DeleteFrame(AIndex: integer; AEnsureNextFrameDoesNotChange: boolean); |
|
procedure Hide(Canvas: TCanvas; ARect: TRect); overload; |
|
procedure InsertFrame(AIndex: integer; AImage: TFPCustomImage; X,Y: integer; ADelayMs: integer; ADisposeMode: TDisposeMode = dmErase; AHasLocalPalette: boolean = false; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
procedure InsertFullFrame(AIndex: integer; AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
procedure LoadFromFile(const AFilenameUTF8: string); override; |
|
procedure LoadFromResource(AFilename: string); |
|
procedure LoadFromStream(Stream: TStream; AMaxImageCount: integer); overload; |
|
procedure LoadFromStream(Stream: TStream); overload; override; |
|
procedure OptimizeFrames; |
|
procedure Pause; |
|
procedure ReplaceFullFrame(AIndex: integer; AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
procedure Resume; |
|
procedure SaveToFile(const AFilenameUTF8: string); override; |
|
procedure SaveToStream(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm; AFormat: TBGRAImageFormat = ifGif); overload; virtual; |
|
procedure SaveToStream(Stream: TStream; AFormat: TBGRAImageFormat); overload; |
|
procedure SaveToStream(Stream: TStream); override; overload; |
|
procedure SetSize(AWidth,AHeight: integer); virtual; |
|
procedure Show(Canvas: TCanvas; ARect: TRect); overload; |
|
procedure Update(Canvas: TCanvas; ARect: TRect); overload; |
|
procedure AssignImage(AImage: TFPCustomImage; AOwned: boolean); |
|
procedure AssignTo(Dest: TPersistent); override; |
|
procedure Changed(Sender: TObject); override; |
|
procedure CheckAnyFrame; |
|
procedure CheckSavable(AFormat: TBGRAImageFormat); |
|
procedure ClearViewer; virtual; |
|
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override; |
|
procedure EnsureNextFrameRec(AIndex: integer); |
|
procedure LoadFromStreamAsGif(Stream: TStream; AMaxImageCount: integer); |
|
procedure LoadFromStreamAsPng(Stream: TStream; AMaxImageCount: integer); |
|
procedure LoadFromStreamAsStatic(Stream: TStream); |
|
procedure SaveToStreamAsGif(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm); overload; virtual; |
|
procedure SaveToStreamAsPng(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm); overload; virtual; |
|
procedure SaveToStreamAsPng(Stream: TStream); |
|
procedure SetHeight(Value: integer); override; |
|
procedure SetTransparent(Value: boolean); override; |
|
procedure SetWidth(Value: integer); override; |
Properties
property AspectRatio: single read FAspectRatio write SetAspectRatio; |
|
property AverageDelayMs: integer read GetAverageDelayMs; |
|
property BackgroundColor: TColor Read FBackgroundColor write SetBackgroundColor; |
|
property Bitmap: TBitmap Read GetBitmap; |
|
property Count: integer Read GetCount; |
|
property CurrentImage: integer Read FCurrentImage Write SetCurrentImage; |
|
property FrameDelayMs[AIndex: integer]: integer read GetFrameDelayMs write SetFrameDelayMs; |
|
property FrameDisposeMode[AIndex: integer]: TDisposeMode read GetFrameDisposeMode write SetFrameDisposeMode; |
|
property FrameDrawMode[AIndex: integer]: TDrawMode read GetFrameDrawMode write SetFrameDrawMode; |
|
property FrameHasLocalPalette[AIndex: integer]: boolean read GetFrameHasLocalPalette write SetFrameHasLocalPalette; |
|
property FrameImage[AIndex: integer]: TBGRABitmap read GetFrameImage write SetFrameImage; |
|
property FrameImagePos[AIndex: integer]: TPoint read GetFrameImagePos write SetFrameImagePos; |
|
property Height: integer Read FHeight; |
|
property MemBitmap: TBGRABitmap Read GetMemBitmap; |
|
property Paused: boolean Read FPaused; |
|
property TimeUntilNextImageMs: integer read GetTimeUntilNextImage; |
|
property TotalAnimationTimeMs: Int64 read FTotalAnimationTime; |
|
property Width: integer Read FWidth; |
Description
Fields
BackgroundMode: TGifBackgroundMode; |
|
This item has no description. |
EraseColor: TColor; |
|
This item has no description. |
FDestroying: boolean; |
|
This item has no description. |
FImages: TGifSubImageArray; |
|
This item has no description. |
LoopCount: Word; |
|
This item has no description. |
LoopDone: Integer; |
|
This item has no description. |
Methods
constructor Create; overload; override; |
|
This item has no description. |
constructor Create(stream: TStream; AMaxImageCount: integer); overload; |
|
This item has no description. |
constructor Create(stream: TStream); overload; |
|
This item has no description. |
constructor Create(filenameUTF8: string); overload; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function AddFrame(AImage: TFPCustomImage; X,Y: integer; ADelayMs: integer; ADisposeMode: TDisposeMode = dmErase; AHasLocalPalette: boolean = false; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false) : integer; |
|
This item has no description. |
function AddFullFrame(AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false): integer; |
|
Add a frame that replaces completely the previous one |
function Duplicate: TBGRAAnimatedGif; |
|
This item has no description. |
class function GetFileExtensions: string; override; |
|
This item has no description. |
function MakeBitmapCopy(ABackground: TColor = clNone): TBitmap; |
|
This item has no description. |
function GetEmpty: boolean; override; |
|
This item has no description. |
function GetHeight: integer; override; |
|
This item has no description. |
function GetTransparent: boolean; override; |
|
This item has no description. |
function GetWidth: integer; override; |
|
This item has no description. |
procedure Assign(ASource: TPersistent); override; |
|
This item has no description. |
procedure Clear; override; |
|
This item has no description. |
procedure DeleteFrame(AIndex: integer; AEnsureNextFrameDoesNotChange: boolean); |
|
This item has no description. |
procedure Hide(Canvas: TCanvas; ARect: TRect); overload; |
|
This item has no description. |
procedure InsertFrame(AIndex: integer; AImage: TFPCustomImage; X,Y: integer; ADelayMs: integer; ADisposeMode: TDisposeMode = dmErase; AHasLocalPalette: boolean = false; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
This item has no description. |
procedure InsertFullFrame(AIndex: integer; AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
Insert at the specified AIndex a frame that replaces completely the previous one |
procedure LoadFromFile(const AFilenameUTF8: string); override; |
|
This item has no description. |
procedure LoadFromResource(AFilename: string); |
|
This item has no description. |
procedure LoadFromStream(Stream: TStream; AMaxImageCount: integer); overload; |
|
This item has no description. |
procedure LoadFromStream(Stream: TStream); overload; override; |
|
procedure OptimizeFrames; |
|
This item has no description. |
procedure Pause; |
|
This item has no description. |
procedure ReplaceFullFrame(AIndex: integer; AImage: TFPCustomImage; ADelayMs: integer; AHasLocalPalette: boolean = true; ADrawMode: TDrawMode = dmSetExceptTransparent; AOwned: boolean = false); |
|
This item has no description. |
procedure Resume; |
|
This item has no description. |
procedure SaveToFile(const AFilenameUTF8: string); override; |
|
This item has no description. |
procedure SaveToStream(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm; AFormat: TBGRAImageFormat = ifGif); overload; virtual; |
|
This item has no description. |
procedure SaveToStream(Stream: TStream; AFormat: TBGRAImageFormat); overload; |
|
There are some differences in the dispose modes and draw modes so some files cannot be directly saved from one format to the other:
PNG format is not limited to 256 colors, so there is no need for quantization even if it possible. When PNG has a palette, it applies to all frames, whereas for GIF, there can be a palette for each frame. |
procedure SaveToStream(Stream: TStream); override; overload; |
|
Save to a stream using GIF format |
procedure SetSize(AWidth,AHeight: integer); virtual; |
|
This item has no description. |
procedure Show(Canvas: TCanvas; ARect: TRect); overload; |
|
This item has no description. |
procedure Update(Canvas: TCanvas; ARect: TRect); overload; |
|
This item has no description. |
procedure AssignImage(AImage: TFPCustomImage; AOwned: boolean); |
|
This item has no description. |
procedure AssignTo(Dest: TPersistent); override; |
|
This item has no description. |
procedure Changed(Sender: TObject); override; |
|
This item has no description. |
procedure CheckAnyFrame; |
|
This item has no description. |
procedure CheckSavable(AFormat: TBGRAImageFormat); |
|
This item has no description. |
procedure ClearViewer; virtual; |
|
This item has no description. |
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override; |
|
procedure EnsureNextFrameRec(AIndex: integer); |
|
This item has no description. |
procedure LoadFromStreamAsGif(Stream: TStream; AMaxImageCount: integer); |
|
This item has no description. |
procedure LoadFromStreamAsPng(Stream: TStream; AMaxImageCount: integer); |
|
This item has no description. |
procedure LoadFromStreamAsStatic(Stream: TStream); |
|
This item has no description. |
procedure SaveToStreamAsGif(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm); overload; virtual; |
|
This item has no description. |
procedure SaveToStreamAsPng(Stream: TStream; AQuantizer: TBGRAColorQuantizerAny; ADitheringAlgorithm: TDitheringAlgorithm); overload; virtual; |
|
This item has no description. |
procedure SaveToStreamAsPng(Stream: TStream); |
|
This item has no description. |
procedure SetHeight(Value: integer); override; |
|
This item has no description. |
procedure SetTransparent(Value: boolean); override; |
|
This item has no description. |
procedure SetWidth(Value: integer); override; |
|
This item has no description. |
Properties
property AspectRatio: single read FAspectRatio write SetAspectRatio; |
|
linear blend only in PNG |
property AverageDelayMs: integer read GetAverageDelayMs; |
|
This item has no description. |
property BackgroundColor: TColor Read FBackgroundColor write SetBackgroundColor; |
|
This item has no description. |
property Bitmap: TBitmap Read GetBitmap; |
|
This item has no description. |
property Count: integer Read GetCount; |
|
This item has no description. |
property CurrentImage: integer Read FCurrentImage Write SetCurrentImage; |
|
This item has no description. |
property FrameDelayMs[AIndex: integer]: integer read GetFrameDelayMs write SetFrameDelayMs; |
|
This item has no description. |
property FrameDisposeMode[AIndex: integer]: TDisposeMode read GetFrameDisposeMode write SetFrameDisposeMode; |
|
This item has no description. |
property FrameDrawMode[AIndex: integer]: TDrawMode read GetFrameDrawMode write SetFrameDrawMode; |
|
This item has no description. |
property FrameHasLocalPalette[AIndex: integer]: boolean read GetFrameHasLocalPalette write SetFrameHasLocalPalette; |
|
This item has no description. |
property FrameImage[AIndex: integer]: TBGRABitmap read GetFrameImage write SetFrameImage; |
|
This item has no description. |
property FrameImagePos[AIndex: integer]: TPoint read GetFrameImagePos write SetFrameImagePos; |
|
This item has no description. |
property Height: integer Read FHeight; |
|
This item has no description. |
property MemBitmap: TBGRABitmap Read GetMemBitmap; |
|
This item has no description. |
property Paused: boolean Read FPaused; |
|
This item has no description. |
property TimeUntilNextImageMs: integer read GetTimeUntilNextImage; |
|
This item has no description. |
property TotalAnimationTimeMs: Int64 read FTotalAnimationTime; |
|
This item has no description. |
property Width: integer Read FWidth; |
|
This item has no description. |