• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Colorizing a bitmap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Colorizing a bitmap
      • From: Craig Dooley <email@hidden>
References: 
 >Colorizing a bitmap (From: "Craig Dooley" <email@hidden>)

  • Prev by Date: Colorizing a bitmap
  • Next by Date: Opening Multiple NIb but with Java referencing Objective-C
  • Previous by thread: Colorizing a bitmap
  • Next by thread: Re: Colorizing a bitmap
  • Index(es):
    • Date
    • Thread