• 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
Bitmaps and color shift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bitmaps and color shift


  • Subject: Bitmaps and color shift
  • From: Trygve Inda <email@hidden>
  • Date: Fri, 28 Mar 2008 11:09:36 +0000
  • Thread-topic: Bitmaps and color shift

segImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
                       pixelsWide:5
                       pixelsHigh:5
                       bitsPerSample:8
                       samplesPerPixel:4
                       hasAlpha:YES
                       isPlanar:NO
                       colorSpaceName:NSDeviceRGBColorSpace
                       bitmapFormat:NSAlphaFirstBitmapFormat
                       bytesPerRow:5 * 4
                       bitsPerPixel:32];

segBaseAddr = [segImageRep bitmapData];

NSImage *  image = [NSImage imageNamed:@"colorNew.png"];

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithBitmapImageRep:segImageRep]];

image drawInRect:NSMakeRect(0,0,5,5) fromRect:NSMakeRect(0,0,5,5)
operation:NSCompositeCopy fraction:1.0];

NSGraphicsContext restoreGraphicsState];


When looking at the source image in PhotoShop (no color management in file),
the first row is (ignoring alpha).

FF FF 00    FF 00 00    00 00 00    00 00 FF    FF FF FF

But my bitmap gets:

FE FF 00    F6 00 06    00 00 00    13 00 FF    FF FF FF


Why the shift? This is not a jpg file. Is there a better choice over
NSDeviceRGBColorSpace?

Thanks,

Trygve


_______________________________________________

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

  • Follow-Ups:
    • Re: Bitmaps and color shift
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: Is @"constantstring" pointer equal to @"constantstring" aguarantee?
  • Next by Date: Cant get Garbage Collection to work
  • Previous by thread: Re: QTMovie delegate method with 64 bit
  • Next by thread: Re: Bitmaps and color shift
  • Index(es):
    • Date
    • Thread