resonance 1.0.1
Loading...
Searching...
No Matches
AGifFile Class Reference

Reader for GIF files. More...

#include <agiffile.h>

Inheritance diagram for AGifFile:
Collaboration diagram for AGifFile:

Public Member Functions

 AGifFile (FILE *pFile)
 Construct over an open file.
virtual int StartRead ()
 Slot 1.
virtual int ReadFrame (ABitmap &bitmap, int *pbEnd)
 Slot 3.
virtual int Write (const ABitmap &bitmap)
 Slot 5.
Public Member Functions inherited from AGfxFile
 AGfxFile (FILE *pFile)
 Construct over an open file.
virtual void SetUnreadWord (int nWord)
 Set mUnreadWord.
virtual ~AGfxFile ()
 Close the file.

Additional Inherited Members

Static Public Member Functions inherited from AGfxFile
static AGfxFile * Open (const char *pszPath, int *pnError, bool bRead)
 Open an image file and construct the reader for its extension.
static int Write (const char *pszPath, const ABitmap &bitmap)
 Write a bitmap to a file in the format its extension selects.
Protected Attributes inherited from AGfxFile
FILE * mFile
ARect mBounds
int mDuration

Detailed Description

Reader for GIF files.

Its single public base is AGfxFile at offset zero. Its table at 0x0083fdd0 overrides slots 1, 3, 4, and 5, and the class does not add a member. AGfxFile::Open() allocates 0x18 bytes for it.

Every piece of decoding state lives in file-scope statics rather than in the object: the logical screen descriptor, the current image descriptor and graphic control block, the decoder tables, and a static APalette the global colour table is read into. A local colour table overwrites that palette. Two readers in use at once therefore share one state.

Constructor & Destructor Documentation

◆ AGifFile()

AGifFile::AGifFile ( FILE * pFile)
inlineexplicit

Construct over an open file.

Inline. AGfxFile::Open() compiles it.

Parameters
pFileThe open file.

Member Function Documentation

◆ StartRead()

virtual int AGifFile::StartRead ( )
virtual

Slot 1.

Read the logical screen descriptor and the global colour table.

A signature that does not start GIF gives kAGfxFileBadFormat. The graphic control block is cleared. The version and the screen extent are read but not used.

Returns
An AGfxFileResult code.
Ghidra address:
NTSC-U/C: 0x0062a9c0
Ghidra address:
PAL: 0x0066b550

Implements AGfxFile.

◆ ReadFrame()

virtual int AGifFile::ReadFrame ( ABitmap & bitmap,
int * pbEnd )
virtual

Slot 3.

Read blocks up to and including the next image.

Extension blocks are consumed through ReadExtension(). An image produces an eight bit bitmap the size of its descriptor, with a new palette copied from the static palette, and sets mBounds to the image rectangle. A transparent colour from the last graphic control block is applied to the bitmap.

A block introducer of one is accepted when the next three bytes are 1, 0, and !, and an extension follows.

Parameters
bitmapReceives the image.
pbEndSet to one at the trailer, and also for a negative introducer byte.
Returns
An AGfxFileResult code.
Ghidra address:
NTSC-U/C: 0x0062aaf8
Ghidra address:
PAL: 0x0066b688

Implements AGfxFile.

◆ Write()

virtual int AGifFile::Write ( const ABitmap & bitmap)
virtual

Slot 5.

Writing is not implemented.

Parameters
bitmapThe bitmap, not read.
Returns
kAGfxFileUnsupported.
Ghidra address:
NTSC-U/C: 0x0062b6f0
Ghidra address:
PAL: 0x0066c280

Implements AGfxFile.


The documentation for this class was generated from the following file: