iDevGames Forums
per pixel image manipulation (for iphone) - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: per pixel image manipulation (for iphone) (/thread-993.html)

per pixel image manipulation (for iphone) - oldmanwinter - Jul 17, 2009 11:30 AM

hi, i'm somewhat new to objective-c and mac programming- i've worked mostly with flash in the past, and have some questions. Basically, I want to be able to set the color of each pixel in an image manually, and was wondering if it's possible with objc. if anyones familiar with actionscript, it'd look something like this in AS3:

var image:BitmapData=new BitmapData(500,500);
var imagebm:Bitmap=new Bitmap(image);
(this would yield a box, with a black to red gradient going diagonally. this is just an example btw, what i actually want drawn is more complicated than this sort of gradient)

if anyone knows how to go about doing this and can point me in the right direction, i'd really appreciate it, thanks!

per pixel image manipulation (for iphone) - unknown - Jul 17, 2009 12:15 PM

Do you mean an NSImage, OpenGL or something else?

If you use Cocoa, then you can create an NSImage from an NSBitmapImageRep, the NSBitmapImageRep is similar to your AS code.