RGBQUAD Structure

FreeImage.NET

RGBQUAD Structure
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) Version: 3.17.0.4 (3.17.0)
Syntax
C#
[SerializableAttribute]
public struct RGBQUAD : IComparable, IComparable<RGBQUAD>, 
	IEquatable<RGBQUAD>

The RGBQUAD type exposes the following members.

Constructors
  NameDescription
Public methodRGBQUAD
Initializes a new instance based on the specified Color.
Top
Properties
  NameDescription
Public propertyColor
Gets or sets the Color of the structure.
Top
Methods
  NameDescription
Public methodCompareTo(Object)
Compares this instance with a specified Object.
Public methodCompareTo(RGBQUAD)
Compares this instance with a specified RGBQUAD object.
Public methodEquals(Object)
Tests whether the specified object is a RGBQUAD structure and is equivalent to this RGBQUAD structure.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(RGBQUAD)
Tests whether the specified RGBQUAD structure is equivalent to this RGBQUAD structure.
Public methodGetHashCode
Returns a hash code for this RGBQUAD structure.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberToColor
Converts an array of RGBQUAD into an array of Color.
Public methodStatic memberToRGBQUAD
Converts an array of Color into an array of RGBQUAD.
Public methodToString
Converts the numeric value of the RGBQUAD object to its equivalent string representation.
(Overrides ValueTypeToString.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Tests whether two specified RGBQUAD structures are equivalent.
Public operatorStatic member(Color to RGBQUAD)
Converts the value of a Color structure to a RGBQUAD structure.
Public operatorStatic member(UInt32 to RGBQUAD)
Converts the value of an UInt32 structure to a RGBQUAD structure.
Public operatorStatic member(RGBQUAD to Color)
Converts the value of a RGBQUAD structure to a Color structure.
Public operatorStatic member(RGBQUAD to UInt32)
Converts the value of a RGBQUAD structure to an UInt32 structure.
Public operatorStatic memberInequality
Tests whether two specified RGBQUAD structures are different.
Top
Fields
  NameDescription
Public fieldrgbBlue
The blue color component.
Public fieldrgbGreen
The green color component.
Public fieldrgbRed
The red color component.
Public fieldrgbReserved
The alpha color component.
Public fielduintValue
The color's value.
Top
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.
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;
See Also