Skip to content

Commit c1748a0

Browse files
authored
generate imagegrabwindow (#302)
1 parent ae3b296 commit c1748a0

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

generated/functionsList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@
367367
'imagegd2',
368368
'imagegif',
369369
'imagegrabscreen',
370+
'imagegrabwindow',
370371
'imagejpeg',
371372
'imagelayereffect',
372373
'imageline',

generated/image.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,26 @@ function imagegrabscreen()
18451845
}
18461846

18471847

1848+
/**
1849+
* Grabs a window or its client area using a windows handle (HWND property in COM instance)
1850+
*
1851+
* @param int $handle The HWND window ID.
1852+
* @param bool $client_area Include the client area of the application window.
1853+
* @return \GdImage Returns an image object on success, FALSE on failure.
1854+
* @throws ImageException
1855+
*
1856+
*/
1857+
function imagegrabwindow(int $handle, bool $client_area = false): \GdImage
1858+
{
1859+
error_clear_last();
1860+
$result = \imagegrabwindow($handle, $client_area);
1861+
if ($result === false) {
1862+
throw ImageException::createFromPhpError();
1863+
}
1864+
return $result;
1865+
}
1866+
1867+
18481868
/**
18491869
* imagejpeg creates a JPEG file from
18501870
* the given image.

generator/config/ignoredFunctions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
'apcu_delete', // apcu_delete returns false when the $key does not exist in the cache store
1717
'filter_has_var', // this function is meant to return a boolean
1818
'array_multisort', // this function is too buggy, see PR #113 on GitHub
19-
'imagegrabwindow',
2019
];

generator/src/PhpStanFunctions/CustomPhpStanFunctionMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
'imagerotate' => ['resource|false', 'src_im'=>'resource', 'angle'=>'float', 'bgdcolor'=>'int', 'ignoretransparent='=>'bool'], //ignoretransparent is a bool instead of a int
1414
'pg_pconnect' => ['resource|false', 'connection_string'=>'string', 'flags' => 'int'], //flags is an int instead of a string
1515
'get_headers' => ['array|false', 'url'=>'string', 'format='=>'bool', 'context='=>'resource'], // format is a bool instead of int
16+
'imagegrabwindow' => ['GdImage|false', 'handle'=>'int', 'client_area'=>'bool'], // client_ara is a bool instead of an int
1617
];

rector-migrate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@
377377
'imagegd2' => 'Safe\imagegd2',
378378
'imagegif' => 'Safe\imagegif',
379379
'imagegrabscreen' => 'Safe\imagegrabscreen',
380+
'imagegrabwindow' => 'Safe\imagegrabwindow',
380381
'imagejpeg' => 'Safe\imagejpeg',
381382
'imagelayereffect' => 'Safe\imagelayereffect',
382383
'imageline' => 'Safe\imageline',

0 commit comments

Comments
 (0)