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

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


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


The FIRGB16 structure provides access to an underlying FreeImage FIRGB16 structure. To determine the red, green or blue component of a color, use the red, green or blue fields, respectively.

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

Each color component red, green or blue of FIRGB16 is translated into it's corresponding color component R, G or B of Color by right shifting 8 bits and shifting left 8 bits for the reverse conversion. When converting from Color into FIRGB16, the color's alpha value is ignored and assumed to be 255 when converting from FIRGB16 into Color, creating a fully opaque color.

Conversion from System.Drawing.Color to FIRGB16

FIRGB16.component = Color.component << 8

Conversion from FIRGB16 to System.Drawing.Color

Color.component = FIRGB16.component >> 8

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


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

Version Information


Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also