C# Class Open.Core.Common.ColorExtensions

Datei anzeigen Open project: philcockfield/Open.TestHarness.SL

Public Methods

Method Description
ToAlpha ( this self, double opacity ) : Color

Converts given color to the specified opacity.

ToBrush ( this self, double opacity = 1 ) : SolidColorBrush

Converts the given color to a solid color brush at the given opacity.

ToGradient ( this direction, Color start, Color end ) : System.Windows.Media.LinearGradientBrush

Creates a gradient brush with the given colors flowing in the specified direction.

Private Methods

Method Description
ToByte ( byte colorValue, double opacity ) : byte

Method Details

ToAlpha() public static method

Converts given color to the specified opacity.
public static ToAlpha ( this self, double opacity ) : Color
self this The color to convert.
opacity double The opacity percentage (value from 0 to 1).
return System.Windows.Media.Color

ToBrush() public static method

Converts the given color to a solid color brush at the given opacity.
public static ToBrush ( this self, double opacity = 1 ) : SolidColorBrush
self this The color to build the brush from.
opacity double The oapcity percentage (value from 0 to 1).
return System.Windows.Media.SolidColorBrush

ToGradient() public static method

Creates a gradient brush with the given colors flowing in the specified direction.
public static ToGradient ( this direction, Color start, Color end ) : System.Windows.Media.LinearGradientBrush
direction this The direction of the gradient.
start System.Windows.Media.Color The starting color.
end System.Windows.Media.Color The ending color.
return System.Windows.Media.LinearGradientBrush