How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?

Posted by Olie on Stack Overflow See other posts from Stack Overflow or by Olie
Published on 2009-01-15T19:30:26Z Indexed on 2010/03/13 3:17 UTC
Read the original article Hit count: 591

Filed under:
|
|

I have a UIImage (Cocoa Touch). From that, I'm happy to get a CGImage or anything else you'd like that's available. I'd like to write this function:

- (int)getRGBAFromImage:(UIImage *)image atX:(int)xx andY:(int)yy {
  // [...]
  // What do I want to read about to help
  // me fill in this bit, here?
  // [...]

  int result = (red << 24) | (green << 16) | (blue << 8) | alpha;
  return result;
}

Thanks!

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about cocoa