Public Member Functions | Static Public Member Functions | Properties

Romulus.Nes.PatternTable Class Reference

Provides functions to load ROM graphic data into a System.Drawing.Bitmap. More...

List of all members.

Public Member Functions

 PatternTable (bool linear)
 Creates a new pattern table.
void BeginWrite ()
 Prepares the pattern table for loading tiles.
void EndWrite ()
 Finalizes writing operations to the pattern table. This must be called after loading patterns and before the.
void LoadTiles (byte[] data, int sourceOffset, int destTileStart, int destTileCount)
 Loads a strip of tiles from raw ROM data into this pattern table.
void LoadWholeTable (byte[] data, int sourceOffset)
 Loads a complete pattern table from a ROM image.
void LoadWholeTable (byte[] data, pHRom sourceOffset)
 Loads a complete pattern table from a ROM image.
void Clear ()
 Clears pattern data from the pattern image. If the pattern table is not already locked, it will be locked for the duration of this operation.
void Dispose ()
 Releases resources used by this object.

Static Public Member Functions

static void ExtractSingleTile (Bitmap b, Point tileLocation, byte[] data, int offset)
 Loads an individual tile from ROM data to a bitmap.

Properties

Rom Rom [get, set]
 Gets/sets the ROM this pattern table belongs to. This is not used internally be the PatternTable class.
bool WriteInProgress [get]
 Returns true if this object is locked for writing.
Bitmap PatternImage [get]
 Returns an 8 bpp bitmap containing all loaded tiles.
Color[] Palette [get, set]
 Gets or sets the color applied to this pattern table. This will have no effect on images.

Detailed Description

Provides functions to load ROM graphic data into a System.Drawing.Bitmap.


Constructor & Destructor Documentation

Romulus.Nes.PatternTable.PatternTable ( bool  linear  ) 

Creates a new pattern table.

Parameters:
linear If true, the patterns will be loaded in a horizontal string (good for constructing images from). If false, the patterns will be loaded in a 16 x 16 grid (good for displaying to user).

Member Function Documentation

void Romulus.Nes.PatternTable.BeginWrite (  ) 

Prepares the pattern table for loading tiles.

void Romulus.Nes.PatternTable.Clear (  ) 

Clears pattern data from the pattern image. If the pattern table is not already locked, it will be locked for the duration of this operation.

void Romulus.Nes.PatternTable.Dispose (  ) 

Releases resources used by this object.

void Romulus.Nes.PatternTable.EndWrite (  ) 

Finalizes writing operations to the pattern table. This must be called after loading patterns and before the.

pattern table can be used.

static void Romulus.Nes.PatternTable.ExtractSingleTile ( Bitmap  b,
Point  tileLocation,
byte[]  data,
int  offset 
) [static]

Loads an individual tile from ROM data to a bitmap.

Parameters:
b The bitmap the tile will be rendered on. Must be 8-bpp.
tileLocation The location on the bitmap to draw the tile.
data Rom image.
offset Offset of the tile within the rom image.
void Romulus.Nes.PatternTable.LoadTiles ( byte[]  data,
int  sourceOffset,
int  destTileStart,
int  destTileCount 
)

Loads a strip of tiles from raw ROM data into this pattern table.

Parameters:
data The ROM image to load tiles from
sourceOffset The location of the graphic data
destTileStart Which tile to begin loading at
destTileCount The number of tiles to load

T linear strip of tiles is loaded starting at the specified tile count. If the tiles reach the end of a row in a square pattern table they wrap to the next line. If the end of the pattern table is reached or the end of ROM data is reached, copying will stop without error. The function BeginWrite must be called at some points before this function is called. The function EndWrite must be called to finalize the process. Otherwise the loaded tiles will not be reflected in this pattern table.

void Romulus.Nes.PatternTable.LoadWholeTable ( byte[]  data,
pHRom  sourceOffset 
)

Loads a complete pattern table from a ROM image.

Parameters:
data Rom image.
sourceOffset Location of the pattern data.
void Romulus.Nes.PatternTable.LoadWholeTable ( byte[]  data,
int  sourceOffset 
)

Loads a complete pattern table from a ROM image.

Parameters:
data Rom image.
sourceOffset Location of the pattern data.

Property Documentation

Color [] Romulus.Nes.PatternTable.Palette [get, set]

Gets or sets the color applied to this pattern table. This will have no effect on images.

rendered with the ScreenRenderer class. Changes to the paletteIndex will be reflected in all references to this PatternTable's Patterns. If you need to use multiple palettes simultaneously you should, for each differently paletted version, set the desired paletteIndex, clone the pattern brush and retain the clone(s) as the paletted brush(s).

Bitmap Romulus.Nes.PatternTable.PatternImage [get]

Returns an 8 bpp bitmap containing all loaded tiles.

Rom Romulus.Nes.PatternTable.Rom [get, set]

Gets/sets the ROM this pattern table belongs to. This is not used internally be the PatternTable class.

bool Romulus.Nes.PatternTable.WriteInProgress [get]

Returns true if this object is locked for writing.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events