• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

CGContextRef 的坐标系是什么意思样的?

用户头像
it1352
帮助7

问题说明

我假设原点在左下角,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.

正确答案

#1

这取决于使用此上下文的位置.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
系列文章
更多 icon
同类精品
更多 icon
继续加载