Re: Bitmaps, colorspaces, etc.
Re: Bitmaps, colorspaces, etc.
- Subject: Re: Bitmaps, colorspaces, etc.
- From: Graham Cox <email@hidden>
- Date: Mon, 21 Dec 2015 17:57:45 +1100
> On 21 Dec 2015, at 1:16 PM, Roland King <email@hidden> wrote:
>
> That bit seems straightforward, you get the CGColorSpace property of the NSColorSpace object returned by NSColorSpace.availableColorSpacesWithModel()
>
> But if you want a bitmap to draw in then CGImageRef doesn’t seem like the right thing, CGBitmapContext takes a CGColorSpace (as long as it’s not an indexed one). If you need to bridge back to NSBitmapImageRef you should be able to do that via the CGBitmapContext’s CGImage property which is probably more efficient than you might fear.
Great, I’m making some headway now. Thanks!
I’m not sure why I’d overlooked CGBitmapContextCreate - I guess having used the CGImageCreate stuff in the past I assumed that was the only API that created a raw image buffer in CG. Indeed, the CGBitmapContext kills several birds with one stone, and seems to work efficiently. I don’t need indexed colorspaces, RGB, CMYK and Gray are plenty enough.
—Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden