ColorExtensions Class

Contains extension methods for various color types representing colors.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.1.0
C#
public static class ColorExtensions
Inheritance
Object    ColorExtensions

Methods

Blend(Color32, Color32) 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.
Blend(Color64, Color64) Blends the specified foreColor and backColor in the sRGB color space. It returns foreColor if it has no transparency (that is, when A is 65535); otherwise, the result of the blending.
Blend(ColorF, ColorF) 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.
Blend(PColor32, PColor32) 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.
Blend(PColor64, PColor64) Blends the specified foreColor and backColor in the sRGB color space. It returns foreColor if it has no transparency (that is, when A is 65535); otherwise, the result of the blending.
Blend(PColorF, PColorF) 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.
Blend(Color32, Color32, WorkingColorSpace) 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.
Blend(Color64, Color64, WorkingColorSpace) Blends the specified foreColor and backColor in the specified colorSpace. It returns foreColor if it has no transparency (that is, when A is 65535); otherwise, the result of the blending.
Blend(ColorF, ColorF, WorkingColorSpace) 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.
Blend(PColor32, PColor32, WorkingColorSpace) 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.
Blend(PColor64, PColor64, WorkingColorSpace) Blends the specified foreColor and backColor in the specified colorSpace. It returns foreColor if it has no transparency (that is, when A is 65535); otherwise, the result of the blending.
Blend(PColorF, PColorF, WorkingColorSpace) 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.
GetBrightness(Color32) Gets the brightness of a Color32 instance as a byte based on human perception. The A component of the specified value is ignored.
GetBrightness(Color64) Gets the brightness of a Color64 instance as a UInt16 based on human perception. The A component of the specified value is ignored.
GetBrightness(ColorF) Gets the brightness of a ColorF instance as a float value in the linear color space. The A component of the specified value is ignored.
GetBrightness(Color32, WorkingColorSpace) Gets the brightness of a Color32 instance as a byte based on human perception. The A component of the specified value is ignored.
GetBrightness(Color64, WorkingColorSpace) Gets the brightness of a Color64 instance as a UInt16 based on human perception. The A component of the specified value is ignored.
GetBrightness(ColorF, WorkingColorSpace) Gets the brightness of a ColorF instance as a float value in the linear color space. The A component of the specified value is ignored.
GetBrightnessF(Color32) Gets the brightness of a Color32 instance as a float value based on human perception. The A component of the specified value is ignored.
GetBrightnessF(Color64) Gets the brightness of a Color64 instance as a float value based on human perception. The A component of the specified value is ignored.
GetBrightnessF(Color32, WorkingColorSpace) Gets the brightness of a Color32 instance as a float value based on human perception. The A component of the specified value is ignored.
GetBrightnessF(Color64, WorkingColorSpace) Gets the brightness of a Color64 instance as a float value based on human perception. The A component of the specified value is ignored.
ToColor(Color64) Converts this Color64 to a Color instance.
ToColor(ColorF) Converts this ColorF to a Color instance.
ToColor(PColor32) Converts this PColor32 to a Color instance.
ToColor(PColor64) Converts this PColor64 to a Color instance.
ToColor(PColorF) Converts this PColorF to a Color instance.
ToColor(ColorF, Boolean) Converts this ColorF to a Color instance.
ToColor(PColorF, Boolean) Converts this PColorF to a Color instance.
ToColor32(Color) Converts this Color to a Color32 instance.
ToColor32(PColorF) Converts this PColorF to a Color32 instance.
ToColor32(ColorF, Boolean) Converts this ColorF to a Color32 instance.
ToColor32(PColorF, Boolean) Converts this PColorF to a Color32 instance.
ToColor64(Color) Converts this Color to a Color64 instance.
ToColor64(Color32) Converts this Color32 to a Color64 instance.
ToColor64(PColor32) Converts this PColor32 to a Color64 instance.
ToColor64(PColorF) Converts this PColorF to a Color64 instance.
ToColor64(ColorF, Boolean) Converts this ColorF to a Color64 instance.
ToColor64(PColorF, Boolean) Converts this PColorF to a Color64 instance.
ToColorF(Color) Converts this Color to a ColorF instance.
ToColorF(Color32) Converts this Color32 to a ColorF instance.
ToColorF(Color64) Converts this Color64 to a ColorF instance.
ToColorF(PColor32) Converts this PColor32 to a ColorF instance.
ToColorF(PColor64) Converts this PColor64 to a ColorF instance.
ToColorF(Color, Boolean) Converts this Color to a ColorF instance.
ToColorF(Color32, Boolean) Converts this Color32 to a ColorF instance.
ToColorF(Color64, Boolean) Converts this Color64 to a ColorF instance.
ToColorF(PColor32, Boolean) Converts this PColor32 to a ColorF instance.
ToColorF(PColor64, Boolean) Converts this PColor64 to a ColorF instance.
TolerantEquals(Color32, Color32, Byte, Byte) Gets whether two Color32 instances are equal using a specified tolerance.
TolerantEquals(Color64, Color64, UInt16, UInt16) Gets whether two Color64 instances are equal using a specified tolerance.
TolerantEquals(ColorF, ColorF, Single, Single) Gets whether two ColorF instances are equal using a specified tolerance.
TolerantEquals(PColor32, PColor32, Byte, Byte) Gets whether two PColor32 instances are equal using a specified tolerance.
TolerantEquals(PColor64, PColor64, UInt16, UInt16) Gets whether two PColor64 instances are equal using a specified tolerance.
TolerantEquals(PColorF, PColorF, Single, Single) Gets whether two PColorF instances are equal using a specified tolerance.
ToPColor32(Color) Converts this Color to a PColor32 instance.
ToPColor32(Color32) Converts this Color32 to a PColor32 instance. It's practically the same as calling the ToPremultiplied(Color32) method.
ToPColor32(Color64) Converts this Color64 to a PColor32 instance.
ToPColor32(ColorF) Converts this ColorF to a PColor32 instance.
ToPColor32(PColorF) Converts this PColorF to a PColor32 instance.
ToPColor32(ColorF, Boolean) Converts this ColorF to a PColor32 instance.
ToPColor32(PColorF, Boolean) Converts this PColorF to a PColor32 instance.
ToPColor64(Color) Converts this Color to a PColor64 instance.
ToPColor64(Color32) Converts this Color32 to a PColor64 instance.
ToPColor64(Color64) Converts this Color64 to a PColor64 instance. It's practically the same as calling the ToPremultiplied(Color64) method.
ToPColor64(ColorF) Converts this ColorF to a PColor64 instance.
ToPColor64(PColor32) Converts this PColor32 to a PColor64 instance.
ToPColor64(PColorF) Converts this PColorF to a PColor64 instance.
ToPColor64(ColorF, Boolean) Converts this ColorF to a PColor64 instance.
ToPColor64(PColorF, Boolean) Converts this PColorF to a PColor64 instance.
ToPColorF(Color) Converts this Color to a PColorF instance.
ToPColorF(Color32) Converts this Color32 to a PColorF instance.
ToPColorF(Color64) Converts this Color64 to a PColorF instance.
ToPColorF(ColorF) Converts this ColorF to a PColorF instance. It's practically the same as calling the ToPremultiplied(ColorF) method.
ToPColorF(PColor32) Converts this PColor32 to a PColorF instance.
ToPColorF(PColor64) Converts this PColor64 to a PColorF instance.
ToPColorF(Color, Boolean) Converts this Color to a PColorF instance.
ToPColorF(Color32, Boolean) Converts this Color32 to a PColorF instance.
ToPColorF(Color64, Boolean) Converts this Color64 to a PColorF instance.
ToPColorF(PColor32, Boolean) Converts this PColor32 to a ColorF instance.
ToPColorF(PColor64, Boolean) Converts this PColor64 to a ColorF instance.
ToPremultiplied(Color32) Converts this straight Color32 value to a premultiplied PColor32 value. It's practically the same as calling the ToPColor32(Color32) method.
ToPremultiplied(Color64) Converts this straight Color64 value to a premultiplied PColor64 value. It's practically the same as calling the ToPColor64(Color64) method.
ToPremultiplied(ColorF) Converts this straight ColorF value to a premultiplied PColorF value. It's practically the same as calling the ToPColorF(ColorF) method.
ToStraight(PColor32) Converts this premultiplied PColor32 value to a straight Color32 value. It's practically the same as calling the ToColor32 method.
ToStraight(PColor64) Converts this premultiplied PColor64 value to a straight Color64 value. It's practically the same as calling the ToColor64 method.
ToStraight(PColorF) Converts this premultiplied PColorF value to a straight ColorF value. It's practically the same as calling the ToColorF method.
ToStraightSafe(PColor32) Converts this premultiplied PColor32 instance containing possibly invalid RGB values to a straight Color32 value.
ToStraightSafe(PColor64) Converts this premultiplied PColor64 instance containing possibly invalid RGB values to a straight Color64 value.
ToStraightSafe(PColorF) Converts this premultiplied PColorF instance containing possibly invalid ARGB values to a straight ColorF value.

See Also