/**
UIImage 支持的文件类型(.tiff .jpg .png .gif .bmp .ico .cur .xbm)
UIImage 会在动在内存紧张时,清楚本类缓存的图片资源(创建的对象本身不会消失),当程序再次执行该对象时,会重新加载!
*/
- (void)image{
UIImage *img ;
[UIImage imageNamed:@""];//有缓存
[UIImage imageWithContentsOfFile:@""];//加载指定文件名的图片
/**
使用CIimage 返回UIimage
@param orientation 对图片执行旋转、镜像等操作
*/
[UIImage imageWithCGImage:nil scale:0 orientation:nil];
//UIImage 定时加载多张图片,提供了两个方法
/**
animatedImageNamed:根据指定图片数组的名字记载,例如:name为img,该方法会自动加载img0.png,img1.png,img2.png等
*/
// [UIImage animatedImageNamed:<#(nonnull NSString *)#> duration:<#(NSTimeInterval)#>]
/**
该方法使用叫简单,方便NSArray存入的是UIimage的对象
*/
// [UIImage animatedImageWithImages:<#(nonnull NSArray<UIImage *> *)#> duration:<#(NSTimeInterval)#>]
}
/**
UIimage 的API已经能够满足,大部分的需求,但是要细化处理图片,则要使用CGImageRef
*/
- (void)CGImage{
UIImage *img;
CGImageRef ciImg = [img CGImage];
}
- (void)Quart_2D{
// Quart_2D 的核心API的关键是CGcontentRef 的获取 及相关联方法的调用
//1、自定义UIView的对象,可以在drawRect 里面获取
// CGContextRef ctx = UIGraphicsGetCurrentContext();
// 2、若不在drawRect方法下,则要自己去创建
UIGraphicsBeginImageContextWithOptions(CGSizeZero, NO, 1.0);
UIGraphicsBeginImageContext(CGSizeZero);
}
CGContextRef相关API详解
此节只是简单图形的绘制,若要绘制复杂图片需要使用CGPathRef,将在下节详细给出