Re: NSBitmapImageRepresentation image generation and saving resulting in image with much noise
Re: NSBitmapImageRepresentation image generation and saving resulting in image with much noise
- Subject: Re: NSBitmapImageRepresentation image generation and saving resulting in image with much noise
- From: Rob Keniger <email@hidden>
- Date: Mon, 9 Nov 2009 21:45:34 +1000
On 09/11/2009, at 7:28 PM, Michael Robinson wrote:
> I'm getting images with a lot of noise in them, I was wondering if
> anyone has any ideas why this would be? I've attached a screenshot of
> the noisy images I've been getting. The shot is of four images that ....
> well shouldn't have any noise at all.
An NSBitmapImageRep is not guaranteed to be empty when you create it and in general it's just full of random bits. You need to clear it explicitly if you are drawing non-opaque content:
void ClearBitmapImageRep(NSBitmapImageRep* bitmap)
{
unsigned char* bitmapData = [bitmap bitmapData];
if (bitmapData != NULL)
{
bzero(bitmapData, [bitmap bytesPerRow] * [bitmap pixelsHigh]);
}
}
--
Rob Keniger
_______________________________________________
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