Exemplo n.º 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.0f,
                    Color = HSL.HSLtoRGB(A, H, S, 0)
                },
                new GradientStop()
                {
                    Offset = 1.0f,
                    Color = HSL.HSLtoRGB(A, H, S, 100)
                },
            });
        }
Exemplo n.º 2
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)
                },
            });
        }
Exemplo n.º 3
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);
        }