Exemple #1
0
        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);
Exemple #6
0
        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);
        }
Exemple #7
0
 public override HSL GetHSL(HSL HSL, int value) => new HSL(HSL.A, value, HSL.S, HSL.L);
Exemple #8
0
 public abstract HSL Delta(HSL HSL, Vector2 v, float SquareHalfWidth, float SquareHalfHeight);
Exemple #9
0
 public abstract void Draw(CanvasControl CanvasControl, CanvasDrawingSession ds, HSL HSL, Vector2 Center, float SquareHalfWidth, float SquareHalfHeight);
Exemple #10
0
 public abstract GradientStopCollection GetSliderBrush(HSL HSL);
Exemple #11
0
 public abstract int GetValue(HSL HSL);
Exemple #12
0
 public abstract HSL GetHSL(HSL HSL, int value);