iphone 2d绘图新手问题
我已经为 iPhone 编程几个月了,商店里已经有 3 个应用程序了。
不过,我还没有在该平台上做过任何类型的图形编程。
鉴于我正计划启动我的第五个应用程序(第四个应用程序正在接受苹果的审查),我想询问一些关于在哪里获取这方面信息的指示(已经谷歌搜索了一段时间,但没有任何内容符合我正在寻找的内容)
我需要创建一个应用程序,可以将菜单中的一些形状(矩形、圆形、正方形,然后是一些复杂的形状)“拖放到”主窗口上。
这个想法是用户可以拖动它们。但是,我希望它们彼此“对齐”(有点像在 CAD 软件包中,圆的边缘有象限,可以对齐到绘图中的任何其他几何实体)。
因此,如果我在屏幕左侧有一个圆圈,在右侧有一个矩形,然后我移动该圆圈,如果我碰到矩形边缘,它就会停止向右移动。不是完全停止,而是对运动的连续性给予某种“阻力”。
另外,如果我有几个重叠的绘图,有没有办法“划分”它们(任何重叠都会成为其自身的形状,但会从构成重叠的任何其他形状中删除)?
这样做的原因是我需要计算绘图的面积(以及其他属性)
我正在考虑 CALayer 1, 2, 3,..., n 在另一个之上,每个都有一个绘图(与 CGPath?),这可能会或可能不会与其他重叠。
然后我需要以某种方式获取单个 CALayer 上所有这些的“投影”信息。
我在这里一无所知。
我应该研究一下 Quartz2D 吗? CALayer 和 CGPath 足够吗?
这不是为了游戏。只是我想到的一个工程应用。
任何帮助表示赞赏。
问候 DH
I've been programming the iphone for a couple of months now and have 3 apps in the store already.
However, I have not done any kind of graphics programming in the platform.
Given that I'm planning on starting my 5th app (the 4th is under Apple's review) I wanted to ask for some pointers as to where to get information for this (been googling for a while but nothing matches what I'm looking for)
I need to create an App where I can 'drop' some shapes from a menu (a rectangle, circle, squares, and then some complex shapes) onto a main window.
the idea is that the user can drag them around. BUT, I want them to 'snap' to each other (kind of like in a CAD package where a circle has quadrants on the edges that snap to any other geometry entity in the drawing).
So if I had a circle on the left of the screen and a rectangle on the right and then I move the circle around, it would stop moving to the right If I hit the rectangles edges. Not completely stop but giving some sort of 'resistance' to the continuity of the movement.
Also, if I have several overlapping drawings, is there a way to 'divide' them (any overlapping becomes a shape on itself but is removed from any other shape composing the overlap)?
The reason for this is that I need to calculate the area of the drawing (along with other properties)
I'm thinking of CALayer 1, 2, 3,..., n on of top of the other, each one with a drawing (with CGPath?), that may or may not overlap the others.
Then I need to somehow obtain information of the 'projection' of all those on a single CALayer.
I'm clueless here.
Should I look into Quartz2D? is CALayer and CGPath enough for this?
this is not for a game. Just an engineering application I have in mind.
Any help is appreciated.
regards
dh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iPhone 应用程序编程指南有一章是关于绘图< /a>.
通过查看 iPhone 中的相应讲座,您可能会得到一些想法,从哪里开始斯坦福大学的应用程序编程讲座。其中包括 iTunesU 上的高质量视频讲座(由 Apple 拍摄)、幻灯片和示例源代码。
iPhone Application Programming Guide has a chapter on drawing.
You might get some ideas where to start by looking at the appropriate lectures from iPhone Application Programming lectures at Stanford. They include hight quality video lectures (filmed by Apple) over at iTunesU, slides and example source code.