详解iPhone开发Quratz 2D学习

移动开发 iOS
本文介绍的是iPhone开发Quratz 2D学习,主要讲解的是如何来使用Quratz 2D,一起来看详细内容讲解。

iPhone开发Quratz 2D学习是本文要介绍的内容,主要讲解的是如何来使用Quratz 2D,一起来看详细内容。

1.graphics context(图形上下文)是一个不透明的数据类型(CGContextRef)。我们可以把graphics context想象成为一个绘图目标。有几种graphics context:bitmap graphics context,PDF graphics context,window graphics context,layer context。

2.IOS中获得graphics context是在方法drawRect:中,调用方法UIGraphicsGetCurrentContext得到上下文。drawRect:方法不需要调用super

  1. CGContextRef c = UIGraphicsGetCurrentContext(); 

3.调用方法CGContextMoveToPoint开始一个新的路径,

调用方法CGContextAddLineToPoint添加一个单一的线条。

4.When you want to construct a path in a graphics context, you signal Quartz by calling the function CGContextBeginPath . Next, you set the starting point for the first shape, or subpath, in the path by calling the function CGContextMoveToPoint. After you establish the first point, you can add lines, arcs, and curves to the path, keeping in mind the following:

Before you begin a new path, call the function CGContextBeginPath.

Lines, arcs, and curves are drawn starting at the current point. An empty path has no current point; you must call CGContextMoveToPoint to set the starting point for the first subpath or call a convenience function that implicitly does this for you.

When you want to close the current subpath within a path, call the function CGContextClosePath to connect a segment to the starting point of the subpath. Subsequent path calls begin a new subpath, even if you do not explicitly set a new starting point.

When you draw arcs, Quartz draws a line between the current point and the starting point of the arc.

Quartz routines that add ellipses and rectangles add a new closed subpath to the path.

You must call a painting function to fill or stroke the path because creating a path does not draw the path. See “Painting a Path” for detailed information.

小结:详解iPhone开发Quratz 2D学习的内容介绍完了,希望通过本文的学习能对你有所帮助!

责任编辑:zhaolei 来源: 互联网
相关推荐

2011-08-17 14:07:43

IOS开发Quartz 2D

2011-07-27 10:13:23

Cocos2D iPhone

2013-01-08 11:00:20

IBMdW

2012-12-24 09:11:58

iOSUnity3D

2011-07-27 11:14:37

iPhone UITableVie

2011-06-24 17:38:09

Qt 坐标 事件

2012-11-07 09:43:58

IBMdw

2011-04-25 14:36:24

Ubuntu Unit

2011-07-06 14:53:14

2011-07-20 14:04:46

Cocos2d iPhone 游戏

2011-07-27 13:57:36

iPhone 游戏 Cocos2d

2023-05-03 09:01:41

CanvasWebGL

2011-08-11 14:32:04

iPhone游戏Cocos2dActions

2012-05-07 14:25:16

HTML5

2011-08-11 14:22:47

iPhone游戏Cocos2D

2011-08-04 17:01:16

iPhone游戏开发 Cocos2d

2012-05-07 14:13:59

HTML5

2020-10-26 13:40:00

CascadingSt

2011-07-29 18:02:06

2022-05-23 10:26:10

人工智能机器学习机器视觉
点赞
收藏

51CTO技术栈公众号