static Color FromBytes( int r, int g, int b, int a )

book_4_sparkGenerated
code_blocksInput

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, which is then converted to a float in the range of 0 to 1 for internal representation.

Usage

Use this method when you need to create a Color object from byte values, such as when working with color data from image files or other sources that use 8-bit color channels.

Example

// Example of using Color.FromBytes to create a color
Color color = Color.FromBytes(255, 0, 0, 255); // Creates a fully opaque red color

// Another example with semi-transparent blue
Color semiTransparentBlue = Color.FromBytes(0, 0, 255, 128);