FIRGBF Structure |
Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
[SerializableAttribute] public struct FIRGBF : IComparable, IComparable<FIRGBF>, IEquatable<FIRGBF>
The FIRGBF type exposes the following members.
Name | Description | |
---|---|---|
CompareTo(Object) |
Compares this instance with a specified Object.
| |
CompareTo(FIRGBF) |
Compares this instance with a specified FIRGBF object.
| |
Equals(Object) |
Tests whether the specified object is a FIRGBF structure
and is equivalent to this FIRGBF structure.
(Overrides ValueTypeEquals(Object).) | |
Equals(FIRGBF) |
Tests whether the specified FIRGBF structure is equivalent to this FIRGBF structure.
| |
GetHashCode |
Returns a hash code for this FIRGBF structure.
(Overrides ValueTypeGetHashCode.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString |
Converts the numeric value of the FIRGBF object
to its equivalent string representation.
(Overrides ValueTypeToString.) |
Name | Description | |
---|---|---|
Equality |
Tests whether two specified FIRGBF structures are equivalent.
| |
(Color to FIRGBF) |
Converts the value of a Color structure to a FIRGBF structure.
| |
(FIRGBF to Color) |
Converts the value of a FIRGBF structure to a Color structure.
| |
Inequality |
Tests whether two specified FIRGBF structures are different.
|
Name | Description | |
---|---|---|
blue |
The blue color component.
| |
green |
The green color component.
| |
red |
The red color component.
|
The FIRGBF structure provides access to an underlying FreeImage FIRGBF 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 FIRGBF 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 FIRGBF structure and my be used in all situations which require an FIRGBF type.
Each color component alpha, red, green or blue of FIRGBF 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. When converting from Color into FIRGBF, the color's alpha value is ignored and assumed to be 255 when converting from FIRGBF into Color, creating a fully opaque color.
Conversion from System.Drawing.Color to FIRGBF
FIRGBF.component = (float)Color.component / 255fConversion from FIRGBF to System.Drawing.Color
Color.component = (int)(FIRGBF.component * 255f)The same conversion is also applied when the Color property or the FIRGBF(Color) constructor is invoked.
FIRGBF firgbf; // Initialize the structure using a native .NET Color structure. firgbf = new FIRGBF(Color.Indigo); // Initialize the structure using the implicit operator. firgbf = Color.DarkSeaGreen; // Convert the FIRGBF instance into a native .NET Color // using its implicit operator. Color color = firgbf; // Using the structure's Color property for converting it // into a native .NET Color. Color another = firgbf.Color;