quartz2d 实现太极图
?先看效果圖
?
代碼如下
??CGContextRef contextRef = UIGraphicsGetCurrentContext();
? ? CGContextSetRGBStrokeColor(contextRef, 1.0f, 1.0f, 1.0f, 1);
? ? CGContextSetLineWidth(contextRef, 2.0f);
?? ?
?? ?
?
? ? CGFloat componets[] = {0.0f,0.0f,0.0f,1.0f};
? ? CGFloat componets1[] = {1.0f,1.0f,1.0f,1.0f};
?? ?
? ? CGContextSetFillColor(contextRef, componets);
? ? CGContextMoveToPoint(contextRef,160, 175);
? ? CGContextAddArc(contextRef, 160.0f, 175.0f, 125.0f, 0.0f*(M_PI/180), 180.0f*(M_PI/180), 1);
? ? CGContextFillPath(contextRef);
?? ?
? ? ?
? ? CGContextSetFillColor(contextRef, componets);
? ? CGContextFillEllipseInRect(contextRef, CGRectMake(66.25, 142.5, 62.5, 62.5));
?? ?
?? ?
?? ?
? ? CGContextSetFillColor(contextRef, componets);
? ? CGContextMoveToPoint(contextRef, 222.5, 175);
? ? CGContextAddArc(contextRef, 222.5, 175, 62.5, 0, 180*(M_PI/180), 0);
? ? CGContextFillPath(contextRef);
?? ?
?? ?
?? ?
? ? CGContextSetFillColor(contextRef, componets1);
? ? CGContextMoveToPoint(contextRef,160, 175);
? ? CGContextAddArc(contextRef, 160.0f, 175.0f, 125.0f, 0.0f*(M_PI/180), 180.0f*(M_PI/180), 0);
? ? CGContextFillPath(contextRef);
?? ?
? ? CGContextSetFillColor(contextRef, componets1);
? ? CGContextMoveToPoint(contextRef, 97.5, 175);
? ? CGContextAddArc(contextRef, 97.5, 175, 62.5, 0, 180*(M_PI/180), 1);
? ? CGContextFillPath(contextRef);
?? ?
? ? CGContextSetFillColor(contextRef, componets);
? ? CGContextFillEllipseInRect(contextRef, CGRectMake(66.25, 142.5, 62.5, 62.5));
?? ?
? ?
?? ?
? ? CGContextSetFillColor(contextRef, componets);
? ? CGContextMoveToPoint(contextRef, 222.5, 175);
? ? CGContextAddArc(contextRef, 222.5, 175, 62.5, 0, 180*(M_PI/180), 0);
? ? CGContextFillPath(contextRef);
?? ?
? ? CGContextSetFillColor(contextRef, componets1);
? ? CGContextFillEllipseInRect(contextRef, CGRectMake(190.25, 142.5, 62.5, 62.5));
轉載于:https://blog.51cto.com/demidroid/979430
總結
以上是生活随笔為你收集整理的quartz2d 实现太极图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java基础之理解Annotation
- 下一篇: ContentProvider简介