The RGBQUAD structure describes a color consisting of relative intensities of red, green, blue and alpha value. Each single color component consumes 8 bits and so, takes values in the range from 0 to 255.

Namespace:  FreeImageAPI
Assembly:  FreeImageNET (in FreeImageNET.dll)

Syntax

C#
[SerializableAttribute]
public struct RGBQUAD : IComparable, IComparable<RGBQUAD>, 
	IEquatable<RGBQUAD>
Visual Basic (Declaration)
<SerializableAttribute> _
Public Structure RGBQUAD _
	Implements IComparable, IComparable(Of RGBQUAD),  _
	IEquatable(Of RGBQUAD)
Visual C++
[SerializableAttribute]
public value class RGBQUAD : IComparable, 
	IComparable<RGBQUAD>, IEquatable<RGBQUAD>

Remarks

The RGBQUAD structure provides access to an underlying Win32 RGBQUAD structure. To determine the alpha, red, green or blue component of a color, use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively.

For easy integration of the underlying structure into the .NET framework, the RGBQUAD structure implements implicit conversion operators to convert the represented color to and from the Color type. This makes the Color type a real replacement for the RGBQUAD structure and my be used in all situations which require an RGBQUAD type.

Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of RGBQUAD is translated into it's corresponding color component A, R, G or B of Color by an one-to-one manner and vice versa.

Conversion from System.Drawing.Color to RGBQUAD

RGBQUAD.component = Color.component

Conversion from RGBQUAD to System.Drawing.Color

Color.component = RGBQUAD.component

The same conversion is also applied when the Color property or the RGBQUAD(Color) constructor is invoked.

Examples

The following code example demonstrates the various conversions between the RGBQUAD structure and the Color structure.
CopyC#
RGBQUAD rgbq;
// Initialize the structure using a native .NET Color structure.
rgbq = new RGBQUAD(Color.Indigo);
// Initialize the structure using the implicit operator.
rgbq = Color.DarkSeaGreen;
// Convert the RGBQUAD instance into a native .NET Color
// using its implicit operator.
Color color = rgbq;
// Using the structure's Color property for converting it
// into a native .NET Color.
Color another = rgbq.Color;

Version Information

FreeImage.NET

Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also