我怎样才能CGImageRef从一个创建一个NSBitmapImageRep?CGImageRef或者我如何以与 ?相同的方式定义一个全新的NSBitmapImageRep?a 的定义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
];
我不知道如何创建CGImageReffrom theNSBitmapImageRep或如何定义一个 new CGImageRef:
CGImageRef imageRef = CGImageCreate(width, height, depth, channel*depth, channel*width, CGColorSpaceCreateDeviceRGB(), ... );
拜托,有人可以给我一个提示吗?