public static CreateColorWithCorrectedLightness ( System.Color color, float correctionFactor ) : System.Color | ||
color | System.Color | /// Color to correct. /// |
correctionFactor | float | /// Correction factor, with a value between -1 and 1. Negative values /// create darker color, positive values lighter color. Zero value /// returns the current color. /// |
return | System.Color |
/// <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)); }
/// <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)); }