The Color.FromRgba
method creates a Color
instance from a 32-bit unsigned integer representing the RGBA components. The integer is expected to be in the format 0xRRGGBBAA, where each component (red, green, blue, and alpha) is an 8-bit value.
The Color.FromRgba
method creates a Color
instance from a 32-bit unsigned integer representing the RGBA components. The integer is expected to be in the format 0xRRGGBBAA, where each component (red, green, blue, and alpha) is an 8-bit value.
Use this method when you have a color represented as a 32-bit unsigned integer and you need to convert it to a Color
object. This is particularly useful when dealing with color data stored in a compact format, such as in graphics programming or when interfacing with APIs that use this format.
// Example of using Color.FromRgba uint rgbaValue = 0xFF00FF00; // Represents a green color with full opacity Color color = Color.FromRgba(rgbaValue); // Accessing the color components float red = color.r; // 1.0 float green = color.g; // 0.0 float blue = color.b; // 1.0 float alpha = color.a; // 0.0