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

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


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


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

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

Each color component alpha, red, green or blue of FIRGBAF is translated into it's corresponding color component A, R, G or B of Color by linearly mapping the values of one range into the other range and vice versa.

Conversion from System.Drawing.Color to FIRGBAF

FIRGBAF.component = (float)Color.component / 255f

Conversion from FIRGBAF to System.Drawing.Color

Color.component = (int)(FIRGBAF.component * 255f)

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


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

Version Information


Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also