views:

283

answers:

1

Hi All,

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

+1  A: 

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.

stefanB
I went through it before posting, but being new to drawing I still don't know if using Quartz is the proper approach, or even something like cocos-2d (even thought it's not a game). Also it does not give me an idea on how to get the total projection area.But thanks for the reply, i'll wait and see if someone else can throw a hint
dhomes