You should use
-[NSBitmapImageRep initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel :]
to initialize your bitmap.
A bitmap representation initialized using -initForIncrementalLoad  
expects that you call -incrementalLoadFromData:complete:


Le 31 mars 08 à 15:54, Eddie Hebert a écrit :
I have a need to store and draw an image that I create iteratively over each pixel.
I am trying to use NSBitmapImageRep with setColor: x: y:, to do so.

Within the constructor of my "rendering engine" class, I instantiate a NSBitmapImageRep, thusly:
_imageRep = [[NSBitmapImageRep alloc] initForIncrementalLoad];
[_imageRep setSize:NSMakeSize(aWidth, aHeight)];
[_imageRep setPixelsWide:aWidth];
[_imageRep setPixelsHigh:aHeight];
[_imageRep setColorSpaceName:@"NSDeviceRGBColorSpace"];
[_imageRep setAlpha:NO];

Then in the main loop of my engine I call, [_imageRep setColor:color atX:col y:row]
When I do so I get the error:

Mon Mar 31 09:41:41 ***.local Ray Tracer[15727] <Error>: CGImageSourceCopyPropertiesAtIndex image source parameter is nil\n Mon Mar 31 09:41:41 ***.local Ray Tracer[15727] <Error>: CGImageSourceCreateImageAtIndex image source parameter is nil\n Mon Mar 31 09:41:41 ***.local Ray Tracer[15727] <Error>: CGImageSourceCopyPropertiesAtIndex image source parameter is nil\n Mon Mar 31 09:41:41 ***.local Ray Tracer[15727] <Error>: CGImageSourceCreateImageAtIndex image source parameter is nil\n
And when I call [_imageRep colorAtX:col y:row], I get back  
NSDeviceRGBColorSpace 1 1 1 1, which is not the NSColor that I sent  
it.
Is there some parameter/property of NSBitmapImageRep that I am not  
setting that is causing these errors?
Or does this have something to do with not locking properly?

Thanks in advance,
Ed Hebert Jr.
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]

_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to