C # GDI + - delete just above bottom half of ellipse by gloss method

I have a gloss method and I am trying to get an inverted crescent effect. In the code below, I would like to delete just above the bottom half of this ellipse and then draw it. Does anyone know how I can do this?

PS. The gloss is also too white. I've tried tinkering with the alpha to no avail, does anyone know any tricks to make the shine more subtle? Thanks you

  /// <summary>
        /// Applies gloss to clock
        /// </summary>
        /// <param name="e"></param>
        private void DrawGloss(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            float x = ((float)_CenterX / 1.1F) / _PI;
            float y = ((float)_CenterY / 1.2F) / _PI;
            float width = ((this.ClientSize.Width / 2)) + _hourLength;
            float height = ((this.ClientSize.Height / 2)) + _hourLength;

            RectangleF glossRect = new RectangleF(
           x + (float)(width * 0.10),
           y + (float)(height * 0.07),
           (float)(width * .8),
           (float)(height * 0.4));


            LinearGradientBrush gradientBrush =
                new LinearGradientBrush(glossRect,
                Color.FromArgb((int)50, Color.Transparent),
                glossColor,
                LinearGradientMode.BackwardDiagonal);
            g.FillEllipse(gradientBrush, glossRect);


        }

      

+2


source to share


1 answer


FillPie can give you exactly half a circle. Otherwise, you'll have to use FillClosedCurve or FillPath to get just under half a circle, or draw a semicircle on an intermediate, slightly smaller bitmap and copy it back to the main bitmap using DrawImage.

For a more subtle glitter effect, I think you just need to change your LinearGradientBrush code to:



LinearGradientBrush gradientBrush =                
    new LinearGradientBrush(glossRect,                
    Color.Transparent,                
    Color.FromArgb((int)50, glossColor),                
    LinearGradientMode.BackwardDiagonal);

      

Your initial gradient went from fully transparent to full glossColor.

+4


source







All Articles