Class DFPalette
Describes a 256-colour Daggerfall palette. Supports loading .PAL and .COL files. Palette is initialised to all 0xff0000 (red) to make it obvious when palette isn't loaded.
Namespace: DaggerfallConnect
Assembly: Assembly-CSharp.dll
Syntax
public class DFPalette
Constructors
| Improve this Doc View SourceDFPalette()
Default constructor. Palette is initialised with red.
Declaration
public DFPalette()
DFPalette(DFPalette)
Copy constructor.
Declaration
public DFPalette(DFPalette other)
Parameters
Type | Name | Description |
---|---|---|
DFPalette | other | Palette to copy from. |
DFPalette(String)
Load constructor (supports both .PAL and .COL files).
Declaration
public DFPalette(string FilePath)
Parameters
Type | Name | Description |
---|---|---|
String | FilePath | Absolute path to palette file. |
Properties
| Improve this Doc View SourceHeaderLength
Gets palette header length;
Declaration
public int HeaderLength { get; }
Property Value
Type | Description |
---|---|
Int32 |
PaletteBuffer
Gets palette memory buffer.
Declaration
public byte[] PaletteBuffer { get; }
Property Value
Type | Description |
---|---|
Byte[] |
Methods
| Improve this Doc View SourceFill(Byte, Byte, Byte)
Fills entire palette with specified RGB value.
Declaration
public void Fill(byte R, byte G, byte B)
Parameters
Type | Name | Description |
---|---|---|
Byte | R | Red component. |
Byte | G | Green component. |
Byte | B | Blue component. |
Find(Byte, Byte, Byte)
Finds index with specified RGB values.
Declaration
public int Find(byte R, byte G, byte B)
Parameters
Type | Name | Description |
---|---|---|
Byte | R | Red component. |
Byte | G | Green component. |
Byte | B | Blue component. |
Returns
Type | Description |
---|---|
Int32 | Index of found RGB value. |
Get(Int32)
Gets colour at specified index.
Declaration
public DFColor Get(int Index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | Index | Index into colour array. |
Returns
Type | Description |
---|---|
DFColor | DFColor object. |
GetBlue(Int32)
Gets blue colour value at index.
Declaration
public byte GetBlue(int Index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | Index | Index into colour array. |
Returns
Type | Description |
---|---|
Byte | Blue value byte. |
GetGreen(Int32)
Gets green colour value at index.
Declaration
public byte GetGreen(int Index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | Index | Index into colour array. |
Returns
Type | Description |
---|---|
Byte | Green value byte. |
GetRed(Int32)
Gets red colour value at index.
Declaration
public byte GetRed(int Index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | Index | Index into colour array. |
Returns
Type | Description |
---|---|
Byte | Red value byte. |
Load(String)
Loads a Daggerfall palette file (supports both .PAL and .COL files).
Declaration
public bool Load(string FilePath)
Parameters
Type | Name | Description |
---|---|---|
String | FilePath | Absolute path to palette file. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
MakeAutomap()
Fills palette with AutoMap colours. The AutoMap colour index is equal to BuildingTypes value + 1.
Declaration
public void MakeAutomap()
MakeGrayscale()
Fills entire palette with grayscale values.
Declaration
public void MakeGrayscale()
MakeRandom()
Fills entire palette with random values.
Declaration
public void MakeRandom()
Multiply(Int32)
Declaration
public void Multiply(int scale)
Parameters
Type | Name | Description |
---|---|---|
Int32 | scale |
Read(ref BinaryReader)
Read palette information from a binary reader. Palette must be a 768-byte PalFile structure (256x 24-bit RGB values).
Declaration
public bool Read(ref BinaryReader Reader)
Parameters
Type | Name | Description |
---|---|---|
BinaryReader | Reader | Source reader positioned at start of palette data. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
Set(Byte[])
Sets 768-byte palette buffer directly.
Declaration
public void Set(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | data | Data to set. |
Set(Int32, Byte, Byte, Byte)
Sets index to specified RGB values.
Declaration
public void Set(int Index, byte R, byte G, byte B)
Parameters
Type | Name | Description |
---|---|---|
Int32 | Index | Index into colour array. |
Byte | R | Red component. |
Byte | G | Green component. |
Byte | B | Blue component. |