• 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: Looking for alpha channel solution for transparencies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking for alpha channel solution for transparencies


  • Subject: Re: Looking for alpha channel solution for transparencies
  • From: Brian Webster <email@hidden>
  • Date: Fri, 30 Nov 2001 17:16:41 -0600

On Friday, November 30, 2001, at 04:23 PM, cocoa-dev-
email@hidden wrote:

Next I created a CustomView class in Project Builder where I used some of
the alpha channel methods from the NSColor and NSImage classes with each of
these files. The results were the same for each file, which was a
transparency of the entire image, even the parts that weren't masked as well
and the part that was supposed to be completely transparent was white.

Which methods exactly are you using to draw the image? You should try NSImage's compositeToPoint:operation: method, and the key is to pass in NSCompositeSourceOver for the operation: parameter so that it will respect your alpha mask. You should also fill the view with transparent color before drawing the image. So, something like this:

-(void)drawRect:(NSRect)rect
{
[[NSColor clearColor] set];
NSRectFill([self bounds]);
[myImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
}

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster


  • Prev by Date: Drawing NSImage in grayscale
  • Next by Date: Re: Looking for alpha channel solution for transparencies
  • Previous by thread: Looking for alpha channel solution for transparencies
  • Next by thread: Re: Looking for alpha channel solution for transparencies
  • Index(es):
    • Date
    • Thread