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

Reader for Truevision TGA files. More...

#include <atgafile.h>

Inheritance diagram for ATgaFile:
Collaboration diagram for ATgaFile:

Public Member Functions

 ATgaFile (FILE *pFile)
 Construct over an open file.
virtual int StartRead ()
 Slot 1.
virtual int ReadFrame (ABitmap &image, 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 Truevision TGA files.

Its single public base is AGfxFile at offset zero. Its table at 0x0083d8d0 overrides slots 1, 3, 4, and 5. AGfxFile::Open() allocates 0x30 bytes for it.

The reader accepts uncompressed and run length encoded true colour images with no colour map, image types 2 and 10, and always produces a kABitmapFormatLinear32 bitmap. A pixel depth other than 32 is read as three bytes a pixel.

Constructor & Destructor Documentation

◆ ATgaFile()

ATgaFile::ATgaFile ( FILE * pFile)
inlineexplicit

Construct over an open file.

Inline. AGfxFile::Open() compiles it.

Parameters
pFileThe open file.

Member Function Documentation

◆ StartRead()

virtual int ATgaFile::StartRead ( )
virtual

Slot 1.

Read the 18 byte header and skip the image identifier.

A colour map, or an image type other than 2 and 10, gives kAGfxFileBadFormat.

Returns
An AGfxFileResult code.
Ghidra address:
NTSC-U/C: 0x0061fff8
Ghidra address:
PAL: 0x00660b88

Implements AGfxFile.

◆ ReadFrame()

virtual int ATgaFile::ReadFrame ( ABitmap & image,
int * pbEnd )
virtual

Slot 3.

Read the image.

The end is reported only once mImageRead is set, and nothing sets it, so every call reads again from the current file position. A failed read releases the pixel rectangle through the single-object path.

Parameters
imageReceives the image.
pbEndSet to one when mImageRead is set.
Returns
An AGfxFileResult code.
Ghidra address:
NTSC-U/C: 0x00620508
Ghidra address:
PAL: 0x00661098

Implements AGfxFile.

◆ Write()

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

Slot 5.

Writing is not implemented.

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

Implements AGfxFile.


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