CGContextSaveGState(CGContextRef c)
按目前的图形状态的副本到图形状态栈。(路径不保存)
CGContextRestoreGState(CGContextRef c)
还原最近一次保存的图形状态
CGContextScaleCTM(CGContextRef c, CGFloat sx, CGFloat sy)
缩放当前图形状态的矩阵CGContextTranslateCTM(CGContextRef c, CGFloat tx, CGFloat ty)
平移当前的图形状态的矩阵CGContextRotateCTM(CGContextRef c, CGFloat angle)
旋转当前的图形状态的矩阵CGContextConcatCTM(CGContextRef c, CGAffineTransform transform)
串联 当前的图形状态的矩阵
CGContextSetLineWidth(CGContextRef c, CGFloat width)
设置线宽
CGContextSetLineCap(CGContextRef c, CGLineCap cap)
设置拐角(线帽)类型
CGContextSetLineJoin(CGContextRef c, CGLineJoin join)
设置行
CGContextSetMiterLimit(CGContextRef c, CGFloat limit)
设置转角限制
CGContextSetLineDash(CGContextRef c, CGFloat phase,
const CGFloat lengths[], size_t count)
设置行破折号
CGContextSetFlatness(CGContextRef c, CGFloat flatness)
设置平整度
CGContextSetAlpha(CGContextRef c, CGFloat alpha)
设置阴影度
CGContextSetBlendMode(CGContextRef context, CGBlendMode mode)
设置混合模式
CGContextBeginPath(CGContextRef c)
开始一个新的路径
CGContextMoveToPoint(CGContextRef c, CGFloat x, CGFloat y)
设置一个点在新的上下文路径
CGContextAddLineToPoint(CGContextRef c, CGFloat x, CGFloat y)
在路径上添加一条直线
CGContextAddCurveToPoint(CGContextRef c, CGFloat cp1x,
CGFloat cp1y, CGFloat cp2x, CGFloat cp2y, CGFloat x, CGFloat y)
绘制贝塞尔三次曲线CGContextAddQuadCurveToPoint(CGContextRef c, CGFloat cpx,
CGFloat cpy, CGFloat x, CGFloat y)
绘制贝塞尔二次曲线
CGContextClosePath(CGContextRef c)
关闭路径
CGContextAddRect(CGContextRef c, CGRect rect)
增加矩形
CGContextAddRects(CGContextRef c, const CGRect rects[],
size_t count)
添加一组矩形
CGContextAddLines(CGContextRef c, const CGPoint points[],
size_t count)
添加一组直线
CGContextAddEllipseInRect(CGContextRef context, CGRect rect)
在矩形里面添加一个椭圆CGContextAddArc(CGContextRef c, CGFloat x, CGFloat y,
CGFloat radius, CGFloat startAngle, CGFloat endAngle, int clockwise)
增加一个圆弧
CGContextAddArcToPoint(CGContextRef c, CGFloat x1, CGFloat y1,
CGFloat x2, CGFloat y2, CGFloat radius)
CGContextAddPath(CGContextRef context, CGPathRef path)
增加一个路径CGContextReplacePathWithStrokedPath(CGContextRef c)
更换路径
CGContextIsPathEmpty(CGContextRef context)
路径是否为空
CGPoint CGContextGetPathCurrentPoint(CGContextRef context)
返回路径的当前点
CGRect CGContextGetPathBoundingBox(CGContextRef context)
返回路径的边界框
CGPathRef CGContextCopyPath(CGContextRef context)
复制路径
bool CGContextPathContainsPoint(CGContextRef context, CGPoint point,
CGPathDrawingMode mode)
点是否包含再路径中
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode)
绘制路径
void CGContextFillPath(CGContextRef c)
填充路径
void CGContextEOFillPath(CGContextRef c)
使用奇偶来填充路径
void CGContextStrokePath(CGContextRef c)
给路径画线
void CGContextFillRect(CGContextRef c, CGRect rect)
填充矩形
void CGContextFillRects(CGContextRef c, const CGRect rects[],
size_t count)
填充矩形组void CGContextStrokeRect(CGContextRef c, CGRect rect)
矩形画线void CGContextStrokeRectWithWidth(CGContextRef c, CGRect rect,
CGFloat width)
矩形画线并设置线宽
void CGContextClearRect(CGContextRef c, CGRect rect)
清除矩形
void CGContextFillEllipseInRect(CGContextRef context, CGRect rect)
填充在矩形内的椭圆
void CGContextStrokeEllipseInRect(CGContextRef context, CGRect rect)
矩形内的椭圆画线void CGContextStrokeLineSegments(CGContextRef c,
const CGPoint points[], size_t count)
线段,点的数组
void CGContextClip(CGContextRef c)
根据图形上下文获取剪辑路径
void CGContextEOClip(CGContextRef c)
使用奇偶填充规则决定什么道内void CGContextClipToMask(CGContextRef c, CGRect rect,
CGImageRef mask)
CGRect CGContextGetClipBoundingBox(CGContextRef c)
void CGContextClipToRect(CGContextRef c, CGRect rect)
void CGContextClipToRects(CGContextRef c, const CGRect rects[],
size_t count)
/** Primitive color functions. **/
void CGContextSetFillColorWithColor(CGContextRef c, CGColorRef color)
设置填充颜色
void CGContextSetStrokeColorWithColor(CGContextRef c,
CGColorRef color)
设置画线颜色
/** Color space functions. **/
void CGContextSetFillColorSpace(CGContextRef context,
CGColorSpaceRef space)
设置控件填充颜色CGContextSetStrokeColorSpace(CGContextRef context,
CGColorSpaceRef space)
设置空间画线颜色
/** Color functions. **/
void CGContextSetFillColor(CGContextRef context,
const CGFloat components[])
void CGContextSetStrokeColor(CGContextRef context,
const CGFloat components[])
/** Pattern functions. **/
void CGContextSetFillPattern(CGContextRef context,
CGPatternRef pattern, const CGFloat components[])
void CGContextSetStrokePattern(CGContextRef context,
CGPatternRef pattern, const CGFloat components[])
void CGContextSetPatternPhase(CGContextRef context, CGSize phase)
/** Color convenience functions. **/
void CGContextSetGrayFillColor(CGContextRef context, CGFloat gray,
CGFloat alpha)
设置灰色填充颜色
void CGContextSetGrayStrokeColor(CGContextRef context, CGFloat gray,
CGFloat alpha)
设置灰色画线颜色
void CGContextSetRGBFillColor(CGContextRef context, CGFloat red,
CGFloat green, CGFloat blue, CGFloat alpha)
设置RGB填充颜色
void CGContextSetRGBStrokeColor(CGContextRef context, CGFloat red,
CGFloat green, CGFloat blue, CGFloat alpha)
设置RGB画线颜色
void CGContextSetCMYKFillColor(CGContextRef context, CGFloat cyan,
CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha)
(青色,洋红色,黄色,黑色, 阴影度)作为填充颜色。
void CGContextSetCMYKStrokeColor(CGContextRef context, CGFloat cyan,
CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha)
(青色,洋红色,黄色,黑色, 阴影度)作为画线颜色。
/** Rendering intent. **/
void CGContextSetRenderingIntent(CGContextRef context,
CGColorRenderingIntent intent)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/** Image functions. **/
void CGContextDrawImage(CGContextRef c, CGRect rect,
CGImageRef image)
void CGContextDrawTiledImage(CGContextRef c, CGRect rect,
CGImageRef image)
CGInterpolationQuality
CGContextGetInterpolationQuality(CGContextRef context)
void CGContextSetInterpolationQuality(CGContextRef context,
CGInterpolationQuality quality)
/** Shadow support. **/
void CGContextSetShadowWithColor(CGContextRef context, CGSize offset,
CGFloat blur, CGColorRef color)
void CGContextSetShadow(CGContextRef context, CGSize offset,
CGFloat blur)
/** Gradient and shading functions. **/
void CGContextDrawLinearGradient(CGContextRef context,
CGGradientRef gradient, CGPoint startPoint, CGPoint endPoint,
CGGradientDrawingOptions options)
void CGContextDrawRadialGradient(CGContextRef context,
CGGradientRef gradient, CGPoint startCenter, CGFloat startRadius,
CGPoint endCenter, CGFloat endRadius, CGGradientDrawingOptions options)
void CGContextDrawShading(CGContextRef context, CGShadingRef shading)
/** Text functions. **/
void CGContextSetCharacterSpacing(CGContextRef context,
CGFloat spacing)
void CGContextSetTextPosition(CGContextRef c, CGFloat x, CGFloat y)
CGPoint CGContextGetTextPosition(CGContextRef context)
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t)
CGAffineTransform CGContextGetTextMatrix(CGContextRef c)
void CGContextSetTextDrawingMode(CGContextRef c,
CGTextDrawingMode mode)
void CGContextSetFont(CGContextRef c, CGFontRef font)
void CGContextSetFontSize(CGContextRef c, CGFloat size)
void CGContextShowGlyphsAtPositions(CGContextRef context,
const CGGlyph glyphs[], const CGPoint positions[], size_t count)
void CGContextDrawPDFPage(CGContextRef c, CGPDFPageRef page)
/** Output page functions. **/
void CGContextBeginPage(CGContextRef c, const CGRect *mediaBox)
void CGContextEndPage(CGContextRef c)
/** Context functions. **/
CGContextRef CGContextRetain(CGContextRef c)
void CGContextRelease(CGContextRef c)
void CGContextFlush(CGContextRef c)
void CGContextSynchronize(CGContextRef c)
/** Antialiasing functions. **/
void CGContextSetShouldAntialias(CGContextRef context,
bool shouldAntialias)
void CGContextSetAllowsAntialiasing(CGContextRef context,
bool allowsAntialiasing)
/** Font display functions. **/
void CGContextSetShouldSmoothFonts(CGContextRef context,
bool shouldSmoothFonts)
void CGContextSetAllowsFontSmoothing(CGContextRef context,
bool allowsFontSmoothing)
void CGContextSetShouldSubpixelPositionFonts(CGContextRef context,
bool shouldSubpixelPositionFonts)
void CGContextSetAllowsFontSubpixelPositioning(CGContextRef context,
bool allowsFontSubpixelPositioning)
void CGContextSetShouldSubpixelQuantizeFonts(CGContextRef context,
bool shouldSubpixelQuantizeFonts)
void CGContextSetAllowsFontSubpixelQuantization(CGContextRef context,
bool allowsFontSubpixelQuantization)
/** Transparency layer support. **/
void CGContextBeginTransparencyLayer(CGContextRef context,
CFDictionaryRef auxiliaryInfo)
void CGContextBeginTransparencyLayerWithRect(CGContextRef context,
CGRect rect, CFDictionaryRef auxiliaryInfo)
void CGContextEndTransparencyLayer(CGContextRef context)
/** User space to device space tranformations. **/
CGAffineTransform
CGContextGetUserSpaceToDeviceSpaceTransform(CGContextRef context)
CGPoint CGContextConvertPointToDeviceSpace(CGContextRef context,
CGPoint point)
CGPoint CGContextConvertPointToUserSpace(CGContextRef context,
CGPoint point)
CGSize CGContextConvertSizeToDeviceSpace(CGContextRef context,
CGSize size)
CGSize CGContextConvertSizeToUserSpace(CGContextRef context,
CGSize size)
CGRect CGContextConvertRectToDeviceSpace(CGContextRef context,
CGRect rect)
CGRect CGContextConvertRectToUserSpace(CGContextRef context,
CGRect rect)
......未完待续