NAME

Mac::ScreenCapture - Capture screen, save it and compare with previous shots.


SYNOPSIS

    use Mac::ScreenCapture;     
    my $area = {x=> 0, y => 0, width => 100, height => 100};
    {
        my $image = Mac::ScreenCapture::CaptureArea ($area);
        $image->WriteToFile ("Base.png");
    }
    # Later ....
    my $image = Mac::ScreenCapture::LoadImage ("Base.png");
    my $image2 = Mac::ScreenCapture::CaptureArea ($area);
    $image2->WriteToFile ("Second.png");
        
    if ($image->Equals ($image2)) {
        print "Same thing\n" ;
    } else {
        my $difference = $image->ComputeDifference ($image2); 
        $difference->WriteToFile ("Difference.png");
    }


DESCRIPTION

This module contains functions for the following operations:

Functions

Mac::ScreenCapture::CaptureArea AREA
Captures the area rectangle from the screen. AREA is a hash reference with the x,y, width, height keys. The x,y are in top-left coordinate system. The following code capture the top left 200x200 area of the screen:
        my $image = Mac::ScreenCapture::CaptureArea (
            {x=>0, y=>0, width => 200, height => 200});

GetWidth IMAGE
Returns the width of the specified image:
        print "W:".$image->GetWidth()."\n";

GetHeight
Returns the height of the specified image:
        print "H:".$image->GetHeight()."\n";

WriteToFile PATH
Writes the file to the specified path. (Only in PNG format for now)
        $image->WritToFile ("MyImage.png");

Equals IMAGE
Determines if the image is equal with an other image. (Pixel by pixel match).
        if ($image->Equals($other)) {
            print "Equals";
        }

ComputeDifference IMAGE
Computes the difference between two images.
        my $diffimage = $image->ComputeDifference ($other);


AUTHOR

The Mac::ScreenCapture modules were written by Miklos Fazekas <boga@mac.com>.


THANKS


SEE ALSO

perl(1).