• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ColorSpace Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ColorSpace Question


  • Subject: Re: ColorSpace Question
  • From: Graham Cox <email@hidden>
  • Date: Fri, 8 Jan 2010 11:37:25 +1100

On 08/01/2010, at 10:51 AM, David Blanton wrote:

> I have been using
>
> CGContextRef    context;
> context = CGBitmapContextCreate (m_bitmap.m_array.m_array, m_bitmap.m_array.m_pixelsx, m_bitmap.m_array.m_pixelsy, 8, m_bitmap.m_array.m_pixelsx * 4, colorSpace,kCGImageAlphaNoneSkipFirst|kCGBitmapByteOrder32Host);
> CGImageRelease(m_BitmapImage);
> CGContextRelease(context);
> CGImageRetain(m_BitmapImage);
>
> Then
>
> CGContextDrawImage(cellViewContext, r, m_BitmapImage);
>
> and all is well.
>
>
> Now I use an NSBitMapImageRep and my colors are off
>
> 	m_ptrs[0] = (unsigned char*)m_bitmap.m_array;
> 	m_NSBitmapImageRep = [[NSBitmapImageRep alloc]
> 						  initWithBitmapDataPlanes:m_ptrs
> 						  pixelsWide:m_bitmap.m_pixelsx
> 						  pixelsHigh:m_bitmap.m_pixelsy
> 						  bitsPerSample:8
> 						  samplesPerPixel:3
> 						  hasAlpha:NO
> 						  isPlanar:NO
> 						  colorSpaceName:NSCalibratedRGBColorSpace
> 						  bitmapFormat:NSAlphaNonpremultipliedBitmapFormat|kCGBitmapByteOrder32Host
> 						  bytesPerRow:(4*m_bitmap.m_pixelsx)
> 						  bitsPerPixel:32];
> I am confused by this as m_bitmap.m_array is created identically in both examples


What is 'colorSpace' in the first code? Presumably it's not equivalent to NSCalibratedRGBColorSpace, which is what you use in the second one. Thus, colours are taken to be in the colour space assigned to the bitmap. If you use the same colour space for both, you should get the same appearance.

--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

References: 
 >ColorSpace Question (From: David Blanton <email@hidden>)

  • Prev by Date: Re: Optimizing View Drawing Code
  • Next by Date: Re: Problems Fading Out Music
  • Previous by thread: ColorSpace Question
  • Next by thread: Optimizing View Drawing Code
  • Index(es):
    • Date
    • Thread