Re: Taking screen shots
Re: Taking screen shots
- Subject: Re: Taking screen shots
- From: Kevin Meaney <email@hidden>
- Date: Wed, 18 Jun 2014 16:31:45 +0100
Apologies,
The e-mail with the code went out before I was finished editing.
The code shown is that taking the screen capture. But what is captured is not what I see in the window.
Kevin
On 18 Jun 2014, at 16:24, Kevin Meaney <email@hidden> wrote:
>> 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
_______________________________________________
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