Writing x, y to NSBitmapImageRep
Writing x, y to NSBitmapImageRep
- Subject: Writing x, y to NSBitmapImageRep
- From: Eddie Hebert <email@hidden>
- Date: Mon, 31 Mar 2008 09:54:53 -0400
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 (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