Re: Colorizing a bitmap
Re: Colorizing a bitmap
- Subject: Re: Colorizing a bitmap
- From: Craig Dooley <email@hidden>
- Date: Mon, 21 Aug 2006 21:19:01 -0400
This worked correctly when I used NSCompositeSourceAtop. Thanks.
-Craig
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:
40gmail.com
This email sent to email@hidden
----------------------------------------
Craig Dooley
email@hidden
_______________________________________________
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