The RGBTRIPLE structure describes a color consisting of relative intensities of red, green and blue 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 RGBTRIPLE : IComparable, IComparable<RGBTRIPLE>, 
	IEquatable<RGBTRIPLE>
Visual Basic (Declaration)
<SerializableAttribute> _
Public Structure RGBTRIPLE _
	Implements IComparable, IComparable(Of RGBTRIPLE),  _
	IEquatable(Of RGBTRIPLE)
Visual C++
[SerializableAttribute]
public value class RGBTRIPLE : IComparable, 
	IComparable<RGBTRIPLE>, IEquatable<RGBTRIPLE>

Remarks

The RGBTRIPLE structure provides access to an underlying Win32 RGBTRIPLE structure. To determine the red, green or blue component of a color, use the rgbtRed, rgbtGreen or rgbtBlue fields, respectively.

For easy integration of the underlying structure into the .NET framework, the RGBTRIPLE 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 RGBTRIPLE structure and my be used in all situations which require an RGBTRIPLE type.

Each of the color components rgbtRed, rgbtGreen or rgbtBlue of RGBTRIPLE is translated into it's corresponding color component R, G or B of Color by an one-to-one manner and vice versa. When converting from Color into RGBTRIPLE, the color's alpha value is ignored and assumed to be 255 when converting from RGBTRIPLE into Color, creating a fully opaque color.

Conversion from System.Drawing.Color to RGBTRIPLE

RGBTRIPLE.component = Color.component

Conversion from RGBTRIPLE to System.Drawing.Color

Color.component = RGBTRIPLE.component

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

Examples

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

Version Information

FreeImage.NET

Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also