Sorry if this is an easy one but a thorough search of the list archives and the web didn't yield anything of much help.
I'm trying to convert a CGImageRef returned from "[context createCGImage: img fromRect: imgRect]" to an NSImage so it can be used as the image in a drag operation but can't find any way to do the conversion.
The closest I've gotten is to attempt creating an NSBitmapImageRep using it's
"initWithBitmapDataPlanes:(unsigned char **)planes pixelsWide:(int)width pixelsHigh:(int)height bitsPerSample:(int)bps samplesPerPixel:(int)spp hasAlpha:(BOOL)alpha isPlanar:(BOOL)isPlanar colorSpaceName:(NSString *)colorSpaceName bytesPerRow:(int)rowBytes bitsPerPixel:(int)pixelBits"
method but since CFImageRef is an opaque type, there doesn't seem to be any way to get a pointer to the data or extract the name of the color space. Everything else has an accessor function.
Has anyone else tried to do this type of conversion? If so, how did you do it?
Thanks
Ken |