[출처] http://rootnode.tistory.com/114
UIImage --> CGImageRef
CGImageCreateWithImageInRect 함수 사용
CGImageRef --> UIImage
UIImage 클래스의
+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage 메쏘드 사용
ex)
CGImageRef --> CGContextRef
http://www.drobnik.com/touch/2010/07/drawing-on-uiimages/를 참고한다.
CGContextRef newBitmapContextSuitableForSize(CGSize size)
- (UIImage *)imageByDrawingCircleOnImageCG:(UIImage *)image
를 보면 된다.
CGContextRef --> GImageRef
CGImageRef cgImage = CGBitmapContextCreateImage(ctx); //ctx가 CGContextRef type의 변수
CGImageRef --> pixel data
http://developer.apple.com/mac/library/qa/qa2007/qa1509.html
http://stackoverflow.com/questions/448125/how-to-get-pixel-data-from-a-uiimage-cocoa-touch-or-cgimage-core-graphics
http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone
요약하면,
CGContextRef를 먼저 만들고, 컨텍스트에 이미지를 그린 다음, 거기에서 pixel Data를 뽑아내야 한다.