• 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: Semi-transparent, blurred NSWindow background?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semi-transparent, blurred NSWindow background?


  • Subject: Re: Semi-transparent, blurred NSWindow background?
  • From: Rob Keniger <email@hidden>
  • Date: Mon, 25 Aug 2008 14:13:02 +1000


On 25/08/2008, at 2:45 AM, Tim Andersson wrote:

Is there any way of creating a NSWindow that has a semi-transparent, blurred background? With "blurred background" I mean that whatever you see through the window/background is distorted (blurred).


In 10.5 you can add any core image filter to a window using the private function 'CGSAddWindowFilter'.

typedef void * CGSConnectionID;

extern OSStatus CGSNewConnection(const void **attr, CGSConnectionID *id);

- (void)enableBlurForWindow:(NSWindow *)window
{

CGSConnectionID _myConnection;
uint32_t __compositingFilter;

int __compositingType = 1; // Apply filter to contents underneath the window, then draw window normally on top

/* Make a new connection to CoreGraphics, alternatively you could use the main connection*/

CGSNewConnection(NULL , &_myConnection);

/* The following creates a new CoreImage filter, then sets its options with a dictionary of values*/

CGSNewCIFilterByName (_myConnection, (CFStringRef)@"CIGaussianBlur", &__compositingFilter);
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject: [NSNumber numberWithFloat:3.0] forKey:@"inputRadius"];
CGSSetCIFilterValuesFromDictionary(_myConnection, __compositingFilter, (CFDictionaryRef)optionsDict);


/* Now just switch on the filter for the window */

CGSAddWindowFilter(_myConnection, [window windowNumber], __compositingFilter, __compositingType );
}


Insert standard disclaimer about using private Apple APIs here.

--
Rob Keniger



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Semi-transparent, blurred NSWindow background?
      • From: David Duncan <email@hidden>
    • Re: Semi-transparent, blurred NSWindow background?
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Semi-transparent, blurred NSWindow background? (From: Tim Andersson <email@hidden>)

  • Prev by Date: Re: How to control the order of enumerating on a NSDictionary
  • Next by Date: Re: Semi-transparent, blurred NSWindow background?
  • Previous by thread: Re: Semi-transparent, blurred NSWindow background?
  • Next by thread: Re: Semi-transparent, blurred NSWindow background?
  • Index(es):
    • Date
    • Thread