Xcode image/pixel manipulation realtime

Go To StackoverFlow.com


Hi I'm looking to do the following: For a game, Create some effects based on the current view. The code needs to grab part of a view then manipulate it. One I need is "glass", so when the character walks behind the glass(or where the glass should be), the code will grab the image behind the glass and stretch it and reprint it where the glass should be, to give the effect of walking behind a lens.

What is the best way to do this?

I've never tried any thing like this before, so any help will be great!

2012-04-03 20:13
by Scott Walker
Xcode is just the name of the IDE - are you talking about CocoaTouch (iOS), Cocoa (OS X), Carbon, or what - Paul R 2012-04-03 20:33


I think you're asking about the image manipulation capabilities of the cocoa framework, in which case I reccomend looking into CoreImage:


The NSBox draws on top of the player view, the resulting composition gets a CIFilter (distortion) applied to it before drawing.

2012-04-03 20:52
by awiebe