Answer the question
In order to leave comments, you need to log in
Shading part of "Yin-Yang" shape c#?
Hello everyone, I'm interested in what method you can paint over the drop-shaped part of the figure (black in the figure). I can’t understand, because I drew it with two arcs, and fillPie won’t fit accordingly ((
Answer the question
In order to leave comments, you need to log in
The easiest way is to alternate drawing in black and white - draw a black semicircle, then 4 circles and an outer circle. Something like this:
private static void DrawYinYang(Graphics gr,int xctr,int yctr,int rmax,int rint,int ysmall,int rsmall) {
Brush white=Brushes.White;
Brush black=Brushes.Black;
Pen BlackPen=new Pen(Color.Black,2*(rmax-rint));
gr.FillPie(black,xctr-rmax,yctr-rmax,2*rmax,2*rmax,-90,180);
gr.FillEllipse(white,xctr-rint/2,yctr-rint,rint,rint);
gr.FillEllipse(black,xctr-rint/2,yctr,rint,rint);
gr.FillEllipse(white,xctr-rsmall,yctr+ysmall-rsmall,2*rsmall,2*rsmall);
gr.FillEllipse(black,xctr-rsmall,yctr-ysmall-rsmall,2*rsmall,2*rsmall);
double rcircle=(rmax+rint)/2.0;
gr.DrawEllipse(BlackPen,(float)(xctr-rcircle),(float)(yctr-rcircle),(float)(2*rcircle),(float)(2*rcircle));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question