Ejemplo n.º 1
0
 /// <summary>
 ///   Gets the actual color used for rendering.
 /// </summary>
 public static Color GetRenderingColor(EdgeColorType edgeColorType, Color color) {
     Debug.Assert(color != Color.Empty);
     if (edgeColorType == EdgeColorType.Contrast || edgeColorType == EdgeColorType.EnhancedContrast)
         edgeColorType = GetContrastColorType(color, edgeColorType);
     float correctionFactor = 0;
     switch (edgeColorType) {
     case EdgeColorType.SystemColor:
         return SystemColors.WindowText;
     case EdgeColorType.SurfaceColor:
         return color;
     case EdgeColorType.FullContrast:
         return GetFullContrastColor(color);
     case EdgeColorType.DarkerThanSurface:
         correctionFactor = -ColorUtil.BrightnessEnhancementFactor1;
         break;
     case EdgeColorType.DarkerDarkerThanSurface:
         correctionFactor = -ColorUtil.BrightnessEnhancementFactor2;
         break;
     case EdgeColorType.LighterThanSurface:
         correctionFactor = +ColorUtil.BrightnessEnhancementFactor1;
         break;
     case EdgeColorType.LighterLighterThanSurface:
         correctionFactor = +ColorUtil.BrightnessEnhancementFactor2;
         break;
     case EdgeColorType.NoEdge:
         return System.Drawing.Color.Transparent;
     }
     return ColorUtil.CreateColorWithCorrectedLightness(color, correctionFactor);
 }
Ejemplo n.º 2
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given
 ///   bounds and visual style.
 /// </summary>
 /// <param name = "boundingRect">
 ///   Bounding rectangle used to draw the top surface of the slice.
 /// </param>
 /// <param name = "sliceHeight">
 ///   Pie slice height.
 /// </param>
 /// <param name = "startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name = "sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name = "surfaceColor">
 ///   Color used to render pie slice surface.
 /// </param>
 /// <param name = "shadowStyle">
 ///   Shadow style used in rendering.
 /// </param>
 /// <param name = "edgeColorType">
 ///   Edge color type used for rendering.
 /// </param>
 public PieSlice(RectangleF boundingRect, float sliceHeight, float startAngle, float sweepAngle,
                 Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType)
     : this(
         boundingRect.X, boundingRect.Y, boundingRect.Width, boundingRect.Height, sliceHeight, startAngle,
         sweepAngle, surfaceColor, shadowStyle, edgeColorType)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given
 ///   bounds and visual style.
 /// </summary>
 /// <param name = "xBoundingRect">
 ///   x-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name = "yBoundingRect">
 ///   y-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name = "widthBoundingRect">
 ///   Width of the rectangle that is used to draw the top surface of
 ///   the pie slice.
 /// </param>
 /// <param name = "heightBoundingRect">
 ///   Height of the rectangle that is used to draw the top surface of
 ///   the pie slice.
 /// </param>
 /// <param name = "sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name = "startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name = "sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name = "surfaceColor">
 ///   Color used to render pie slice surface.
 /// </param>
 /// <param name = "shadowStyle">
 ///   Shadow style used in rendering.
 /// </param>
 /// <param name = "edgeColorType">
 ///   Edge color type used for rendering.
 /// </param>
 /// <param name = "edgeLineWidth">
 ///   Edge line width.
 /// </param>
 public PieSlice(float xBoundingRect, float yBoundingRect, float widthBoundingRect,
                 float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle,
                 Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth)
     : this(xBoundingRect, yBoundingRect, widthBoundingRect, heightBoundingRect,
            sliceHeight, startAngle, sweepAngle, surfaceColor, shadowStyle, edgeColorType)
 {
     Pen.Width = edgeLineWidth;
 }
Ejemplo n.º 4
0
 /// <summary>
 ///   Creates a <c>PieSlice</c> object.
 /// </summary>
 /// <param name = "boundingRectLeft">
 ///   x-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name = "boundingRectTop">
 ///   y-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name = "boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of
 ///   the slice.
 /// </param>
 /// <param name = "boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of
 ///   the slice.
 /// </param>
 /// <param name = "sliceHeight">
 ///   Slice height.
 /// </param>
 /// <param name = "startAngle">
 ///   Starting angle.
 /// </param>
 /// <param name = "sweepAngle">
 ///   Sweep angle.
 /// </param>
 /// <param name = "color">
 ///   Color used for slice rendering.
 /// </param>
 /// <param name = "shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name = "edgeColorType">
 ///   Edge lines color type.
 /// </param>
 /// <param name = "edgeLineWidth">
 ///   Edge lines width.
 /// </param>
 /// <returns>
 ///   <c>PieSlice</c> object with given values.
 /// </returns>
 protected virtual PieSlice CreatePieSlice(float boundingRectLeft, float boundingRectTop, float boundingRectWidth,
                                           float boundingRectHeight, float sliceHeight, float startAngle,
                                           float sweepAngle, Color color, ShadowStyle shadowStyle,
                                           EdgeColorType edgeColorType, float edgeLineWidth)
 {
     return(new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight,
                         startAngle % 360, sweepAngle, color, shadowStyle, edgeColorType, edgeLineWidth));
 }
Ejemplo n.º 5
0
        /// <summary>
        ///   Creates highlighted <c>PieSlice</c> object.
        /// </summary>
        /// <param name="boundingRectLeft">
        ///   x-coordinate of the upper-left corner of the rectangle that is
        ///   used to draw the top surface of the slice.
        /// </param>
        /// <param name="boundingRectTop">
        ///   y-coordinate of the upper-left corner of the rectangle that is
        ///   used to draw the top surface of the slice.
        /// </param>
        /// <param name="boundingRectWidth">
        ///   Width of the rectangle that is used to draw the top surface of
        ///   the slice.
        /// </param>
        /// <param name="boundingRectHeight">
        ///   Height of the rectangle that is used to draw the top surface of
        ///   the slice.
        /// </param>
        /// <param name="sliceHeight">
        ///   Slice height.
        /// </param>
        /// <param name="startAngle">
        ///   Starting angle.
        /// </param>
        /// <param name="sweepAngle">
        ///   Sweep angle.
        /// </param>
        /// <param name="color">
        ///   Color used for slice rendering.
        /// </param>
        /// <param name="shadowStyle">
        ///   Shadow style used for slice rendering.
        /// </param>
        /// <param name="edgeColorType">
        ///   Edge lines color type.
        /// </param>
        /// <param name="edgeLineWidth">
        ///   Edge lines width.
        /// </param>
        /// <returns>
        ///   <c>PieSlice</c> object with given values.
        /// </returns>
        private static PieSlice CreatePieSliceHighlighted(float boundingRectLeft, float boundingRectTop,
                                                          float boundingRectWidth, float boundingRectHeight, float sliceHeight,
                                                          float startAngle, float sweepAngle, Color color,
                                                          ShadowStyle shadowStyle, EdgeColorType edgeColorType,
                                                          float edgeLineWidth)
        {
            Color highLightedColor = ColorUtil.CreateColorWithCorrectedLightness(color, ColorUtil.BrightnessEnhancementFactor1);

            return(new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight,
                                startAngle, sweepAngle, highLightedColor, shadowStyle, edgeColorType,
                                edgeLineWidth));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the type of the contrast color.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="colorType">Type of the color.</param>
        /// <returns></returns>
        private static EdgeColorType GetContrastColorType(Color color, EdgeColorType colorType)
        {
            Debug.Assert(colorType == EdgeColorType.Contrast || colorType == EdgeColorType.EnhancedContrast);
            if (color.GetBrightness() > BrightnessThreshold)
            {
                return(colorType == EdgeColorType.Contrast
                    ? EdgeColorType.DarkerThanSurface
                    : EdgeColorType.DarkerDarkerThanSurface);
            }

            return(colorType == EdgeColorType.Contrast
                ? EdgeColorType.LighterThanSurface
                : EdgeColorType.LighterLighterThanSurface);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the type of the contrast color.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="colorType">Type of the color.</param>
        /// <returns></returns>
        private static EdgeColorType GetContrastColorType(Color color, EdgeColorType colorType)
        {
            Debug.Assert(colorType == EdgeColorType.Contrast || colorType == EdgeColorType.EnhancedContrast);
            if (color.GetBrightness() > BrightnessThreshold)
            {
                return colorType == EdgeColorType.Contrast
                    ? EdgeColorType.DarkerThanSurface
                    : EdgeColorType.DarkerDarkerThanSurface;
            }

            return colorType == EdgeColorType.Contrast
                ? EdgeColorType.LighterThanSurface
                : EdgeColorType.LighterLighterThanSurface;
        }
Ejemplo n.º 8
0
        /// <summary>
        ///   Initializes a new instance of <c>PieSlice</c> class with given
        ///   bounds and visual style.
        /// </summary>
        /// <param name = "xBoundingRect">
        ///   x-coordinate of the upper-left corner of the rectangle that is
        ///   used to draw the top surface of the pie slice.
        /// </param>
        /// <param name = "yBoundingRect">
        ///   y-coordinate of the upper-left corner of the rectangle that is
        ///   used to draw the top surface of the pie slice.
        /// </param>
        /// <param name = "widthBoundingRect">
        ///   Width of the rectangle that is used to draw the top surface of
        ///   the pie slice.
        /// </param>
        /// <param name = "heightBoundingRect">
        ///   Height of the rectangle that is used to draw the top surface of
        ///   the pie slice.
        /// </param>
        /// <param name = "sliceHeight">
        ///   Height of the pie slice.
        /// </param>
        /// <param name = "startAngle">
        ///   Starting angle (in degrees) of the pie slice.
        /// </param>
        /// <param name = "sweepAngle">
        ///   Sweep angle (in degrees) of the pie slice.
        /// </param>
        /// <param name = "surfaceColor">
        ///   Color used to paint the pie slice.
        /// </param>
        /// <param name = "shadowStyle">
        ///   Shadow style used for slice rendering.
        /// </param>
        /// <param name = "edgeColorType">
        ///   Edge color style used for slice rendering.
        /// </param>
        public PieSlice(float xBoundingRect, float yBoundingRect, float widthBoundingRect,
                        float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle,
                        Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType)
        {
            // set some persistent values
            _actualStartAngle = startAngle;
            _actualSweepAngle = sweepAngle;
            _surfaceColor     = surfaceColor;
            _shadowStyle      = shadowStyle;
            // create pens for rendering
            var edgeLineColor = EdgeColor.GetRenderingColor(edgeColorType, surfaceColor);

            Pen = new Pen(edgeLineColor)
            {
                LineJoin = LineJoin.Round
            };
            InitializePieSlice(xBoundingRect, yBoundingRect, widthBoundingRect, heightBoundingRect, sliceHeight);
        }
Ejemplo n.º 9
0
        /// <summary>
        ///   Gets the actual color used for rendering.
        /// </summary>
        public static Color GetRenderingColor(EdgeColorType edgeColorType, Color color)
        {
            Debug.Assert(color != Color.Empty, "color != Color.Empty");
            if (edgeColorType is (EdgeColorType.Contrast or EdgeColorType.EnhancedContrast))
            {
                edgeColorType = GetContrastColorType(color, edgeColorType);
            }

            float correctionFactor = 0;

            switch (edgeColorType)
            {
            case EdgeColorType.SystemColor:
                return(SystemColors.WindowText);

            case EdgeColorType.SurfaceColor:
                return(color);

            case EdgeColorType.FullContrast:
                return(GetFullContrastColor(color));

            case EdgeColorType.DarkerThanSurface:
                correctionFactor = -ColorUtil.BrightnessEnhancementFactor1;
                break;

            case EdgeColorType.DarkerDarkerThanSurface:
                correctionFactor = -ColorUtil.BrightnessEnhancementFactor2;
                break;

            case EdgeColorType.LighterThanSurface:
                correctionFactor = +ColorUtil.BrightnessEnhancementFactor1;
                break;

            case EdgeColorType.LighterLighterThanSurface:
                correctionFactor = +ColorUtil.BrightnessEnhancementFactor2;
                break;

            case EdgeColorType.NoEdge:
                return(Color.Transparent);
            }

            return(ColorUtil.CreateColorWithCorrectedLightness(color, correctionFactor));
        }
Ejemplo n.º 10
0
 /// <summary>
 ///   Initializes an empty instance of <c>PieChart3D</c>.
 /// </summary>
 private PieChart3D()
 {
     m_fitToBoundingRectangle = true;
     m_shadowStyle            = ShadowStyle.NoShadow;
     m_colors = new[]
     {
         Color.Red,
         Color.Green,
         Color.Blue,
         Color.Yellow,
         Color.Purple,
         Color.Olive,
         Color.Navy,
         Color.Aqua,
         Color.Lime,
         Color.Maroon,
         Color.Teal,
         Color.Fuchsia
     };
     m_font          = System.Windows.Forms.Control.DefaultFont;
     m_foreColor     = SystemColors.WindowText;
     m_edgeColorType = EdgeColorType.SystemColor;
     m_edgeLineWidth = 1F;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Sets the edge color type.
 /// </summary>
 /// <param name="edgeColorType">Type of the edge color.</param>
 public void ColorTypeOfEdge(EdgeColorType edgeColorType)
 {
     m_edgeColorType = edgeColorType;
     Invalidate();
 }
Ejemplo n.º 12
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="boundingRectX">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectY">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to paint the pie slice.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color style used for slice rendering.
 /// </param>
 public PieSlice(float boundingRectX, float boundingRectY, float boundingRectWidth, float boundingRectHeight,
     float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle,
     EdgeColorType edgeColorType)
     : this()
 {
     // set some persistent values
     m_actualStartAngle = startAngle;
     m_actualSweepAngle = sweepAngle;
     m_surfaceColor = surfaceColor;
     m_shadowStyle = shadowStyle;
     m_edgeColorType = edgeColorType;
     // create pens for rendering
     Color edgeLineColor = EdgeColor.GetRenderingColor(edgeColorType, surfaceColor);
     using (Pen pen = new Pen(edgeLineColor))
     {
         pen.LineJoin = LineJoin.Round;
         m_pen = (Pen)pen.Clone();
     }
     InitializePieSlice(boundingRectX, boundingRectY, boundingRectWidth, boundingRectHeight, sliceHeight);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Sets the edge color type.
 /// </summary>
 /// <param name="edgeColorType">Type of the edge color.</param>
 public void ColorTypeOfEdge(EdgeColorType edgeColorType)
 {
     m_edgeColorType = edgeColorType;
     Invalidate();
 }
Ejemplo n.º 14
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="boundingRectX">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectY">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to render pie slice surface.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used in rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color type used for rendering.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge line width.
 /// </param>
 public PieSlice(float boundingRectX, float boundingRectY, float boundingRectWidth, float boundingRectHeight,
     float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle,
     EdgeColorType edgeColorType, float edgeLineWidth)
     : this(
         boundingRectX, boundingRectY, boundingRectWidth, boundingRectHeight, sliceHeight, startAngle, sweepAngle,
         surfaceColor, shadowStyle, edgeColorType)
 {
     m_pen.Width = edgeLineWidth;
 }
Ejemplo n.º 15
0
 /// <summary>
 ///   Sets the edge color type.
 /// </summary>
 public void SetEdgeColorType(EdgeColorType value)
 {
     _edgeColorType = value;
     Invalidate();
 }
Ejemplo n.º 16
0
 /// <summary>
 ///   Sets the edge color type.
 /// </summary>
 public void SetEdgeColorType(EdgeColorType value)
 {
     _edgeColorType = value;
     Invalidate();
 }
Ejemplo n.º 17
0
 /// <summary>
 ///   Creates a <c>PieSlice</c> object.
 /// </summary>
 /// <param name="boundingRectLeft">
 ///   x-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectTop">
 ///   y-coordinate of the upper-left corner of the rectangle that is
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of
 ///   the slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of
 ///   the slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Slice height.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle.
 /// </param>
 /// <param name="color">
 ///   Color used for slice rendering.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge lines color type.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge lines width.
 /// </param>
 /// <returns>
 ///   <c>PieSlice</c> object with given values.
 /// </returns>
 private static PieSlice CreatePieSlice(float boundingRectLeft, float boundingRectTop, float boundingRectWidth,
                                        float boundingRectHeight, float sliceHeight, float startAngle, float sweepAngle,
                                        Color color, ShadowStyle shadowStyle, EdgeColorType edgeColorType,
                                        float edgeLineWidth)
 => new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight,
                 startAngle, sweepAngle, color, shadowStyle, edgeColorType, edgeLineWidth);
Ejemplo n.º 18
0
 /// <summary>
 ///   Creates a <c>PieSlice</c> object.
 /// </summary>
 /// <param name="boundingRectLeft">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectTop">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Slice height.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle.
 /// </param>
 /// <param name="color">
 ///   Color used for slice rendering.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge lines color type.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge lines width.
 /// </param>
 /// <returns>
 ///   <c>PieSlice</c> object with given values.
 /// </returns>
 protected virtual PieSlice CreatePieSlice(float boundingRectLeft, float boundingRectTop, float boundingRectWidth, float boundingRectHeight, float sliceHeight, float startAngle, float sweepAngle, Color color, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth) {
     return new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight, (float)(startAngle % 360), sweepAngle, color, shadowStyle, edgeColorType, edgeLineWidth);
 }
Ejemplo n.º 19
0
 /// <summary>
 ///   Initializes an empty instance of <c>PieChart3D</c>.
 /// </summary>
 private PieChart3D()
 {
     m_fitToBoundingRectangle = true;
     m_shadowStyle = ShadowStyle.NoShadow;
     m_colors = new[]
     {
         Color.Red,
         Color.Green,
         Color.Blue,
         Color.Yellow,
         Color.Purple,
         Color.Olive,
         Color.Navy,
         Color.Aqua,
         Color.Lime,
         Color.Maroon,
         Color.Teal,
         Color.Fuchsia
     };
     m_font = System.Windows.Forms.Control.DefaultFont;
     m_foreColor = SystemColors.WindowText;
     m_edgeColorType = EdgeColorType.SystemColor;
     m_edgeLineWidth = 1F;
 }
Ejemplo n.º 20
0
 /// <summary>
 ///   Sets slice edge color mode. If set to <c>PenColor</c> (default),
 ///   then value set by <c>EdgeColor</c> property is used.
 /// </summary>
 public void ColorTypeOfEdge(EdgeColorType edgeColorType)
 {
     m_edgeColorType = edgeColorType;
 }
Ejemplo n.º 21
0
 /// <summary>
 ///   Creates a <c>PieSlice</c> object.
 /// </summary>
 /// <param name="boundingRectLeft">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectTop">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Slice height.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle.
 /// </param>
 /// <param name="color">
 ///   Color used for slice rendering.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge lines color type.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge lines width.
 /// </param>
 /// <returns>
 ///   <c>PieSlice</c> object with given values.
 /// </returns>
 private static PieSlice CreatePieSlice(float boundingRectLeft, float boundingRectTop, float boundingRectWidth,
     float boundingRectHeight, float sliceHeight, float startAngle, float sweepAngle,
     Color color, ShadowStyle shadowStyle, EdgeColorType edgeColorType,
     float edgeLineWidth)
     => new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight,
         startAngle, sweepAngle, color, shadowStyle, edgeColorType, edgeLineWidth);
Ejemplo n.º 22
0
 /// <summary>
 ///   Creates highlighted <c>PieSlice</c> object.
 /// </summary>
 /// <param name="boundingRectLeft">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectTop">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Slice height.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle.
 /// </param>
 /// <param name="color">
 ///   Color used for slice rendering.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge lines color type.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge lines width.
 /// </param>
 /// <returns>
 ///   <c>PieSlice</c> object with given values.
 /// </returns>
 protected virtual PieSlice CreatePieSliceHighlighted(float boundingRectLeft, float boundingRectTop, float boundingRectWidth, float boundingRectHeight, float sliceHeight, float startAngle, float sweepAngle, Color color, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth) {
     Color highLightedColor = ColorUtil.CreateColorWithCorrectedLightness(color, ColorUtil.BrightnessEnhancementFactor1);
     return new PieSlice(boundingRectLeft, boundingRectTop, boundingRectWidth, boundingRectHeight, sliceHeight, (float)(startAngle % 360), sweepAngle, highLightedColor, shadowStyle, edgeColorType, edgeLineWidth);
 }
Ejemplo n.º 23
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="xBoundingRect">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="yBoundingRect">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="widthBoundingRect">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="heightBoundingRect">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to render pie slice surface.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used in rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color type used for rendering.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge line width.
 /// </param>
 public PieSlice(float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth) 
     : this (xBoundingRect, yBoundingRect, widthBoundingRect, heightBoundingRect, sliceHeight, startAngle, sweepAngle, surfaceColor, shadowStyle, edgeColorType) {
     m_pen.Width = edgeLineWidth;
 }
Ejemplo n.º 24
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="boundingRect">
 ///   Bounding rectangle used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Pie slice height.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to render pie slice surface.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used in rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color type used for rendering.
 /// </param>
 /// <param name="edgeLineWidth">
 ///   Edge line width.
 /// </param>
 public PieSlice(Rectangle boundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType, float edgeLineWidth) 
     : this(boundingRect.X, boundingRect.Y, boundingRect.Width, boundingRect.Height, sliceHeight, startAngle, sweepAngle, surfaceColor, shadowStyle, edgeColorType, edgeLineWidth) {
 }
Ejemplo n.º 25
0
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="xBoundingRect">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="yBoundingRect">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="widthBoundingRect">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="heightBoundingRect">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to paint the pie slice.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color style used for slice rendering.
 /// </param>
 public PieSlice(float xBoundingRect, float yBoundingRect, float widthBoundingRect, float heightBoundingRect, float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle, EdgeColorType edgeColorType) : this() {
     // set some persistent values
     m_actualStartAngle = startAngle;
     m_actualSweepAngle = sweepAngle;
     m_surfaceColor = surfaceColor;
     m_shadowStyle = shadowStyle;
     m_edgeColorType = edgeColorType;
     // create pens for rendering
     Color edgeLineColor = EdgeColor.GetRenderingColor(edgeColorType, surfaceColor);
     m_pen = new Pen(edgeLineColor);
     m_pen.LineJoin = LineJoin.Round;
     InitializePieSlice(xBoundingRect, yBoundingRect, widthBoundingRect, heightBoundingRect, sliceHeight);
 }
Ejemplo n.º 26
0
 /// <summary>
 ///   Sets slice edge color mode. If set to <c>PenColor</c> (default),
 ///   then value set by <c>EdgeColor</c> property is used.
 /// </summary>
 public void ColorTypeOfEdge(EdgeColorType edgeColorType)
 {
     m_edgeColorType = edgeColorType;
 }
Ejemplo n.º 27
0
 private static EdgeColorType GetContrastColorType(Color color, EdgeColorType colorType)
 {
     Debug.Assert(colorType == EdgeColorType.Contrast || colorType == EdgeColorType.EnhancedContrast);
     if (GetBrightness(color) > s_brightnessThreshold)
     {
         if (colorType == EdgeColorType.Contrast)
             return EdgeColorType.DarkerThanSurface;
         else
             return EdgeColorType.DarkerDarkerThanSurface;
     }
     if (colorType == EdgeColorType.Contrast)
         return EdgeColorType.LighterThanSurface;
     else
         return EdgeColorType.LighterLighterThanSurface;
 }