> On 21 Dec 2015, at 09:15, Graham Cox <graham....@bigpond.com> wrote:
> 
> I’m trying to understand how properly to use colorspaces with bitmaps.
> 
> The problem here is that I can find no documentation that goes anywhere near 
> explaining this. Maybe NSBitmapImageRep is too high level and I need to drop 
> down to CGImageRef? That class does seem to take a specific CGColorSpace 
> object, though how I get there from +[NSColorSpace availableColorSpecs] is 
> unclear.

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. 

I can’t offer much for the rest of the questions, those hard-coded strings 
don’t mean much to me, I can’t see quite what you’d get if you passed the 
‘custom’ string without being able to pass the actual custom one, which you 
can’t. Retagging and conversion probably do exactly what the names suggest and 
conversion probably does take up more memory and retagging probably goes 
in-place, hence the restriction on using the same type of colorspace. 

Having come from the iOS world, if I ever need any kind of bitmap or other 
low-level CG thing, I go right for the CG classes because the NS ones often 
don’t exist, I’ve found them to be pretty full-featured. 

> 
> Am I even asking sensible questions? This sort of impedance mismatch usually 
> suggests a conceptual misunderstanding somewhere, but without a clear 
> explanation of how colorspaces and bitmaps are used, I can’t see where I may 
> have gone wrong.
> 
> Anyone able to illuminate?
> 
> —Graham
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
> 
> This email sent to r...@rols.org


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to