Skip navigation.
 
mlFwd: Writing optimized screeshot utility.
FROM : Teemu Keinonen
DATE : Wed Nov 21 15:15:17 2007

Ok, figured it out myself. I get printouts now:

    [NSApplication sharedApplication];
    CGRegisterScreenRefreshCallback (MyScreenRefreshCallback, NULL);
    [NSApp run];

----

Thank you for the information. However when i try the following:
void MyScreenRefreshCallback ( CGRectCount count,  const CGRect * rectArray,
void * userParameter) {
    int i;
    fprintf(stderr, "%i rects\n", count);
    for (i=0; i < count; i++) {
        fprintf(stdout, "%i %i %i %i\n", rectArray[i].origin.x,
rectArray[i].origin.y, rectArray[i].size.width, rectArray[i].size.height);
    }
}
int main(int argc, char **argv)
{
    CGRegisterScreenRefreshCallback (MyScreenRefreshCallback, NULL);
    CFAbsoluteTime now = CFAbsoluteTimeGetCurrent ();
        while  ( CFAbsoluteTimeGetCurrent ()-now < 15 )  {
            sleep(1);
        }
    CGUnregisterScreenRefreshCallback (MyScreenRefreshCallback, NULL);
    return 0;
}

I get no printout whatsoever although screen does change. Is there some
initialization that's needed before this works?

Thanks,

Teemu Keinonen


On Nov 20, 2007 5:14 PM, Shawn Erickson <<email_removed>> wrote:

>
> On Nov 20, 2007, at 4:02 AM, Teemu Keinonen wrote:
>
> > Hi all,
> >
> > I want to write optimized screenshot utility to make videos from
> > screeen and
> > therefore i want to know what parts of the screen have changed since
> > last
> > snapshot. I can think of two alternatives:
> >
> > 1) Is it possible to get dirty region information from window
> > manager via a
> > callback or such?
>
> Yes.
>
> <http://developer.apple.com/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/doc/uid/TP30001070-CH1g-F16970

>  >
>
> -Shawn
>

Related mailsAuthorDate
mlWriting optimized screeshot utility. Teemu Keinonen Nov 20, 13:02
mlRe: Writing optimized screeshot utility. Shawn Erickson Nov 20, 16:14
mlRe: Writing optimized screeshot utility. Teemu Keinonen Nov 21, 13:32
mlFwd: Writing optimized screeshot utility. Teemu Keinonen Nov 21, 15:15
mlRe: Writing optimized screeshot utility. Shawn Erickson Nov 21, 17:20
mlRe: Writing optimized screeshot utility. Teemu Keinonen Nov 23, 11:52
mlRe: Writing optimized screeshot utility. Nicko van Someren Nov 24, 06:12