diff --git a/composer.json b/composer.json index 55d2bdde..6fe00d85 100644 --- a/composer.json +++ b/composer.json @@ -117,4 +117,4 @@ "dev-master": "0.1-dev" } } -} +} \ No newline at end of file diff --git a/generated/functionsList.php b/generated/functionsList.php index dba87129..18bc42e7 100644 --- a/generated/functionsList.php +++ b/generated/functionsList.php @@ -367,6 +367,7 @@ 'imagegd2', 'imagegif', 'imagegrabscreen', + 'imagegrabwindow', 'imagejpeg', 'imagelayereffect', 'imageline', diff --git a/generated/image.php b/generated/image.php index 38c7df36..b1fdfc36 100644 --- a/generated/image.php +++ b/generated/image.php @@ -1845,6 +1845,26 @@ function imagegrabscreen() } +/** + * Grabs a window or its client area using a windows handle (HWND property in COM instance) + * + * @param int $handle The HWND window ID. + * @param bool $client_area Include the client area of the application window. + * @return \GdImage Returns an image object on success, FALSE on failure. + * @throws ImageException + * + */ +function imagegrabwindow(int $handle, bool $client_area = false): \GdImage +{ + error_clear_last(); + $result = \imagegrabwindow($handle, $client_area); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + /** * imagejpeg creates a JPEG file from * the given image. diff --git a/generator/config/ignoredFunctions.php b/generator/config/ignoredFunctions.php index 50eac18c..6e0554e9 100644 --- a/generator/config/ignoredFunctions.php +++ b/generator/config/ignoredFunctions.php @@ -16,5 +16,4 @@ 'apcu_delete', // apcu_delete returns false when the $key does not exist in the cache store 'filter_has_var', // this function is meant to return a boolean 'array_multisort', // this function is too buggy, see PR #113 on GitHub - 'imagegrabwindow', ]; diff --git a/generator/src/PhpStanFunctions/CustomPhpStanFunctionMap.php b/generator/src/PhpStanFunctions/CustomPhpStanFunctionMap.php index a2789136..d5d854fd 100644 --- a/generator/src/PhpStanFunctions/CustomPhpStanFunctionMap.php +++ b/generator/src/PhpStanFunctions/CustomPhpStanFunctionMap.php @@ -13,4 +13,5 @@ 'imagerotate' => ['resource|false', 'src_im'=>'resource', 'angle'=>'float', 'bgdcolor'=>'int', 'ignoretransparent='=>'bool'], //ignoretransparent is a bool instead of a int 'pg_pconnect' => ['resource|false', 'connection_string'=>'string', 'flags' => 'int'], //flags is an int instead of a string 'get_headers' => ['array|false', 'url'=>'string', 'format='=>'bool', 'context='=>'resource'], // format is a bool instead of int + 'imagegrabwindow' => ['GdImage|false', 'handle'=>'int', 'client_area'=>'bool'], // client_ara is a bool instead of an int ]; diff --git a/rector-migrate.php b/rector-migrate.php index bd610044..adb15ac6 100644 --- a/rector-migrate.php +++ b/rector-migrate.php @@ -377,6 +377,7 @@ 'imagegd2' => 'Safe\imagegd2', 'imagegif' => 'Safe\imagegif', 'imagegrabscreen' => 'Safe\imagegrabscreen', + 'imagegrabwindow' => 'Safe\imagegrabwindow', 'imagejpeg' => 'Safe\imagejpeg', 'imagelayereffect' => 'Safe\imagelayereffect', 'imageline' => 'Safe\imageline',