Public Member Functions | Static Public Member Functions | Public Attributes | Properties

Romulus.Nes.SinglePalette Struct Reference

Represents a 4-color palette. Can be ROM-backed (wraps and modifies ROM data) or independent. More...

List of all members.

Public Member Functions

 SinglePalette (byte[] data, int offset)
 Creates a ROM-backed palette object.
SinglePalette CreateCopy ()
 Creates a copy of this palette. The copy will have its own buffer (changes made to the copy won't be reflected in the original palette /ROM image).
void Overwrite (SinglePalette pal)
 Copies the specified palette into this palette.
void ApplyToBitmap (Bitmap b, int index)
 Applies this palette to an 8-bit paletted bitmap.
void ApplyToBitmap (Bitmap b, int index, ColorFilter filter)
 Applies this palette to an 8-bit paletted bitmap.

Static Public Member Functions

static SinglePalette CreateNewPalette ()
 Returns a new independent SinglePalette (NOT ROM-backed).

Public Attributes

const int Size = 4
 The number of colors in a single palette.
readonly byte[] data
 The buffer the palette data is stored in. This can be either a ROM image or a local buffer.
readonly int offset
 The location within the buffer of the palette data.

Properties

bool IsEmpty [get]
 Returns true if this object is uninitialized.
int this [int index] [get, set]
 Gets/sets an entry in the palette.
bool UsesLocalBuffer [get]
 Returns true if this palette is backed by its own private buffer. A return value of false indigates that this palette references the buffer of a ROM image or a CompositePalette.

Detailed Description

Represents a 4-color palette. Can be ROM-backed (wraps and modifies ROM data) or independent.


Constructor & Destructor Documentation

Romulus.Nes.SinglePalette.SinglePalette ( byte[]  data,
int  offset 
)

Creates a ROM-backed palette object.

Parameters:
data ROM image.
offset Location of palette data.

Member Function Documentation

void Romulus.Nes.SinglePalette.ApplyToBitmap ( Bitmap  b,
int  index 
)

Applies this palette to an 8-bit paletted bitmap.

Parameters:
b The bitmap to apply the palette to.
index The palette index of the target bitmap that specifies where in the color table this palette will be written to.
void Romulus.Nes.SinglePalette.ApplyToBitmap ( Bitmap  b,
int  index,
ColorFilter  filter 
)

Applies this palette to an 8-bit paletted bitmap.

Parameters:
b The bitmap to apply the palette to.
index The palette index of the target bitmap that specifies where in the color table this palette will be written to.
filter A function that modifies the colors that will be applied to the bitmap.
SinglePalette Romulus.Nes.SinglePalette.CreateCopy (  ) 

Creates a copy of this palette. The copy will have its own buffer (changes made to the copy won't be reflected in the original palette /ROM image).

static SinglePalette Romulus.Nes.SinglePalette.CreateNewPalette (  )  [static]

Returns a new independent SinglePalette (NOT ROM-backed).

Returns:
A new SinglePalette object that does not directly reference ROM data.
void Romulus.Nes.SinglePalette.Overwrite ( SinglePalette  pal  ) 

Copies the specified palette into this palette.

Parameters:
pal The palette to copy

Member Data Documentation

The buffer the palette data is stored in. This can be either a ROM image or a local buffer.

The location within the buffer of the palette data.

The number of colors in a single palette.


Property Documentation

bool Romulus.Nes.SinglePalette.IsEmpty [get]

Returns true if this object is uninitialized.

int Romulus.Nes.SinglePalette.this[int index] [get, set]

Gets/sets an entry in the palette.

Parameters:
index A value from 0 and three specifying a palette entry.
Returns:
A color index from this palette.
bool Romulus.Nes.SinglePalette.UsesLocalBuffer [get]

Returns true if this palette is backed by its own private buffer. A return value of false indigates that this palette references the buffer of a ROM image or a CompositePalette.


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