RGBTRIPLE Structure

FreeImage.NET

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

The RGBTRIPLE type exposes the following members.

Constructors
  NameDescription
Public methodRGBTRIPLE
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(RGBTRIPLE)
Compares this instance with a specified RGBTRIPLE object.
Public methodEquals(Object)
Tests whether the specified object is a RGBTRIPLE structure and is equivalent to this RGBTRIPLE structure.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(RGBTRIPLE)
Tests whether the specified RGBTRIPLE structure is equivalent to this RGBTRIPLE structure.
Public methodGetHashCode
Returns a hash code for this RGBTRIPLE structure.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Converts the numeric value of the RGBTRIPLE object to its equivalent string representation.
(Overrides ValueTypeToString.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Tests whether two specified RGBTRIPLE structures are equivalent.
Public operatorStatic member(Color to RGBTRIPLE)
Converts the value of a Color structure to a RGBTRIPLE structure.
Public operatorStatic member(UInt32 to RGBTRIPLE)
Converts the value of an UInt32 structure to a RGBTRIPLE structure.
Public operatorStatic member(RGBTRIPLE to Color)
Converts the value of a RGBTRIPLE structure to a Color structure.
Public operatorStatic member(RGBTRIPLE to UInt32)
Converts the value of a RGBTRIPLE structure to an UInt32 structure.
Public operatorStatic memberInequality
Tests whether two specified RGBTRIPLE structures are different.
Top
Fields
  NameDescription
Public fieldrgbtBlue
The blue color component.
Public fieldrgbtGreen
The green color component.
Public fieldrgbtRed
The red color component.
Top
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.
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;
See Also