Re: Writing x, y to NSBitmapImageRep
Re: Writing x, y to NSBitmapImageRep
- Subject: Re: Writing x, y to NSBitmapImageRep
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 31 Mar 2008 16:02:31 +0200
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 (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
_______________________________________________
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