PColor32 Structure

Represents a 32-bit premultiplied sRGB color where every color channel is represented by a 8-bit integer.

Definition

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

Constructors

PColor32(Color32) Initializes a new instance of the PColor32 struct from a Color32 instance.
PColor32(Byte, Byte, Byte) Initializes a new instance of the PColor32 struct from RGB (red, green, and blue) values.
PColor32(Byte, Byte, Byte, Byte) Initializes a new instance of the PColor32 struct from ARGB (alpha, red, green, and blue) values. For performance reasons this overload does not validate the parameters but you can use the PColor32(Byte, Byte, Byte, Byte, Boolean) constructor or the IsValid property for validation, or the Clip method to return a valid instance.
PColor32(Byte, Byte, Byte, Byte, Boolean) Initializes a new instance of the PColor32 struct from ARGB (alpha, red, green, and blue) values.

Properties

IsValid Gets whether this PColor32 instance represents a valid premultiplied color. That is, when A is greater than or equal to R, G and B.

Methods

Clip Returns a valid PColor32 instance by clipping the possibly exceeding original RGB values. If IsValid returns , then the result is the same as the original instance.
Equals(Object) Determines whether the specified Object is equal to this PColor32 instance.
(Overrides ValueTypeEquals(Object))
Equals(PColor32) Determines whether the current PColor32 instance is equal to another one.
FromArgb(Int32) Creates a PColor32 structure from a 32-bit ARGB value.
FromArgb(UInt32) Creates a PColor32 structure from a 32-bit ARGB value.
FromArgb(Byte, Color32) Creates a PColor32 instance from the specified Color32 structure specifying a custom alpha value.
GetHashCode Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode)
ToArgb Gets the 32-bit ARGB value of this PColor32 instance.
ToArgbUInt32 Gets the 32-bit ARGB value of this PColor32 instance.
ToColor32 Converts this PColor32 instance to a Color32 structure. It's practically the same as calling the ToStraight(PColor32) method.
ToString Gets the string representation of this PColor32 instance.
(Overrides ValueTypeToString)

Operators

Equality(PColor32, PColor32) Gets whether two PColor32 structures are equal.
Inequality(PColor32, PColor32) Gets whether two PColor32 structures are different.

Fields

A Gets the alpha component value of this PColor32 structure. This field is read-only.
B Gets the blue component value of this PColor32 structure. This field is read-only.
G Gets the green component value of this PColor32 structure. This field is read-only.
R Gets the red component value of this PColor32 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)
ToColor Converts this PColor32 to a Color instance.
(Defined by ColorExtensions)
ToColor64 Converts this PColor32 to a Color64 instance.
(Defined by ColorExtensions)
ToColorF Converts this PColor32 to a ColorF instance.
(Defined by ColorExtensions)
ToColorF Converts this PColor32 to a ColorF instance.
(Defined by ColorExtensions)
TolerantEquals Gets whether two PColor32 instances are equal using a specified tolerance.
(Defined by ColorExtensions)
ToMediaColor Converts a PColor32 struct to System.Windows.Media.Color.
(Defined by ColorExtensions)
ToPColor64 Converts this PColor32 to a PColor64 instance.
(Defined by ColorExtensions)
ToPColorF Converts this PColor32 to a PColorF instance.
(Defined by ColorExtensions)
ToPColorF Converts this PColor32 to a ColorF instance.
(Defined by ColorExtensions)
ToSKColor Converts a PColor32 struct to SKColor.
(Defined by ColorExtensions)
ToSKColorF Converts a PColor32 struct to SKColorF.
(Defined by ColorExtensions)
ToSKPMColor Converts a PColor32 struct to SKPMColor.
(Defined by ColorExtensions)
ToStraight Converts this premultiplied PColor32 value to a straight Color32 value. It's practically the same as calling the ToColor32 method.
(Defined by ColorExtensions)
ToStraightSafe Converts this premultiplied PColor32 instance containing possibly invalid RGB values to a straight Color32 value.
(Defined by ColorExtensions)
ToWindowsColor Converts a PColor32 struct to Windows.UI.Color.
(Defined by ColorExtensions)

See Also