i need to draw the following image
灰色部分是我想在另一张图像上绘制的内容,我需要使用 CGContext 方法使用的代码是什么,我尝试使用 CGContextAddArc 但失败了,因为当我填充笔划时,中心空心也填充了灰色纹理。
任何帮助表示赞赏。
信息:我有完整的蓝色图像,我需要在蓝色图像上方添加半圆
Thanks
看一下填充路径 http://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_paths/dq_paths.html#//apple_ref/doc/uid/TP30001066-CH211-TPXREF106在核心图形文档中。基本上,您要做的就是在路径中添加两条弧线(外部和内部),然后使用 Core Graphics 填充规则来发挥您的优势。代码看起来像这样:
CGMutablePathRef path = CGPathCreateMutable();
// Add the outer arc to the path (as if you wanted to fill the entire circle)
CGPathMoveToPoint(path, ...);
CGPathAddArc(path, ...);
CGPathCloseSubpath(path);
// Add the inner arc to the path (later used to substract the inner area)
CGPathMoveToPoint(path, ...);
CGPathAddArc(path, ...);
CGPathCloseSubpath(path);
// Add the path to the context
CGContextAddPath(context, path);
// Fill the path using the even-odd fill rule
CGContextEOFillPath(context);
CGPathRelease(path);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)