Example #1
0
        public ColorControl()
        {
            InitializeComponent();

            GradientService.InstantiateConstantObjects();

            using (Graphics graphics = Graphics.FromImage(_huGraphic))
            {
                graphics.PixelOffsetMode = PixelOffsetMode.Half;

                var rect = new Rectangle(0, 0, _huGraphic.Width, _huGraphic.Height);
                using (var brush = new LinearGradientBrush(rect,
                                                           Color.Transparent,
                                                           Color.Transparent,
                                                           LinearGradientMode.Vertical))
                {
                    var blend = new ColorBlend();
                    blend.Colors              = GradientService._colors;
                    blend.Positions           = GradientService._positions;
                    brush.InterpolationColors = blend;

                    graphics.FillRectangle(brush, rect);
                }
            }
        }
Example #2
0
        void DrawField(Graphics graphics)
        {
            switch (_csc.Cisco.DisplayCharacter)
            {
            // _csc is ColorSpaceControlHSL
            case 'H': GradientService.DrawField_hue(graphics, _slidecol); break;

            case 'S': GradientService.DrawField_sat(graphics, _ciscoval); break;

            case 'L': GradientService.DrawField_lit(graphics, _ciscoval); break;

            // _csc is ColorSpaceControlRGB
            case 'R': GradientService.DrawField_r(graphics, _ciscoval); break;

            case 'G': GradientService.DrawField_g(graphics, _ciscoval); break;

            case 'B': GradientService.DrawField_b(graphics, _ciscoval); break;
            }
        }