public override GradientStopCollection GetSliderBrush(HSL HSL) { byte A = HSL.A; double H = HSL.H; double S = HSL.S; double L = HSL.L; return(new GradientStopCollection() { new GradientStop() { Offset = 0, Color = HSL.HSLtoRGB(A, 0, S, L) }, new GradientStop() { Offset = 0.16666667, Color = HSL.HSLtoRGB(A, 60, S, L) }, new GradientStop() { Offset = 0.33333333, Color = HSL.HSLtoRGB(A, 120, S, L) }, new GradientStop() { Offset = 0.5, Color = HSL.HSLtoRGB(A, 180, S, L) }, new GradientStop() { Offset = 0.66666667, Color = HSL.HSLtoRGB(A, 240, S, L) }, new GradientStop() { Offset = 0.83333333, Color = HSL.HSLtoRGB(A, 300, S, L) }, new GradientStop() { Offset = 1, Color = HSL.HSLtoRGB(A, 0, S, L) }, }); }
public override GradientStopCollection GetSliderBrush(HSL HSL) { byte A = HSL.A; double H = HSL.H; double S = HSL.S; double L = HSL.L; return(new GradientStopCollection() { new GradientStop() { Offset = 0.0f, Color = HSL.HSLtoRGB(A, H, S, 0) }, new GradientStop() { Offset = 1.0f, Color = HSL.HSLtoRGB(A, H, S, 100) }, }); }
public override void Draw(CanvasControl CanvasControl, CanvasDrawingSession ds, HSL HSL, Vector2 Center, float SquareHalfWidth, float SquareHalfHeight) { //Palette Rect rect = new Rect(Center.X - SquareHalfWidth, Center.Y - SquareHalfHeight, SquareHalfWidth * 2, SquareHalfHeight * 2); using (CanvasLinearGradientBrush rainbow = new CanvasLinearGradientBrush(CanvasControl, this.BackgroundStops)) { rainbow.StartPoint = new Vector2(Center.X - SquareHalfWidth, Center.Y); rainbow.EndPoint = new Vector2(Center.X + SquareHalfWidth, Center.Y); ds.FillRoundedRectangle(rect, 4, 4, rainbow); } using (CanvasLinearGradientBrush brush = new CanvasLinearGradientBrush(CanvasControl, this.ForegroundStops)) { brush.StartPoint = new Vector2(Center.X, Center.Y - SquareHalfHeight); brush.EndPoint = new Vector2(Center.X, Center.Y + SquareHalfHeight); ds.FillRoundedRectangle(rect, 4, 4, brush); } ds.DrawRoundedRectangle(rect, 4, 4, Windows.UI.Colors.Gray); //Thumb float px = ((float)HSL.H - 180) * SquareHalfWidth / 180 + Center.X; float py = (50 - (float)HSL.S) * SquareHalfHeight / 50 + Center.Y; ds.DrawCircle(px, py, 8, Windows.UI.Colors.Black, 4); ds.DrawCircle(px, py, 8, Windows.UI.Colors.White, 2); }
public override int GetValue(HSL HSL) => (int)HSL.L;
public override HSL GetHSL(HSL HSL, int value) => new HSL(HSL.A, HSL.H, HSL.S, value);
public override void Draw(CanvasControl CanvasControl, CanvasDrawingSession ds, HSL HSL, Vector2 Center, float SquareHalfWidth, float SquareHalfHeight) { //Palette Rect rect = new Rect(Center.X - SquareHalfWidth, Center.Y - SquareHalfHeight, SquareHalfWidth * 2, SquareHalfHeight * 2); ds.FillRoundedRectangle(rect, 4, 4, new CanvasLinearGradientBrush(CanvasControl, Windows.UI.Colors.White, HSL.HSLtoRGB(HSL.H)) { StartPoint = new Vector2(Center.X - SquareHalfWidth, Center.Y), EndPoint = new Vector2(Center.X + SquareHalfWidth, Center.Y) }); ds.FillRoundedRectangle(rect, 4, 4, new CanvasLinearGradientBrush(CanvasControl, Windows.UI.Colors.Transparent, Windows.UI.Colors.Black) { StartPoint = new Vector2(Center.X, Center.Y - SquareHalfHeight), EndPoint = new Vector2(Center.X, Center.Y + SquareHalfHeight) }); ds.DrawRoundedRectangle(rect, 4, 4, Windows.UI.Colors.Gray); //Thumb float px = ((float)HSL.S - 50) * SquareHalfWidth / 50 + Center.X; float py = (50 - (float)HSL.L) * SquareHalfHeight / 50 + Center.Y; ds.DrawCircle(px, py, 8, Windows.UI.Colors.Black, 4); ds.DrawCircle(px, py, 8, Windows.UI.Colors.White, 2); }
public override HSL GetHSL(HSL HSL, int value) => new HSL(HSL.A, value, HSL.S, HSL.L);
public abstract HSL Delta(HSL HSL, Vector2 v, float SquareHalfWidth, float SquareHalfHeight);
public abstract void Draw(CanvasControl CanvasControl, CanvasDrawingSession ds, HSL HSL, Vector2 Center, float SquareHalfWidth, float SquareHalfHeight);
public abstract GradientStopCollection GetSliderBrush(HSL HSL);
public abstract int GetValue(HSL HSL);
public abstract HSL GetHSL(HSL HSL, int value);