• 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: Applying a transparent color over an image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applying a transparent color over an image


  • Subject: Re: Applying a transparent color over an image
  • From: Bertrand Landry Hetu <email@hidden>
  • Date: Fri, 15 Apr 2005 16:31:24 -0700


I'm using something like this:

iconImageHighlight = [[NSImage alloc] initWithSize: [iconImage size]];
[iconImageHighlight setFlipped: YES];
[iconImageHighlight lockFocus];
[[NSColor clearColor] set];
NSRectFill(bounds);
[iconImage compositeToPoint:origin operation:NSCompositeCopy];
[[NSColor colorWithCalibratedRed: 0.5 green: 0.5 blue: 0.5 alpha: 0.5] set];
NSRectFillUsingOperation(bounds, NSCompositeSourceAtop);
[iconImageHighlight unlockFocus];



to create a grey highlight. NSCompositeSourceAtop does the correct thing with the destination's alpha.


On 14 avr. 2005, at 01:23, Duncan Campbell wrote:

Hey folks.

I've developed my own custom tabs (for an editor I'm building). My tabs (NSView subclasses) have 3 images: 1 for unselected, 1 for mouse-over (using a tracking-rect) and 1 for selected.

Since the 3 images are the same - just different colors - I was thinking it would likely be much more efficient to simple apply some kind of alpha-color transparency over the base unselected image (Note the images are not solid colors - so using something like [colorWithCalibratedWhite:] isn't going to work).

I guess I'm looking for something like: [imageWithCalibratedWhite: alpha:] or similar...

Can anyone suggest a way of doing this?

Many thx,

D.

---------------------------------------------------------------
Duncan Campbell
http://www.duncanandsarah.com/duncan
---------------------------------------------------------------

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to 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
References: 
 >Applying a transparent color over an image (From: Duncan Campbell <email@hidden>)

  • Prev by Date: Bindings Question: Master-Detail across windows/nibs
  • Next by Date: Re: NSMenuItem - setting font size?
  • Previous by thread: Applying a transparent color over an image
  • Next by thread: Re: Applying a transparent color over an image
  • Index(es):
    • Date
    • Thread