Re: NSImageRep simple code

2010-03-04 Thread Ken Ferry
This is true, and was true on 10.5 (and 10.4) as well though the timing has changed some. The AppKit release notes have commentary on it. This is a bit of an API problem. In order to draw a bitmap in Quartz, the data must be packaged as a CGImage, which is immutable. This means the client and A

Re: NSImageRep simple code

2010-03-04 Thread John Horigan
It would be a good idea to modify the pixel buffer before calling initWithBitmapDataPlanes. NSBitmapImageRep makes no guarantee that changes to the data planes will be picked up by the NSBitmapImageRep after the call to initWithBitmapDataPlanes. It seems to work with OSX 10.5 and earlier, but Sn

Re: NSImageRep simple code

2010-03-03 Thread Martin Beroiz
Oh, thanks! I was missing that, now it works ok. I'll keep playing with this toy code. M. On Mar 3, 2010, at 11:02 PM, Graham Cox wrote: > > On 04/03/2010, at 3:54 PM, Martin Beroiz wrote: > >> bitsPerSample:8 > >> pixels[0] = 1; >> pixels[1] = 0; >> p

Re: NSImageRep simple code

2010-03-03 Thread Graham Cox
On 04/03/2010, at 3:54 PM, Martin Beroiz wrote: > bitsPerSample:8 > pixels[0] = 1; > pixels[1] = 0; > pixels[2] = 0; > pixels[3] = 0; > The docs say that NSDeviceWhiteColorSpace has pure white at 1.0, so I'm > guessing that pixels[0] = 1

NSImageRep simple code

2010-03-03 Thread Martin Beroiz
Hello everyone, I'm trying to understand how NSImageRep works, so I read the docs and came up with this simple code that seems to... do something. I'm confused about what's actually doing, I only see a big black block in my custom view. My intention is to make a 2x2 pixels image with differe