Color32 Structure

Represents a 32-bit sRGB color where every color channel is represented by a 8-bit integer. It represents the same color space as the Color structure does but in a more optimized way for better performance and smaller memory consumption.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.2.0
C#
[SerializableAttribute]
public readonly struct Color32 : IEquatable<Color32>
Inheritance
Object    ValueType    Color32
Implements
IEquatableColor32

Constructors

Color32(Color) Initializes a new instance of the Color32 struct from a Color instance.
Color32(Byte, Byte, Byte) Initializes a new instance of the Color32 struct from RGB (red, green, and blue) values.
Color32(Byte, Byte, Byte, Byte) Initializes a new instance of the Color32 struct from ARGB (alpha, red, green, and blue) values.

Methods

Equals(Color32) Determines whether the current Color32 instance is equal to another one.
Equals(Object) Determines whether the specified Object is equal to this Color32 instance.
(Overrides ValueTypeEquals(Object))
FromArgb(Int32) Creates a Color32 structure from a 32-bit ARGB value.
FromArgb(UInt32) Creates a Color32 structure from a 32-bit ARGB value.
FromArgb(Byte, Color32) Creates a Color32 instance from the specified Color32 structure, but with the new specified alpha value.
FromGray Creates a Color32 structure representing a grayscale color of the specified brightness.
FromRgb(Int32) Creates a Color32 structure from a 24-bit RGB value. The highest byte of the specified integer is ignored and the A property of the result will be 255.
FromRgb(UInt32) Creates a Color32 structure from a 24-bit RGB value. The highest byte of the specified integer is ignored and the A property of the result will be 255.
GetHashCode Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode)
ToArgb Gets the 32-bit ARGB value of this Color32 instance.
ToArgbUInt32 Gets the 32-bit ARGB value of this Color32 instance.
ToColor Converts this Color32 instance to a Color structure.
ToGray Gets a Color32 instance that represents the matching gray shade of this Color32 instance based on human perception.
ToOpaque Gets a Color32 instance that represents this Color32 without alpha (transparency).
ToRgb Gets the 24-bit RGB value of this Color32 instance. The most significant byte of the returned integer is zero.
ToRgbUInt32 Gets the 24-bit RGB value of this Color32 instance. The most significant byte of the returned integer is zero.
ToString Gets the string representation of this Color32 instance.
(Overrides ValueTypeToString)

Operators

Equality(Color32, Color32) Gets whether two Color32 structures are equal.
(Color to Color32) Performs an implicit conversion from Color to Color32.
(Color32 to Color) Performs an implicit conversion from Color32 to Color.
Inequality(Color32, Color32) Gets whether two Color32 structures are different.

Fields

A Gets the alpha component value of this Color32 structure. This field is read-only.
B Gets the blue component value of this Color32 structure. This field is read-only.
G Gets the green component value of this Color32 structure. This field is read-only.
R Gets the red component value of this Color32 structure. This field is read-only.

Extension Methods

Blend Blends the specified foreColor and backColor in the sRGB color space. It returns foreColor if it has no transparency (that is, when A is 255); otherwise, the result of the blending.
(Defined by ColorExtensions)
Blend Blends the specified foreColor and backColor in the specified colorSpace. It returns foreColor if it has no transparency (that is, when A is 255); otherwise, the result of the blending.
(Defined by ColorExtensions)
GetBrightness Gets the brightness of a Color32 instance as a byte based on human perception. The A component of the specified value is ignored.
(Defined by ColorExtensions)
GetBrightness Gets the brightness of a Color32 instance as a byte based on human perception. The A component of the specified value is ignored.
(Defined by ColorExtensions)
GetBrightnessF Gets the brightness of a Color32 instance as a float value based on human perception. The A component of the specified value is ignored.
(Defined by ColorExtensions)
GetBrightnessF Gets the brightness of a Color32 instance as a float value based on human perception. The A component of the specified value is ignored.
(Defined by ColorExtensions)
ToColor64 Converts this Color32 to a Color64 instance.
(Defined by ColorExtensions)
ToColorF Converts this Color32 to a ColorF instance.
(Defined by ColorExtensions)
ToColorF Converts this Color32 to a ColorF instance.
(Defined by ColorExtensions)
TolerantEquals Gets whether two Color32 instances are equal using a specified tolerance.
(Defined by ColorExtensions)
ToMediaColor Converts a Color32 struct to System.Windows.Media.Color.
(Defined by ColorExtensions)
ToPColor32 Converts this Color32 to a PColor32 instance. It's practically the same as calling the ToPremultiplied(Color32) method.
(Defined by ColorExtensions)
ToPColor64 Converts this Color32 to a PColor64 instance.
(Defined by ColorExtensions)
ToPColorF Converts this Color32 to a PColorF instance.
(Defined by ColorExtensions)
ToPColorF Converts this Color32 to a PColorF instance.
(Defined by ColorExtensions)
ToPremultiplied Converts this straight Color32 value to a premultiplied PColor32 value. It's practically the same as calling the ToPColor32(Color32) method.
(Defined by ColorExtensions)
ToSKColor Converts a Color32 struct to SKColor.
(Defined by ColorExtensions)
ToSKColorF Converts a Color32 struct to SKColorF.
(Defined by ColorExtensions)
ToSKPMColor Converts a Color32 struct to SKPMColor.
(Defined by ColorExtensions)
ToWindowsColor Converts a Color32 struct to Windows.UI.Color.
(Defined by ColorExtensions)

See Also