Как я могу создать CGImageRef
из NSBitmapImageRep
? Или как я могу определить совершенно новый CGImageRef
так же, как NSBitmapImageRep
? Определение NSBitmapImageRep
работает нормально. Но мне нужно изображение как CGImageRef
.
unsigned char *plane = (unsigned char *)[data bytes]; // data = 3 bytes for each RGB pixel
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: &plane
pixelsWide: width
pixelsHigh: height
bitsPerSample: depth
samplesPerPixel: channel
hasAlpha: NO
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
//bitmapFormat: NSAlphaFirstBitmapFormat
bytesPerRow: channel * width
bitsPerPixel: channel * depth
];
Я понятия не имею, как создать CGImageRef
из NSBitmapImageRep
или как определить новый CGImageRef
:
CGImageRef imageRef = CGImageCreate(width, height, depth, channel*depth, channel*width, CGColorSpaceCreateDeviceRGB(), ... );
Пожалуйста, может кто-нибудь дать мне подсказку?