CGContextRef 的坐标系是什么意思样的?
问题说明
我假设原点在左下角,y 轴从 0 开始向上扩展.x 轴从 0 开始向右扩展.
I assume that the origin is on the bottom left, and the y-axis expands up, starting from 0. The x-axis expands to the right, starting from 0.
我只是问,因为我从我的绘图代码中得到了非常奇怪的结果......想确保我没有弄错这部分.
I just ask because I get very weird results from my drawing code... want to make sure that I didn't get this part wrong.
正确答案
这取决于使用此上下文的位置.Mac 上用于视图、图层和图像绘制的标准核心图形绘制上下文的左下坐标为 (0,0).
It depends on where this context is being used. The standard Core Graphics drawing context used on the Mac for view, layer, and image drawing has (0,0) for its bottom left coordinate.
iPhone 上的标准坐标系是倒置的,UIView 的左上角坐标为 (0,0).它的支持层也具有那些翻转的坐标,因此绘制到视图的上下文或其层从左上角的 (0,0) 开始.UIImage 上下文也以这种方式翻转,但 PDF 上下文不是.
The standard coordinate system on the iPhone is inverted, with the upper left coordinate for a UIView being (0,0). Its backing layer also has those flipped coordinates, so drawing into a context for the view or its layer starts at (0,0) for the upper left. UIImage contexts are also flipped in this manner, but PDF contexts are not.
所有这些都是 记录在 Apple 的 iPhone 编程指南中的各个位置,但整理起来可能有点混乱.
All of this is documented in various locations within Apple's iPhone programming guides, but it can be a bit confusing to sort out.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tangcbjgf
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
检查邮件是否发送成功
it1352 07-25 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22