Re: [Enigmatic semi-solution] Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread Adam R. Maxwell
On Oct 1, 2009, at 11:19 AM, Ken Ferry wrote: Hi David, Oh, yes, you're right. In the bitmapData, the first row is the top row. -getPixelAtX:y:, -setPixelAtX:y:, -getColorAtX:y: and setColorAtX:y: are the same. The first row is the top. Sorry that's confusing. It might be nice if this

Re: [Enigmatic semi-solution] Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread Ken Ferry
Hi David, Oh, yes, you're right. In the bitmapData, the first row is the top row. -getPixelAtX:y:, -setPixelAtX:y:, -getColorAtX:y: and setColorAtX:y: are the same. The first row is the top. Sorry that's confusing. -isFlipped: is not a property of NSBitmapImageRep, that's on NSImage. The abov

[Enigmatic semi-solution] Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread David Hirsch
Well, I can work around it but I don't understand this at all. Apparently the context is flipped, or getPixelAtX:y: is flipped, or something. In this code, the first NSLog statement gives all zeros, and the second gives the intended red color. However flipped returns NO. Any ideas as to

Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread David Hirsch
Jonathan, Dave- Nothing works yet. Dave's NSLog statement prints "NSCalibratedRGBColorSpace 0 0 0 0", and restoring the graphics context does not help the problem. Still stumped. -Dave This is just as guess, but perhaps there's an issue with the drawing not being completed and flushed ba

Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread Dave Keck
>        float r,g,b,a; >        [pixelColor getRed:&r green:&g blue:&b alpha:&a]; -getRed:... accepts CGFloats as arguments, not floats. Depending on your architecture, you're supplying a pointer to an incorrectly-sized variable, and the bug you're seeing is the result of this error. If you NSLo

Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread Jonathan Hess
On Oct 1, 2009, at 1:22 AM, David Hirsch wrote: > In the code below, the TIFF gets saved correctly (transparent but for the red > square), but when I query the pixel at (40,40) which should be in the middle > of the red square, I get a black pixel (r==g==b==a==0.0): > offscreenRep = [[NSB

Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread David Hirsch
In the code below, the TIFF gets saved correctly (transparent but for the red square), but when I query the pixel at (40,40) which should be in the middle of the red square, I get a black pixel (r==g==b==a==0.0): offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil