Struct Color
Color structure.
Namespace: DIV2.Format.Exporter
Assembly: DIV2.Format.Exporter.dll
Syntax
public struct Color : ISerializableAsset
Remarks
Represents a RGB color format value.
Constructors
Color(BinaryReader)
Creates a new Color value.
Declaration
public Color(BinaryReader stream)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryReader | stream |
Color(Byte, Byte, Byte)
Creates a new Color value.
Declaration
public Color(byte red, byte green, byte blue)
Parameters
| Type | Name | Description |
|---|---|---|
| Byte | red | Red component value. |
| Byte | green | Green component value. |
| Byte | blue | Blue component value. |
Color(Byte[])
Creates a new Color value.
Declaration
public Color(byte[] buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| Byte[] | buffer | A 3 length array that contains the Color component values. |
Color(Int32, Int32, Int32)
Creates a new Color value.
Declaration
public Color(int red, int green, int blue)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | red | Red component value. |
| Int32 | green | Green component value. |
| Int32 | blue | Blue component value. |
Fields
blue
Blue component.
Declaration
public byte blue
Field Value
| Type | Description |
|---|---|
| Byte | A value between 0 and 255. |
green
Green component.
Declaration
public byte green
Field Value
| Type | Description |
|---|---|
| Byte | A value between 0 and 255. |
LENGTH
Declaration
public const int LENGTH = null
Field Value
| Type | Description |
|---|---|
| Int32 | Number of components. |
MAX_DAC_VALUE
Declaration
public const byte MAX_DAC_VALUE = null
Field Value
| Type | Description |
|---|---|
| Byte | Max supported value in DAC format [0..63]. |
red
Red component.
Declaration
public byte red
Field Value
| Type | Description |
|---|---|
| Byte | A value between 0 and 255. |
SIZE
Declaration
public const int SIZE = null
Field Value
| Type | Description |
|---|---|
| Int32 | Memory size. |
Properties
Item[Int32]
Gets or sets the component color value.
Declaration
public byte this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Index of the component. |
Property Value
| Type | Description |
|---|---|
| Byte | Returns the component color value. |
Methods
GetHashCode()
Generates a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | Returns an |
IsDAC()
Is a valid DAC color value?
Declaration
public bool IsDAC()
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the RGB components are into the DAC range values [0..63]. |
Normalize(ColorFormat)
Gets a
Declaration
public Vector3 Normalize(ColorFormat colorType)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorFormat | colorType | Indicates the color range for set the normalization factor. |
Returns
| Type | Description |
|---|---|
| Vector3 | Returns a |
ToDAC()
Converts RGB values [0..255] to DAC range [0..63].
Declaration
public Color ToDAC()
Returns
| Type | Description |
|---|---|
| Color | Returns new Color value in DAC range [0..63]. In most of the cases, this value is an aproximation to the real DAC value. |
Remarks
DIV Games Studio and other software that works in old VESA modes, using the DAC format for colors instead of full RGB format. Use this function to adapt RGB values to DAC in order to work properly with DIV Games Studio.
ToRGB()
Converts DAC values [0..63] to RGB range [0..255].
Declaration
public Color ToRGB()
Returns
| Type | Description |
|---|---|
| Color | Returns new Color value in RGB range [0..255]. In most of the cases, this value is an aproximation to the real RGB value. |
Remarks
DIV Games Studio and other software that works in old VESA modes, using the DAC format for colors instead of full RGB format. Use this function to adapt DAC values to RGB in order to work properly with modern implementations.
ToString()
Serializes the relevant data of this instance in a
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | Returns a |
Operators
Equality(Color, Color)
Equality operator.
Declaration
public static bool operator ==(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if both values are equal. |
Explicit(Color to Int32)
Cast the Color value to
Declaration
public static explicit operator int (Color value)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | value | Color value. |
Returns
| Type | Description |
|---|---|
| Int32 | Returns the |
GreaterThan(Color, Color)
Greater than operator.
Declaration
public static bool operator>(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the left value are greater than the right value. |
GreaterThanOrEqual(Color, Color)
Greater than or equal operator.
Declaration
public static bool operator >=(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the left value are greater or equal than the right value. |
Implicit(Int32 to Color)
Cast an
Declaration
public static implicit operator Color(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | value |
Returns
| Type | Description |
|---|---|
| Color | Returns the Color value from the |
Inequality(Color, Color)
Inequality operator.
Declaration
public static bool operator !=(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if both values are not equal. |
LessThan(Color, Color)
Less than operator.
Declaration
public static bool operator <(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the left value are less than the right value. |
LessThanOrEqual(Color, Color)
Less than or equal operator.
Declaration
public static bool operator <=(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Left Color value to compare. |
| Color | b | Right Color value to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the left value are less or equal than the right value. |