PColorF Structure

Represents a 128-bit premultiplied linear (not gamma-corrected) color where every color channel is represented by a 32-bit floating point value.

Definition

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

Constructors

PColorF(Color32) Initializes a new instance of the PColorF struct from a Color32 instance.
PColorF(Color64) Initializes a new instance of the PColorF struct from a Color64 instance.
PColorF(ColorF) Initializes a new instance of the PColorF struct from a ColorF instance.
PColorF(Single, Single, Single) Initializes a new instance of the PColorF struct from RGB (red, green, and blue) values. For performance reasons this overload does not validate if the color components are between 0 and 1 but you can use the PColorF(Single, Single, Single, Boolean) constructor or the IsValid property for validation, or the Clip method to return a valid instance.
PColorF(Single, Single, Single, Boolean) Initializes a new instance of the PColorF struct from RGB (red, green, and blue) values.
PColorF(Single, Single, Single, Single) Initializes a new instance of the PColorF struct from ARGB (alpha, red, green, and blue) values. For performance reasons this overload does not validate if the color components are between 0 and 1 but you can use the PColorF(Single, Single, Single, Single, Boolean) constructor or the IsValid property for validation, or the Clip method to return a valid instance.
PColorF(Single, Single, Single, Single, Boolean) Initializes a new instance of the PColorF struct from ARGB (alpha, red, green, and blue) values.

Properties

IsValid Gets whether this PColorF instance represents a valid color. That is, when A, R, G and B fields are all between 0 and 1, and A is greater than or equal to R, G and B.

Methods

Clip Returns a valid PColorF instance by clipping the possibly exceeding ARGB 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 PColorF instance.
(Overrides ValueTypeEquals(Object))
Equals(PColorF) Determines whether the current PColorF instance is equal to another one.
FromArgb Creates a PColorF instance from the specified ColorF structure specifying a custom alpha value. This method does not validate if the color components are between 0 and 1 but you can use the the IsValid property or the Clip method on the result.
FromRgba Creates a PColorF structure from a Vector4 instance mapping X to R, Y to G, Z to B and W to A.
GetHashCode Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode)
ToColorF Converts this PColorF instance to a ColorF structure. It's practically the same as calling the ToStraight(PColorF) method.
ToRgba Converts this PColorF instance to a Vector4 structure mapping R to X, G to Y, B to Z and A to W.
ToString Gets the string representation of this PColorF instance.
(Overrides ValueTypeToString)

Operators

Addition(PColorF, PColorF) Adds two colors together.
Addition(PColorF, Single) Adds a given scalar to a PColorF.
Division(PColorF, Single) Divides a PColorF by the given scalar.
Equality(PColorF, PColorF) Gets whether two PColorF structures are equal.
Inequality(PColorF, PColorF) Gets whether two PColorF structures are different.
Multiply(PColorF, Single) Multiplies a PColorF by the given scalar.
Subtraction(PColorF, PColorF) Subtracts the second color from the first one.
Subtraction(PColorF, Single) Subtracts a given scalar from the first color.

Fields

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

Extension Methods

Blend Blends the specified foreColor and backColor in the linear color space. It returns foreColor if it has no transparency (that is, when A is greater than or equal to 1); 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 greater than or equal to 1); otherwise, the result of the blending.
(Defined by ColorExtensions)
ToColor Converts this PColorF to a Color instance.
(Defined by ColorExtensions)
ToColor Converts this PColorF to a Color instance.
(Defined by ColorExtensions)
ToColor32 Converts this PColorF to a Color32 instance.
(Defined by ColorExtensions)
ToColor32 Converts this PColorF to a Color32 instance.
(Defined by ColorExtensions)
ToColor64 Converts this PColorF to a Color64 instance.
(Defined by ColorExtensions)
ToColor64 Converts this PColorF to a Color64 instance.
(Defined by ColorExtensions)
TolerantEquals Gets whether two PColorF instances are equal using a specified tolerance.
(Defined by ColorExtensions)
ToMediaColor Converts a ColorF struct to System.Windows.Media.Color.
(Defined by ColorExtensions)
ToPColor32 Converts this PColorF to a PColor32 instance.
(Defined by ColorExtensions)
ToPColor32 Converts this PColorF to a PColor32 instance.
(Defined by ColorExtensions)
ToPColor64 Converts this PColorF to a PColor64 instance.
(Defined by ColorExtensions)
ToPColor64 Converts this PColorF to a PColor64 instance.
(Defined by ColorExtensions)
ToSKColor Converts a PColorF struct to SKColor.
(Defined by ColorExtensions)
ToSKColorF Converts a PColorF struct to SKColorF.
(Defined by ColorExtensions)
ToSKPMColor Converts a PColorF struct to SKPMColor.
(Defined by ColorExtensions)
ToStraight Converts this premultiplied PColorF value to a straight ColorF value. It's practically the same as calling the ToColorF method.
(Defined by ColorExtensions)
ToStraightSafe Converts this premultiplied PColorF instance containing possibly invalid ARGB values to a straight ColorF value.
(Defined by ColorExtensions)
ToWindowsColor Converts a PColorF struct to Windows.UI.Color.
(Defined by ColorExtensions)

See Also