예제 #1
0
        /// <summary>
        /// Updates the color space coordinate values.
        /// </summary>
        /// <param name="csStructure">A IColorSpaceStructure object containing
        /// the values that are to be mapped to the coordinates of this color
        /// space.</param>

        protected override void UpdateValues(IColorSpaceStructure m_csStructure)
        {
            HSB hsb = ( HSB )m_csStructure;

            m_csHue.Value        = hsb.Hue;
            m_csSaturation.Value = hsb.Saturation;
            m_csBrightness.Value = hsb.Brightness;
        }
예제 #2
0
        /// <summary>
        /// Updates the color space coordinate values.
        /// </summary>
        /// <param name="csStructure">A IColorSpaceStructure object containing
        /// values that are to be mapped to the coordinates of this color
        /// space.</param>

        protected override void UpdateValues(IColorSpaceStructure csStructure)
        {
            RGB rgb = ( RGB )csStructure;

            m_csRed.Value   = rgb.Red;
            m_csGreen.Value = rgb.Green;
            m_csBlue.Value  = rgb.Blue;
        }
예제 #3
0
 /// <summary>
 /// Updates the color space coordinate values.
 /// </summary>
 /// <param name="csStructure">A IColorSpaceStructure object containing
 /// the coordinate values that the color space is to be updated with.</param>
 protected abstract void UpdateValues( IColorSpaceStructure csStructure );
예제 #4
0
        private Color CalculateSelectedColor(Point p)
        {
            IColorSpaceStructure selectedColor = null;

            if (m_colorSpace is HsbColorSpace)
            {
                HSB hsb = ( HSB )m_colorSpace.Structure;

                if (m_component == 'H')
                {
                    int brightness = ( int )((( double )255 - p.Y) / 2.55);
                    int saturation = ( int )(( double )p.X / 2.55);

                    selectedColor = new HSB(hsb.Hue, saturation, brightness);
                }
                else if (m_component == 'S')
                {
                    int hue        = ( int )(p.X * (( double )360 / 255));
                    int brightness = ( int )((( double )255 - p.Y) / 2.55);

                    if (hue == 360)
                    {
                        hue = 0;
                    }

                    selectedColor = new HSB(hue, hsb.Saturation, brightness);
                }
                else if (m_component == 'B')
                {
                    int hue        = ( int )(p.X * (( double )360 / 255));
                    int saturation = ( int )((( double )255 - p.Y) / 2.55);

                    if (hue == 360)
                    {
                        hue = 0;
                    }

                    selectedColor = new HSB(hue, saturation, hsb.Brightness);
                }
            }
            else if (m_colorSpace is RgbColorSpace)
            {
                RGB rgb = ( RGB )m_colorSpace.Structure;

                if (m_component == 'R')
                {
                    selectedColor = new RGB(rgb.Red, 255 - p.Y, p.X);
                }
                else if (m_component == 'G')
                {
                    selectedColor = new RGB(255 - p.Y, rgb.Green, p.X);
                }
                else if (m_component == 'B')
                {
                    selectedColor = new RGB(p.X, 255 - p.Y, rgb.Blue);
                }
            }

            RGB crgb;
            HSB hsbSelectedColor;

            if ((hsbSelectedColor = selectedColor as HSB) != null)
            {
                crgb = ColorConverter.HsbToRgb(hsbSelectedColor);
            }
            else
            {
                crgb = ( RGB )selectedColor;
            }

            return(ColorConverter.RgbToColor(crgb));
        }
예제 #5
0
        /// <summary>
        /// Updates the color space coordinate values.
        /// </summary>
        /// <param name="csStructure">A IColorSpaceStructure object containing 
        /// values that are to be mapped to the coordinates of this color 
        /// space.</param>
        protected override void UpdateValues( IColorSpaceStructure csStructure )
        {
            RGB rgb = ( RGB ) csStructure;

            m_csRed.Value = rgb.Red;
            m_csGreen.Value = rgb.Green;
            m_csBlue.Value = rgb.Blue;
        }
예제 #6
0
        /// <summary>
        /// Updates the color space coordinate values.
        /// </summary>
        /// <param name="csStructure">A IColorSpaceStructure object containing 
        /// the values that are to be mapped to the coordinates of this color 
        /// space.</param>
        protected override void UpdateValues( IColorSpaceStructure m_csStructure )
        {
            HSB hsb = ( HSB ) m_csStructure;

            m_csHue.Value = hsb.Hue;
            m_csSaturation.Value = hsb.Saturation;
            m_csBrightness.Value = hsb.Brightness;
        }
예제 #7
0
        /// <summary>
        /// Updates the color space coordinate values.
        /// </summary>
        /// <param name="csStructure">A IColorSpaceStructure object containing
        /// the coordinate values that the color space is to be updated with.</param>

        protected abstract void UpdateValues(IColorSpaceStructure csStructure);