Re: NSImage get / set Pixels
Re: NSImage get / set Pixels
- Subject: Re: NSImage get / set Pixels
- From: goessly <email@hidden>
- Date: Fri, 17 Mar 2006 14:05:37 +0100
copy pixel to outputImage from inputImage
obtain the bitmap image reps from the NSImage instances.
Thanks, I'm now able to do so like this:
inputImage = [inputImageView image];
NSBitmapImageRep *inRep = [NSBitmapImageRep imageRepWithData:
[inputImage TIFFRepresentation]];
Then, use getPixel:atX:y:
Ok, since getPixel behaved... well, strangely, I used the following
instead:
NSColor *fetchColor = [inRep colorAtX:fromthisX y: fromthisY];
Alright, at this point I've got my input data. Now let's consider the
output-Image. Since I need a BitmapRep to work on - pixelwise - I
initialized one for the output in the following manner:
NSBitmapImageRep *outRep= [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: NULL
pixelsWide: [inputImage size].width
... and so on...
];
The fetchColor is now supposed to be written to it's hopefully
correctly set-up destination:
[outRep setColor:fetchColor atX:col y: row];
Now I'd like the finished image to be displayed, which I attempt via:
[outputImage addRepresentation: outRep];
[outputImageView setImage: outputImage];
But nothing is drawn here - am I missing something?
How can I create an NSImage out of a NSBitmapImageRep, so that it is
actually drawn?
Best regards,
goessly
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden