• 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: Taking screen shots
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Taking screen shots


  • Subject: Re: Taking screen shots
  • From: Kevin Meaney <email@hidden>
  • Date: Wed, 18 Jun 2014 16:24:48 +0100

> Not really.
>
> Can you show some code?
>

    dictArray = CGWindowListCopyWindowInfo(kCGWindowListOptionIncludingWindow,
                                        (CGWindowID)[self._window windowNumber]);
    if (dictArray && (CFArrayGetCount(dictArray) > 0))
        windowDict = CFArrayGetValueAtIndex(dictArray, 0);

    if (windowDict && (CFDictionaryGetCount(windowDict) > 0))
        rectDict = CFDictionaryGetValue(windowDict, kCGWindowBounds);

    if (rectDict)
    {
        if (CGRectMakeWithDictionaryRepresentation(rectDict, &winRect))
            gotRect = YES;
    }
    if (dictArray)
        CFRelease(dictArray);

    NSRect screenRect;
    if (gotRect)
    {
        // screenRect = [self._window contentRectForFrameRect:winRect];
        screenRect = winRect;
        screenRect.origin.y += winRect.size.height - self._height;
        screenRect.size.height = self._height;
    }
    else
    {
        NSScreen *screen = self._window.screen;
        CGFloat screenHeight = screen.frame.size.height;

        NSRect windowRect = self._window.frame;
        NSRect contentRect = [self._window contentRectForFrameRect:windowRect];
        screenRect = CGRectMake(
                   contentRect.origin.x,
                   screenHeight - (contentRect.origin.y + contentRect.size.height),
                   contentRect.size.width,
                   contentRect.size.height);
    }
    MICGImage *newImage;
    CGImageRef cgImage;
    cgImage = CGWindowListCreateImage(screenRect,
                                      kCGWindowListOptionIncludingWindow,
                                      (CGWindowID)[self._window windowNumber],
                                      kCGWindowImageBoundsIgnoreFraming);



> --Kyle Sluder
> _______________________________________________
>
> 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

_______________________________________________

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: Taking screen shots
      • From: Kevin Meaney <email@hidden>
    • Re: Taking screen shots
      • From: Kyle Sluder <email@hidden>
References: 
 >Taking screen shots (From: Kevin Meaney <email@hidden>)
 >Re: Taking screen shots (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Taking screen shots
  • Next by Date: Re: Taking screen shots
  • Previous by thread: Re: Taking screen shots
  • Next by thread: Re: Taking screen shots
  • Index(es):
    • Date
    • Thread