//// UIGraphics.h// UIKit//// Copyright (c) 2005-2017 Apple Inc. All rights reserved.//#import#import #import NS_ASSUME_NONNULL_BEGIN@class UIImage;//获取上下文UIKIT_EXTERN CGContextRef __nullable UIGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED;//切换到全新的contextUIKIT_EXTERN void UIGraphicsPushContext(CGContextRef context);//将全新的context切换到之前的上下文UIKIT_EXTERN void UIGraphicsPopContext(void);//当前图形上下文中填充矩形区域 混合效果blendModeUIKIT_EXTERN void UIRectFillUsingBlendMode(CGRect rect, CGBlendMode blendMode);//填充指定的区域UIKIT_EXTERN void UIRectFill(CGRect rect);//围绕指定矩形内部区域绘制一个框架 混合效果blendModeUIKIT_EXTERN void UIRectFrameUsingBlendMode(CGRect rect, CGBlendMode blendMode);//围绕指定矩形内部区域绘制一个框架UIKIT_EXTERN void UIRectFrame(CGRect rect);//修改与当前剪切路径相交的矩形区域UIKIT_EXTERN void UIRectClip(CGRect rect);// UIImage context//创建一个图形上下文UIKIT_EXTERN void UIGraphicsBeginImageContext(CGSize size);//创建一个图形上下文 大小、是否透明、缩放系数UIKIT_EXTERN void UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) NS_AVAILABLE_IOS(4_0);//获取图形上下文的内容的图片UIKIT_EXTERN UIImage* __nullable UIGraphicsGetImageFromCurrentImageContext(void);//从栈顶移除当前图形上下文UIKIT_EXTERN void UIGraphicsEndImageContext(void);// PDF context//创建一个PDF图形上下文UIKIT_EXTERN BOOL UIGraphicsBeginPDFContextToFile(NSString *path, CGRect bounds, NSDictionary * __nullable documentInfo) NS_AVAILABLE_IOS(3_2);UIKIT_EXTERN void UIGraphicsBeginPDFContextToData(NSMutableData *data, CGRect bounds, NSDictionary * __nullable documentInfo) NS_AVAILABLE_IOS(3_2);//关闭PDF图形上下文UIKIT_EXTERN void UIGraphicsEndPDFContext(void) NS_AVAILABLE_IOS(3_2);//在PDF图形上下文中标记一个新的页面//发出任何绘制命令之前,你必须要调用这个方法或者 UIGraphicsBeginPDFPageWithInfo 这个方法。UIKIT_EXTERN void UIGraphicsBeginPDFPage(void) NS_AVAILABLE_IOS(3_2);UIKIT_EXTERN void UIGraphicsBeginPDFPageWithInfo(CGRect bounds, NSDictionary * __nullable pageInfo) NS_AVAILABLE_IOS(3_2);//返回PDF图形上下文的boundsUIKIT_EXTERN CGRect UIGraphicsGetPDFContextBounds(void) NS_AVAILABLE_IOS(3_2);//链接当前页面上的矩形区域到指定的URL地址,点击rect区域将会打开url链接UIKIT_EXTERN void UIGraphicsSetPDFContextURLForRect(NSURL *url, CGRect rect) NS_AVAILABLE_IOS(3_2);//在当前页面创建一个跳转目的地UIKIT_EXTERN void UIGraphicsAddPDFContextDestinationAtPoint(NSString *name, CGPoint point) NS_AVAILABLE_IOS(3_2);//链接当前页面上的一个矩形到指定的跳转目的地UIKIT_EXTERN void UIGraphicsSetPDFContextDestinationForRect(NSString *name, CGRect rect) NS_AVAILABLE_IOS(3_2);NS_ASSUME_NONNULL_END