• 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: Grabbing what's behind a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grabbing what's behind a window


  • Subject: Re: Grabbing what's behind a window
  • From: Mike Paquette <email@hidden>
  • Date: Mon, 29 Oct 2007 17:22:33 -0700


On Oct 29, 2007, at 3:49 PM, Kenny Leung wrote:

Dear Graphics Gurus:

I'm trying to make a transparent "lens" effect on the screen using a core-image filter. When it's time to update, I orderOut the window I'm drawing in, grab the background, and then orderFront the window with the transformed contents. Unfortunately, this does not work - I keep grabbing the contents of my own window. I have tried the orderOut, then doing the grab in a performSelector:afterDelay, but this generates an annoying flicker.

I'm wondering if what I'm trying to do is an impossibility - or is there some trick by which it can be done?

Thanks!

-Kenny

Starting in Mac OS X 10.5 On Mac OS X 10.5 you can read back information on other windows within the same GUI session as the calling process using the CGWindow API (defined in /System/Library/ Frameworks/ApplicationServices.framework/Frameworks/ CoreGraphics.framework/Headers/CGWindow.h).


Images can be generated from a list of windows passed to CGWindowListCreateImageFromArray(), or from a set of selection conditions ("All windows below this window") passed to CGWindowListCreateImage(). Various options control the bounds and content of the resulting image.

In your case, you would want to grab an image for a specific rect for all windows below your window. (The grab will stop as soon as it reaches an opaque window.)

NSRect frame = [myWindow frame];
CGWindowID wid = (CGWindowID)[myWindow windowNumber];

CGImageRef image = CGWindowListCreateImage( *(CGRect *)&frame,
kCGWindowListOptionOnScreenBelowWindow, wid,
kCGWindowImageDefault );


Refer to the comments in the header file for information on using these new APIs.

	Mike Paquette
	CoreGraphics Team

_______________________________________________

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


References: 
 >Grabbing what's behind a window (From: Kenny Leung <email@hidden>)

  • Prev by Date: Re: Opening projects in upgraded OS
  • Next by Date: Re: Figuring out Interface Builder 3.0
  • Previous by thread: Re: Grabbing what's behind a window
  • Next by thread: Save in Core Data from another thread
  • Index(es):
    • Date
    • Thread