Re: Colorizing a bitmap
Re: Colorizing a bitmap
- Subject: Re: Colorizing a bitmap
- From: Stephen Deken <email@hidden>
- Date: Mon, 21 Aug 2006 09:16:51 -0500
Is there an easier way that I have overlooked? Any suggestions?
If you can convert your NSBitmapImageRep into an NSImage, you could
do something like this:
NSColor *someColor; // the color to tint
[image lockFocus];
[[NSGraphicsContext currentContext]
setCompositingOperation:NSCompositePlusLighter];
NSRect r = NSZeroRect;
r.size = [image size];
[someColor setFill];
[NSBezierPath fillRect:r];
[image unlockFocus];
NSCompositePlusLighter will leave the white untouched but bring the
black up to the color that you specify.
--sjd;
_______________________________________________
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