Как создать CGImageRef
от NSBitmapImageRep
? Или как я могу определить полный новый CGImageRef
так же, как NSBitmapImageRep
? Определение NSBitmapImageRep
отлично работает. Но мне нужно изображение как CGImageRef
.Как создать CGImageRef из NSBitmapImageRep?
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(), ...);
Пожалуйста, может кто-нибудь дать мне подсказку?