• 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: Simple Semi-Transparent View?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Semi-Transparent View?


  • Subject: Re: Simple Semi-Transparent View?
  • From: "John C. Randolph" <email@hidden>
  • Date: Fri, 22 Nov 2002 11:46:37 -0800

On Friday, November 22, 2002, at 01:53 AM, Steve wrote:

I'm trying to create a colored semi-transparent square area within a window.
I'm creating a custom view, and then NSRectFill-ing the entire box with a color whose opacity is set to 0.5,
in the hope that I can get the default gray/white lines of the window to show through.
I thought the problem might be that the window beneath (i.e. the superview) is not opaque.
If this is the problem, it seems I have to subclass the window just so I can override the isOpaque method.

Or is there just a much better way to achieve the desired result?

I know that NSBox can give you a light-gray semi-transparent box, and, I can replace the contents with a solid color. But obviously, neither of these give me custom-color semi-transparency.

See NSRectFillUsingOperation() in the AppKit functions documentation.

I used this function in the Tinted Image example, available at:

http://developer.apple.com/samplecode/Sample_Code/Cocoa/Tinted_Image.htm

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Simple Semi-Transparent View? (From: Steve <email@hidden>)

  • Prev by Date: pasteFont: is a no-op for plain-text text objects?
  • Next by Date: Re: pasteFont: is a no-op for plain-text text objects?
  • Previous by thread: Re: Simple Semi-Transparent View?
  • Next by thread: NSDocument writableTypes
  • Index(es):
    • Date
    • Thread