Help Me With iPhone Dev Graphics Question, Please

Usually when I learn a new programming language or framework, I am plagued by the fact that I can’t think of anything to build with it, or I can only think of things that are too difficult. With iPhone development, I have two ideas for apps, both of which should be fairly easy to write. I’ve gotten a good start on the first app, but now I’ve hit a roadblock, and I’ve been stuck here for a while. I thought I’d ask for help.

Obviously I can’t disclose too much of what the app does, since I do eventually want to sell it in the App Store. Essentially, it allows for a very specific type of photo manipulation. I’ve got the basic UI built, and I’ve hooked into the camera framework, so you can either take a new photo, or use one you already took. I am displaying the photo in the main window, currently scaled to fit, but I will eventually add zoom and pan. I have the code written that allows the user to define a region of the photo to work on, by drawing a rectangle or ellipse. I draw the shape using Quartz 2D, which results in a red rectangle or ellipe drawn on top of the photo. So far, so good.

This is where I’m stuck. I need to do “something” to the bits in the photo in the region defined by the rectangle or ellipse and, at some point, a freehand shape. (Obviously I can’t reveal what the “something” is.) So, I have looked through the Quartz 2D docs and am trying to figure out how I can

  1. get the bits in the region defined by the user’s drawing
  2. swizzle the bits with my secret sauce to produce the desired effect
  3. get the swizzled bits back into the photo for display to the user

And here I sit. I have never done anything with graphics before, so this is all completely foreign to me. I can’t see how to do any of those three steps.

The next question, then, is should I be using OpenGL ES instead of Quartz 2D? The iPhone dev book I have taught a little bit of both, and the OpenGL stuff looked far more complicated than Quartz, which seemed like overkill for my situation. I don’t know.

I think I can accomplish what I want by creating an image mask, applying that to my original image, and then displaying the new image, but the mask creation function, CGImageMaskCreate, has me confused. I get most of the parameters, but I don’t understand the CGDataProviderRef parameter. Can anyone offer any sort of pointers to get me moving again? Are there any really in-depth Quartz 2D tutorials? The Apple docs on Quartz that I’ve read are very basic, and don’t really give examples.

Thanks for any help or pointers. I know I haven’t given you much to work with.