博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Quartz和UIKit坐标系
阅读量:7038 次
发布时间:2019-06-28

本文共 676 字,大约阅读时间需要 2 分钟。

hot3.png

Quartz和Uikit坐标系:

191730_DPVi_2621781.png

UIImage *image = [UIImage imageNamed:@"lx_20180118102017.png"];

UIGraphicsBeginImageContext(image.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextDrawImage(context, CGRectMake(0, 0, image.size.width, image.size.height), [image CGImage]);

image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageView *imageV = [[UIImageView alloc]initWithImage:image];

imageV.frame = self.view.bounds;

[self.view addSubview:imageV];

192037_Plpc_2621781.png

 

上下文中加入转换坐标系代码:

    CGContextRotateCTM(context, M_PI);

    CGContextScaleCTM(context, -1, 1);

    CGContextTranslateCTM(context, 0, -image.size.height);

192428_rZLP_2621781.png

 

转载于:https://my.oschina.net/HeroOneHY/blog/1618253

你可能感兴趣的文章
慎用mutableCopy
查看>>
Spring boot @Scheduled(cron = "* * * * * *") cron表达式详解
查看>>
每天一道算法题(1) ——不用乘除法求和1+2+…+n
查看>>
我是不是得了抑郁症?
查看>>
响应式布局
查看>>
论以结果为导向
查看>>
go:指针初步
查看>>
教你如何做需求调研:忽略极端情况
查看>>
[LeetCode] Fraction to Recurring Decimal
查看>>
请求返回时的Size/Content Time/Latency的区别
查看>>
spring+freemarker 乱码解决办法
查看>>
64位Redhat6.6未注册 ,yum改成 CentOS6.6 的方法
查看>>
模拟单选框,多选框
查看>>
实验 2 用机器指令和汇编指令编程
查看>>
es_Linux
查看>>
POJ2074:Line of Sight——题解
查看>>
python开发项目:学生选课系统
查看>>
起一个洋气一点的名字
查看>>
.net向android的转型(2)
查看>>
windows service 调试
查看>>