• 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
Sceen Grabbing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sceen Grabbing


  • Subject: Sceen Grabbing
  • From: Paul Querna <email@hidden>
  • Date: Tue, 10 May 2005 14:40:09 -0700

Hello,

I am attempting to create a Screen shot of a section of the screen,
using PyObjc.  The only examples I have seen, are using the
NSBitmapImageRep.initWithFocusedViewRect().  This seems to work for
creating an image of my winodw -- but my window is transparent, and
nothing bellow it is shown.

bitmap = NSBitmapImageRep.alloc().initWithFocusedViewRect_(rect)
img = bitmap.representationUsingType_properties_(NSPNGFileType, {})
img.writeToFile_atomically_("test.png", 1)

This will create a png that is just a transparent alpha layer, it
doesn't grab anything bellow it.

I ran nm on /usr/sbin/screencapture, and saw that is it calling a
function 'CGContextCopyDisplayCaptureContentsToRect', which seems to be
completely undocumented.  It seems like I need to call something at the
CoreGraphics level to get the data off a frame buffer.

Is there any example code for taking a screen shot? (I am using Python,
but ObjectiveC would be fine too.)

Thanks,

-Paul Querna
 _______________________________________________
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

  • Follow-Ups:
    • Re: Sceen Grabbing
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: Capturing a key press
  • Next by Date: Re: NSDatePicker selectable dateranges
  • Previous by thread: Capturing a key press
  • Next by thread: Re: Sceen Grabbing
  • Index(es):
    • Date
    • Thread