Class TGIFPainter (unit GIFImage)

Inherits from

TThread

Constructors


constructor Create(AImage: TGIFImage; ACanvas: TCanvas; ARect: TRect; Options: TGIFDrawOptions);


constructor CreateRef(var Painter: TGIFPainter; AImage: TGIFImage; ACanvas: TCanvas; ARect: TRect; Options: TGIFDrawOptions);



Functions

destructor Destroy;

Step 1: Copy destination to backup buffer Always executed before first frame and only once.

procedure Restart;

Must be running before we can terminate

procedure Start;

If we allow the exception to abort the thread at this point, the application will hang since the thread destructor will never be called and the application will wait forever for the thread to die!

procedure Stop;


procedure Execute;

Sync.

procedure DoEvent;

Sync.

procedure DoPaint;

Sync.

procedure DoPaintFrame;

Sync.

procedure DoSynchronize(Method: TThreadMethod);

Conditional Synchronize

procedure DoZap;

Conditional sync stub

Delete frame buffers


procedure PrefetchBitmap;

Sync.

Properties

property ActiveImage : integer


property Canvas : TCanvas


property DrawOptions : TGIFDrawOptions


property Image : TGIFImage


property Rect : TRect


property Started : boolean


Events

event OnEndPaint : TNotifyEvent


event OnLoop : TNotifyEvent


event OnPaint : TNotifyEvent


event OnStartPaint : TNotifyEvent


Variables

Background : TBitmap;

Used by synchronized paint

BackupBuffer : TBitmap;

Used by synchronized paint

DelayEvent : THandle;

Pointer to var referencing painter

Disposal : TDisposalMethod;

Current frame

DoRestart : boolean;


FActiveImage : integer;

Paint options

FCanvas : TCanvas;

The TGIFImage that owns this painter

FDrawOptions : TGIFDrawOptions;

Destination rect

FEvent : TNotifyEvent;

Animation delay event

FImage : TGIFImage;


FOnEndPaint : TNotifyEvent;


FOnLoop : TNotifyEvent;


FOnPaint : TNotifyEvent;


FOnStartPaint : TNotifyEvent;

Used by synchronized events

FrameBuffer : TBitmap;

Used by synchronized paint

FRect : TRect;

Destination canvas

FStarted : boolean;

Flag used to restart animation

OldDisposal : TDisposalMethod;

Used by synchronized paint

PainterRef : PGIFPainter;

Flag used to signal start of paint

ValidateDC : HDC;

Used by synchronized paint


Constructors


constructor Create(AImage: TGIFImage; ACanvas: TCanvas; ARect: TRect; Options: TGIFDrawOptions);


constructor CreateRef(var Painter: TGIFPainter; AImage: TGIFImage; ACanvas: TCanvas; ARect: TRect; Options: TGIFDrawOptions);


Functions


destructor Destroy;

Step 1: Copy destination to backup buffer Always executed before first frame and only once.


procedure Restart;

Must be running before we can terminate


procedure Start;

If we allow the exception to abort the thread at this point, the application will hang since the thread destructor will never be called and the application will wait forever for the thread to die!


procedure Stop;


procedure Execute;

Sync. event procedure


procedure DoEvent;

Sync. paint procedure


procedure DoPaint;

Sync. buffered paint procedure

Non-buffered paint


procedure DoPaintFrame;

Sync. bitmap prefetch

Buffered paint


procedure DoSynchronize(Method: TThreadMethod);

Conditional Synchronize


procedure DoZap;

Conditional sync stub

Delete frame buffers


procedure PrefetchBitmap;

Sync. shutdown procedure

Prefetch bitmap Used to force the GIF image to be rendered as a bitmap


Properties


property ActiveImage : integer


property Canvas : TCanvas


property DrawOptions : TGIFDrawOptions


property Image : TGIFImage


property Rect : TRect


property Started : boolean


Events


event OnEndPaint : TNotifyEvent


event OnLoop : TNotifyEvent


event OnPaint : TNotifyEvent


event OnStartPaint : TNotifyEvent


Variables


Background : TBitmap;

Used by synchronized paint


BackupBuffer : TBitmap;

Used by synchronized paint


DelayEvent : THandle;

Pointer to var referencing painter


Disposal : TDisposalMethod;

Current frame


DoRestart : boolean;


FActiveImage : integer;

Paint options


FCanvas : TCanvas;

The TGIFImage that owns this painter


FDrawOptions : TGIFDrawOptions;

Destination rect


FEvent : TNotifyEvent;

Animation delay event


FImage : TGIFImage;


FOnEndPaint : TNotifyEvent;


FOnLoop : TNotifyEvent;


FOnPaint : TNotifyEvent;


FOnStartPaint : TNotifyEvent;

Used by synchronized events


FrameBuffer : TBitmap;

Used by synchronized paint


FRect : TRect;

Destination canvas


FStarted : boolean;

Flag used to restart animation


OldDisposal : TDisposalMethod;

Used by synchronized paint


PainterRef : PGIFPainter;

Flag used to signal start of paint


ValidateDC : HDC;

Used by synchronized paint