How can I make a crescent shape?
I want think make a crescent shape, and I was thinking of overlapping a fillArc over another fillArc, but I do not want that because the top layer would not 开发者_JAVA百科be transparent. Is there any other way?
Check the following link out: Clipping
(It references an instance of Graphics2D, but Graphics uses the same idea.)
Use setClip(Shape shape)
with an Ellipse shape.
The clip area is where graphics will not be drawn after the clip is set.
Then use a single call of fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
to draw your crescent shape.
精彩评论