How to draw a hole into an arc ?

Shay Wilner 1,726 Reputation points
2023-12-28T12:07:50.35+00:00

Hello in platform xamarin android i draw 3 arc to get a disk with 3 colors.I try now to draw a hole i set paint colo

thepaint.Color = Android.Graphics.Color.DarkOrange;              thecanvas.DrawArc(0, 0, diameter, diameter, 0, 120, true, thepaint);               thepaint.Color = Android.Graphics.Color.Indigo;               thecanvas.DrawArc(0, 0, diameter, diameter, 120, 120, true, thepaint);                thepaint.Color = Android.Graphics.Color.DarkCyan;                thecanvas.DrawArc(0, 0, diameter, diameter,240, 120, true, thepaint);              thepaint.SetStyle(Paint.Style.Fill);             thepaint.Color = Android.Graphics.Color.Transparent;               thecanvas.DrawCircle(diameter / 2, diameter / 2, diameter / 4, thepaint);

r Screenshot_20231228_111451_plx

to transparent but i don't get any result instead the black fill circle to draw a transparent hole

C#

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Shay Wilner 1,726 Reputation points
    2023-12-29T11:50:58.4133333+00:00
    thepaint.Color = Android.Graphics.Color.DarkOrange;              thecanvas.DrawArc(0, 0, diameter, diameter, 0, 120, true, thepaint);               thepaint.Color = Android.Graphics.Color.Indigo;               thecanvas.DrawArc(0, 0, diameter, diameter, 120, 120, true, thepaint);                thepaint.Color = Android.Graphics.Color.DarkCyan;                thecanvas.DrawArc(0, 0, diameter, diameter,240, 120, true, thepaint);              thepaint.SetStyle(Paint.Style.Fill);             thepaint.Color = Android.Graphics.Color.Transparent;               thecanvas.DrawCircle(diameter / 2, diameter / 2, diameter / 4, thepaint);
    
    0 comments No comments

  2. Shay Wilner 1,726 Reputation points
    2023-12-29T11:53:03.1133333+00:00
    thepaint.Color = Android.Graphics.Color.DarkOrange;
                 thecanvas.DrawArc(0, 0, diameter, diameter, 0, 120, true, thepaint);
                  thepaint.Color = Android.Graphics.Color.Indigo;
                  thecanvas.DrawArc(0, 0, diameter, diameter, 120, 120, true, thepaint);
                   thepaint.Color = Android.Graphics.Color.DarkCyan;
                   thecanvas.DrawArc(0, 0, diameter, diameter,240, 120, true, thepaint);
                thepaint.SetStyle(Paint.Style.Fill);
                thepaint.Color = Android.Graphics.Color.Transparent;
                  thecanvas.DrawCircle(diameter / 2, diameter / 2, diameter / 4, thepaint);
    
    0 comments No comments

  3. Shay Wilner 1,726 Reputation points
    2023-12-29T11:55:37.5833333+00:00
      thepaint.Color = Android.Graphics.Color.DarkOrange;
    
         thecanvas.DrawArc(0, 0, diameter, diameter, 0, 120, true, thepaint);
    
          thepaint.Color = Android.Graphics.Color.Indigo;
    
          thecanvas.DrawArc(0, 0, diameter, diameter, 120, 120, true, thepaint);
    
           thepaint.Color = Android.Graphics.Color.DarkCyan;
    
           thecanvas.DrawArc(0, 0, diameter, diameter,240, 120, true, thepaint);
    
        thepaint.SetStyle(Paint.Style.Fill);
    
        thepaint.Color = Android.Graphics.Color.Transparent;
    
          thecanvas.DrawCircle(diameter / 2, diameter / 2, diameter / 4, thepaint);