Description
The Color.FromBytes
method creates a Color
instance from byte values for red, green, blue, and alpha components. Each component is expected to be an integer in the range of 0 to 255, where 0 represents the minimum intensity and 255 represents the maximum intensity for that color component.
Usage
Use this method when you need to create a Color
object from byte values, which are commonly used in graphics programming and image processing. This method is particularly useful when working with color data that is stored in 8-bit per channel formats.
Example
// Example of creating a Color from byte values
Color color = Color.FromBytes(255, 0, 0, 255); // Creates a fully opaque red color
// Example of creating a semi-transparent blue color
Color semiTransparentBlue = Color.FromBytes(0, 0, 255, 128);