Re: convert NSBitmapImageRep to black/white depending on pixel hsb
Re: convert NSBitmapImageRep to black/white depending on pixel hsb
- Subject: Re: convert NSBitmapImageRep to black/white depending on pixel hsb
- From: Raul Fiedler <email@hidden>
- Date: Sat, 11 Aug 2007 15:05:05 +0200
here is my code that takes for ever to run
+ (NSBitmapImageRep *) getBlackWhiteImage:(NSBitmapImageRep *)image
brigthness:(float)brigthness bellow:(NSColor *)bellow above:(NSColor
*)above {
NSBitmapImageRep* newImage = [image copy];
for (int x = 0; x < [image pixelsWide]; x++) {
for (int y = 0; y < [image pixelsHigh]; y++) {
NSColor *color = [image colorAtX:x y:y];
if ([color brightnessComponent] > brigthness) {
[newImage setColor:above atX:x y:y];
} else {
[newImage setColor:bellow atX:x y:y];
}
}
}
return newImage;
}
this is my first project with Cocoa and core image I havn't even
touched yet.
If you happen to know example code that is similar to my function, I
would appreciated it very much.
_______________________________________________
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