tests/gmagickdraw-033_setClipPath_basic.phpt 0000644 00000002321 15173020764 0015032 0 ustar 00 --TEST--
Test GmagickDraw, setClipPath
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setClipPath($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(2);
$clipPathName = 'testClipPath';
$draw->pushClipPath($clipPathName);
$draw->rectangle(0, 0, 250, 250);
$draw->popClipPath();
$draw->setClipPath($clipPathName);
$draw->rectangle(100, 100, 400, 400);
$storedPathName = $draw->getClipPath();
if (strcmp($storedPathName, $clipPathName) !== 0) {
echo "Error retrieving clipPath: $storedPathName != $clipPathName \n";
}
$imagick = new \Gmagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
$bytes = $imagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setClipPath($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickpixel-005-setcolorvaluequantum_getcolorvaluequantum.phpt 0000644 00000001134 15173020764 0022423 0 ustar 00 --TEST--
Test setColorValueQuantum and getColorValueQuantum methods
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gp = new GMagickPixel();
echo $gp->getColorValueQuantum(Gmagick::COLOR_BLACK). "\n";
$gp->setColorValueQuantum(Gmagick::COLOR_BLACK,1);
echo $gp->getColorValueQuantum(Gmagick::COLOR_BLACK). "\n";
try {
$gp->setColorValueQuantum(123456, 1);
echo "GmagickPixelException was not thrown".PHP_EOL;
} catch (GmagickPixelException $gpe) {
//This is the expected exception
echo $gpe->getMessage();
}
?>
--EXPECTF--
0
1
Unknown color type: 123456
tests/gmagick-041-set_getimageinterlacescheme.phpt 0000644 00000000525 15173020764 0016225 0 ustar 00 --TEST--
Set, get image interlace scheme
--SKIPIF--
<?php
/* $Id: gmagick-041-set_getimageinterlacescheme.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageInterlaceScheme(1)->getImageInterlaceScheme();
?>
--EXPECTF--
1 tests/gmagick-015-cyclecolormapimage.phpt 0000644 00000000440 15173020765 0014351 0 ustar 00 --TEST--
Test current
--SKIPIF--
<?php
/* $Id: gmagick-015-cyclecolormapimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->cycleColorMapImage(2);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-067-minifyimage.phpt 0000644 00000000426 15173020765 0013023 0 ustar 00 --TEST--
minifyImage test
--SKIPIF--
<?php
/* $Id: gmagick-067-minifyimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->minifyImage();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-027-setantialias_getantialias.phpt 0000644 00000000346 15173020765 0016606 0 ustar 00 --TEST--
Test and get anti-alias
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setStrokeAntiAlias(true);
echo $gDraw->getStrokeAntiAlias();
?>
--EXPECT--
1
tests/gmagick-042-set_getimageiterations.phpt 0000644 00000000500 15173020765 0015246 0 ustar 00 --TEST--
Set, get image iterations
--SKIPIF--
<?php
/* $Id: gmagick-042-set_getimageiterations.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageIterations(2)->getImageIterations();
?>
--EXPECTF--
2 tests/gmagickdraw_040_pathCurveToQuadraticBezierAbsolute_basic.phpt 0000644 00000003576 15173020765 0021652 0 ustar 00 --TEST--
Test GmagickDraw, pathCurveToQuadraticBezierAbsolute
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->pathStart();
$draw->pathMoveToAbsolute(50,250);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is the first two params, and the end point is the last two params.
$draw->pathCurveToQuadraticBezierAbsolute(
150,50,
250,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothAbsolute(
450,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined relative from the current position by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothRelative(
200,-100
);
$draw->pathFinish();
$gmagick = new \Gmagick();
$gmagick->newImage(700, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-060-haspreviousimage.phpt 0000644 00000000445 15173020765 0014072 0 ustar 00 --TEST--
hasPreviousImage test
--SKIPIF--
<?php
/* $Id: gmagick-060-haspreviousimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->hasPreviousImage();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-102-unsharpenmaskimage.phpt 0000644 00000000340 15173020765 0014370 0 ustar 00 --TEST--
unsharpmaskimage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->unsharpMaskImage(0 , 0.5 , 1 , 0.05);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-092-getimagegeometry.phpt 0000644 00000000505 15173020765 0014057 0 ustar 00 --TEST--
setImage test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
print_r($image->getImageGeometry());
?>
--EXPECTF--
Array
(
[width] => 70
[height] => 46
)
tests/gmagick-105-readimageblob.phpt 0000644 00000000707 15173020765 0013275 0 ustar 00 --TEST--
Gmagick::readImageBlob
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->setImageFormat('png');
$imageBlob = $image->getImageBlob();
$imageReload = new Gmagick();
$imageReload->readImageBlob($imageBlob);
printf(
"Dimensions are %d x %d\n",
$imageReload->getImageWidth(),
$imageReload->getImageHeight()
);
echo "ok";
?>
--EXPECTF--
Dimensions are 70 x 46
ok tests/gmagickdraw-012-setstrokeopacity_getstrokeopacity.phpt 0000644 00000000506 15173020765 0020464 0 ustar 00 --TEST--
Test setstrokeopacity, getstrokeopacity
--SKIPIF--
<?php
/* $Id: gmagickdraw-012-setstrokeopacity_getstrokeopacity.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setStrokeOpacity(0.8)->getStrokeOpacity();
?>
--EXPECT--
0.8 tests/gmagick-037-set_getimagegamma.phpt 0000644 00000000460 15173020765 0014160 0 ustar 00 --TEST--
Set, get image gamma
--SKIPIF--
<?php
/* $Id: gmagick-037-set_getimagegamma.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageGamma(0.2)->getImageGamma();
?>
--EXPECTF--
0.2 tests/gmagick-027-set_getimagebordercolor.phpt 0000644 00000000766 15173020765 0015422 0 ustar 00 --TEST--
Imagebordercolor test
--SKIPIF--
<?php
/* $Id: gmagick-027-set_getimagebordercolor.phpt 331869 2013-10-20 11:27:00Z remi $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$pixel = $gm->setImageBorderColor($color)->getImageBorderColor();
print_r($pixel->getColor());
?>
--EXPECTF--
rgb(255,255,255)
tests/gmagick-075-quantizeimages.phpt 0000644 00000000462 15173020765 0013552 0 ustar 00 --TEST--
quantizeImages test
--SKIPIF--
<?php
/* $Id: gmagick-075-quantizeimages.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->quantizeImages(2, 2, 2, true, true);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-083-solarizeimage.phpt 0000644 00000000434 15173020765 0013355 0 ustar 00 --TEST--
solarizeImage test
--SKIPIF--
<?php
/* $Id: gmagick-083-solarizeimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->solarizeImage(1);
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw_045_setFontFamily_basic.phpt 0000644 00000002473 15173020765 0015474 0 ustar 00 --TEST--
Test GmagickDraw, setFontFamily
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setFontFamily($fillColor, $strokeColor, $backgroundColor) {
$draw = new \GmagickDraw();
$strokeColor = new \GmagickPixel($strokeColor);
$fillColor = new \GmagickPixel($fillColor);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
//TODO - actually use setFontFamily
$draw->setStrokeWidth(2);
$draw->setFontSize(24);
$draw->annotate(50, 50, "Lorem Ipsum!");
$draw->setFontSize(36);
$draw->annotate(50, 100, "Lorem Ipsum!");
$draw->setFontSize(48);
$draw->annotate(50, 150, "Lorem Ipsum!");
$draw->setFontSize(60);
$draw->annotate(50, 200, "Lorem Ipsum!");
$draw->setFontSize(72);
$draw->annotate(50, 250, "Lorem Ipsum!");
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setFontFamily($fillColor, $strokeColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-126_negateImage_basic.phpt 0000644 00000001004 15173020765 0014143 0 ustar 00 --TEST--
Test Gmagick, negateImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$grayOnly = 0;
$channel = Gmagick::CHANNEL_DEFAULT;
function negateImage($grayOnly, $channel) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->negateImage($grayOnly, $channel);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
negateImage($grayOnly, $channel) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-044-set_getimageredprimary.phpt 0000644 00000000560 15173020765 0015253 0 ustar 00 --TEST--
Set, get imageredprimary
--SKIPIF--
<?php
/* $Id: gmagick-044-set_getimageredprimary.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setImageRedPrimary(0.2, 0.2)->getImageRedPrimary());
?>
--EXPECTF--
Array
(
[x] => 0.2
[y] => 0.2
) tests/gmagick-013-commentimage.phpt 0000644 00000000446 15173020765 0013163 0 ustar 00 --TEST--
Test commentImage
--SKIPIF--
<?php
/* $Id: gmagick-013-commentimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->commentImage("Test Comment");
echo "ok";
?>
--EXPECT--
ok
tests/gmagickdraw-010-setfontstyle_getfontstyle.phpt 0000644 00000000476 15173020765 0016746 0 ustar 00 --TEST--
Test setfontstyle, getfontstyle
--SKIPIF--
<?php
/* $Id: gmagickdraw-010-setfontstyle_getfontstyle.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setFontStyle(Gmagick::STYLE_NORMAL)->getFontStyle();
?>
--EXPECT--
0 tests/gmagick-070-motionblurimage.phpt 0000644 00000000452 15173020765 0013713 0 ustar 00 --TEST--
motionblur test
--SKIPIF--
<?php
/* $Id: gmagick-070-motionblurimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->motionBlurImage(0.2, 0.2, 0.2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-090-setimage.phpt 0000644 00000000500 15173020765 0012310 0 ustar 00 --TEST--
setImage test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$replace = new Gmagick('magick:rose');
$image->setImage($replace);
echo "1";
?>
--EXPECTF--
1
tests/gmagick-093-flattenimages.phpt 0000644 00000000430 15173020765 0013342 0 ustar 00 --TEST--
setImage test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->flattenImages();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-025-affine.phpt 0000644 00000000555 15173020765 0012630 0 ustar 00 --TEST--
Test affine
--SKIPIF--
<?php
/* $Id: gmagickdraw-025-affine.phpt 280206 2010-08-07 12:46:00Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$affineArray = array("sx" => 1, "rx" => 0, "ry" => 0, "sy" =>1, "tx" => 0, "ty" => 0);
$gDraw->affine($affineArray);
echo "ok";
?>
--EXPECT--
ok
tests/gmagick-025-set_and_getimageckgroundcolor.phpt 0000644 00000001060 15173020765 0016565 0 ustar 00 --TEST--
Test setImageBackgroundColor and getImageBackgroundColor methods
--SKIPIF--
<?php
/* $Id: gmagick-025-set_and_getimageckgroundcolor.phpt 331869 2013-10-20 11:27:00Z remi $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$pixel = $gm->setImageBackgroundColor($color)->getimagebackgroundcolor();
print_r($pixel->getColor());
?>
--EXPECTF--
rgb(255,255,255)
tests/gmagick-021-equalizeimage.phpt 0000644 00000000421 15173020765 0013330 0 ustar 00 --TEST--
Equalize
--SKIPIF--
<?php
/* $Id: gmagick-021-equalizeimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->equalizeImage();
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw_042_setTextAntialias_basic.phpt 0000644 00000002455 15173020765 0016173 0 ustar 00 --TEST--
Test GmagickDraw, setTextAntialias
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setTextAntialias($fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor('none');
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setFontSize(32);
$draw->setTextAntialias(false);
$draw->annotate(5, 30, "Lorem Ipsum!");
$draw->setTextAntialias(true);
$draw->annotate(5, 65, "Lorem Ipsum!");
$currentValue = $draw->getTextAntialias();
if ($currentValue !== true) {
echo "Failed to get textAntiAlias setting, which should be true\n";
var_dump($currentValue);
}
$gmagick = new \Gmagick();
$gmagick->newImage(220, 80, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
//Scale the image so that people can see the aliasing.
$gmagick->scaleImage(220 * 6, 80 * 6);
$gmagick->cropImage(640, 480, 0, 0);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setTextAntialias($fillColor, $backgroundColor);
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-038-setimagegreenprimary.phpt 0000644 00000000564 15173020765 0014751 0 ustar 00 --TEST--
Set, get imagegreenprimary
--SKIPIF--
<?php
/* $Id: gmagick-038-setimagegreenprimary.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setImageGreenPrimary(0.2, 0.2)->getImageGreenPrimary());
?>
--EXPECTF--
Array
(
[x] => 0.2
[y] => 0.2
) tests/gmagickdraw_035_setClipUnits_basic.phpt 0000644 00000002540 15173020765 0015330 0 ustar 00 --TEST--
Test GmagickDraw, setClipUnits
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setClipUnits($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(2);
$clipPathName = 'testClipPath';
$draw->setClipUnits(\Gmagick::RESOLUTION_PIXELSPERINCH);
$draw->pushClipPath($clipPathName);
$draw->rectangle(0, 0, 250, 250);
$draw->popClipPath();
$draw->setClipPath($clipPathName);
$clipUnits = $draw->getClipUnits();
if ($clipUnits !== \Gmagick::RESOLUTION_PIXELSPERINCH) {
echo "Failed to get correct clipUnits $clipRule != \Gmagick::RESOLUTION_PIXELSPERINCH \n";
}
//RESOLUTION_PIXELSPERINCH
//RESOLUTION_PIXELSPERCENTIMETER
$draw->rectangle(200, 200, 300, 300);
$imagick = new \Gmagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
$bytes = $imagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setClipUnits($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-074-quantizeimage.phpt 0000644 00000000457 15173020765 0013372 0 ustar 00 --TEST--
quantizeImage test
--SKIPIF--
<?php
/* $Id: gmagick-074-quantizeimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->quantizeImage(2, 2, 2, true, true);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-097-sampleimage.phpt 0000644 00000000310 15173020765 0013004 0 ustar 00 --TEST--
sampleimage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->sampleimage(5, 5);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-030-setmiterlimit_getmiterlimit.phpt 0000644 00000000514 15173020765 0017221 0 ustar 00 --TEST--
Test get and set strokeMiterLimit
--SKIPIF--
<?php
/* $Id: gmagickdraw30-setmiterlimit_getmiterlimit.phpt 280206 2013-11-05 12:46:00Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setStrokeMiterLimit(2);
echo $gDraw->getStrokeMiterLimit();
?>
--EXPECT--
2
tests/gmagick-023-gammaimage.phpt 0000644 00000000417 15173020765 0012602 0 ustar 00 --TEST--
Gamma image
--SKIPIF--
<?php
/* $Id: gmagick-023-gammaimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->gammaImage(0.8);
echo "1";
?>
--EXPECTF--
1 tests/bug63677.phpt 0000644 00000002344 15173020765 0010006 0 ustar 00 --TEST--
Test bug 63677 - getimagehistogram
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
class Image
{
private $gmagick;
private $layers;
public function __construct(\Gmagick $gmagick)
{
$this->gmagick = $gmagick;
$this->layers = new Layers($this, $this->gmagick);
}
public function __destruct()
{
if (null !== $this->gmagick && $this->gmagick instanceof \Gmagick) {
$this->gmagick->clear();
$this->gmagick->destroy();
}
}
public function histogram()
{
return array_map(
function(\GmagickPixel $pixel) {
return new \stdClass();
},
$this->gmagick->getimagehistogram()
);
}
}
class Layers
{
private $image;
private $resource;
public function __construct(Image $image, \Gmagick $resource)
{
$this->image = $image;
$this->resource = $resource;
}
}
for ($i=0; $i<5; $i++) {
$image = new Image(new \Gmagick("magick:logo"));
// the same fixture must beloaded twice to reprodcue the seg fault
$image = new Image(new \Gmagick("magick:logo"));
$image->histogram();
}
echo "ok";
?>
--EXPECT--
ok
tests/gmagick-062-labelimage.phpt 0000644 00000000431 15173020765 0012576 0 ustar 00 --TEST--
labelImage test
--SKIPIF--
<?php
/* $Id: gmagick-062-labelimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->labelImage("test");
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-021-rectangle.phpt 0000644 00000000656 15173020765 0013342 0 ustar 00 --TEST--
Test rectangle
--SKIPIF--
<?php
/* $Id: gmagickdraw-021-rectangle.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->rectangle(20,20,30,30);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-073-profileimage.phpt 0000644 00000000462 15173020766 0013166 0 ustar 00 --TEST--
profileImage test
--SKIPIF--
<?php
/* $Id: gmagick-073-profileimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->profileImage('icc', 'test_icc_profile');
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-086-swirlimage.phpt 0000644 00000000425 15173020766 0012671 0 ustar 00 --TEST--
swirlImage test
--SKIPIF--
<?php
/* $Id: gmagick-086-swirlimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->swirlImage(0.2);
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw_039_pathStart_basic.phpt 0000644 00000002766 15173020766 0014673 0 ustar 00 --TEST--
Test GmagickDraw, pathStart
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function pathStart($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->pathStart();
$draw->pathMoveToAbsolute(50, 50);
$draw->pathLineToAbsolute(100, 50);
$draw->pathLineToRelative(0, 50);
$draw->pathLineToHorizontalRelative(-50);
$draw->pathFinish();
$draw->pathStart();
$draw->pathMoveToAbsolute(50, 50);
$draw->pathMoveToRelative(300, 0);
$draw->pathLineToRelative(50, 0);
$draw->pathLineToVerticalRelative(50);
$draw->pathLineToHorizontalAbsolute(350);
$draw->pathclose();
$draw->pathFinish();
$draw->pathStart();
$draw->pathMoveToAbsolute(50, 300);
$draw->pathCurveToAbsolute(50, 300, 100, 200, 300, 300);
$draw->pathLineToVerticalAbsolute(350);
$draw->pathFinish();
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
pathStart($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-017-destroy.phpt 0000644 00000000404 15173020767 0012207 0 ustar 00 --TEST--
Destroy
--SKIPIF--
<?php
/* $Id: gmagick-017-destroy.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->destroy();
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw-007-setfillopacity_getfillopacity.phpt 0000644 00000000477 15173020767 0017537 0 ustar 00 --TEST--
Test setfillopacity, getfillopacity
--SKIPIF--
<?php
/* $Id: gmagickdraw-007-setfillopacity_getfillopacity.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
$gd->setFillOpacity(0.8);
echo $gd->getFillOpacity();
?>
--EXPECT--
0.2 tests/gmagick-011-charcoalimage.phpt 0000644 00000000556 15173020770 0013271 0 ustar 00 --TEST--
Test charcoal image
--SKIPIF--
<?php
/* $Id: gmagick-011-charcoalimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm->read("magick:rose");
$gm->charcoalImage(3,3);
$gm->write($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-114_convolveImage_6.phpt 0000644 00000001210 15173020770 0013607 0 ustar 00 --TEST--
Test Gmagick, convolveImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
$imageMagickBelowVersion=0x700;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$bias = 0.5;
$kernelMatrix = array (
0 => -1,
1 => -1,
2 => -1,
3 => -1,
4 => 8,
5 => -1,
6 => -1,
7 => -1,
8 => -1,
);
function convolveImage($bias, $kernelMatrix) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->convolveImage($kernelMatrix);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
convolveImage($bias, $kernelMatrix) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickdraw_037_setFillRule_basic.phpt 0000644 00000003617 15173020770 0015140 0 ustar 00 --TEST--
Test GmagickDraw, setFillRule
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setFillRule($fillColor, $strokeColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeWidth(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$fillRules = array(\Gmagick::FILLRULE_NONZERO, \Gmagick::FILLRULE_EVENODD);
$points = 11;
$size = 150;
$draw->translate(175, 160);
for ($x = 0; $x < 2; $x++) {
$draw->setFillRule($fillRules[$x]);
$draw->pathStart();
for ($n = 0; $n < $points * 2; $n++) {
if ($n >= $points) {
$angle = fmod($n * 360 * 4 / $points, 360) * pi() / 180;
}
else {
$angle = fmod($n * 360 * 3 / $points, 360) * pi() / 180;
}
$positionX = $size * sin($angle);
$positionY = $size * cos($angle);
if ($n == 0) {
$draw->pathMoveToAbsolute($positionX, $positionY);
}
else {
$draw->pathLineToAbsolute($positionX, $positionY);
}
}
$draw->pathClose();
$draw->pathFinish();
$currentFillRule = $draw->getFillRule();
if ($currentFillRule !== $fillRules[$x]) {
echo "Failed to get correct fillRule $currentFillRule != ".$fillRules[$x]." \n";
}
$draw->translate(325, 0);
}
$image = new \Gmagick();
$image->newImage(700, 320, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
$bytes = $image->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setFillRule($fillColor, $strokeColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-016-despeckleimage.phpt 0000644 00000000432 15173020771 0013453 0 ustar 00 --TEST--
Despeckle image
--SKIPIF--
<?php
/* $Id: gmagick-016-despeckleimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->despeckleImage();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-029-set_getimagecolorspace.phpt 0000644 00000000504 15173020771 0015225 0 ustar 00 --TEST--
Set, get imagecolorspace test
--SKIPIF--
<?php
/* $Id: gmagick-029-set_getimagecolorspace.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageColorspace(2)->getImageColorspace();
?>
--EXPECTF--
2 tests/gmagickdraw-014-setstrokewidth_getstrokewidth.phpt 0000644 00000000466 15173020771 0017606 0 ustar 00 --TEST--
Test setstrokewidth, getstrokewidth
--SKIPIF--
<?php
/* $Id: gmagickdraw-014-setstrokewidth_getstrokewidth.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setStrokeWidth(2)->getStrokeWidth();
?>
--EXPECT--
2 tests/gmagick-066-medianfilterimage.phpt 0000644 00000000452 15173020772 0014167 0 ustar 00 --TEST--
medianFilterImage test
--SKIPIF--
<?php
/* $Id: gmagick-066-medianfilterimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->medianFilterImage(0.5);
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw-023-roundrectangle.phpt 0000644 00000000702 15173020772 0014402 0 ustar 00 --TEST--
Test round rectangle
--SKIPIF--
<?php
/* $Id: gmagickdraw-023-roundrectangle.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->roundRectangle(30,30,35,35,5,5);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw-004-arc.phpt 0000644 00000000646 15173020773 0012142 0 ustar 00 --TEST--
Test arc
--SKIPIF--
<?php
/* $Id: gmagickdraw-004-arc.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->arc(10, 10, 30, 30, 5, 10);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-049-set_getimagetype.phpt 0000644 00000000447 15173020773 0014066 0 ustar 00 --TEST--
Set, get imagetype
--SKIPIF--
<?php
/* $Id: gmagick-049-set_getimagetype.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageType(6)->getImageType();
?>
--EXPECTF--
6 tests/gmagick-061-implodeimage.phpt 0000644 00000000435 15173020773 0013152 0 ustar 00 --TEST--
implode image test
--SKIPIF--
<?php
/* $Id: gmagick-061-implodeimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->implodeImage(0.5);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-005-bezier.phpt 0000644 00000001345 15173020774 0012654 0 ustar 00 --TEST--
Test bezier
--SKIPIF--
<?php
/* $Id: gmagickdraw-005-bezier.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->bezier( array(
array( "x" => 3 , "y" => 8 ),
array( "x" => 13, "y" => 16 ),
array( "x" => 20, "y" => 25 ),
array( "x" => 25, "y" => 23 ),
array( "x" => 33, "y" => 23 ),
array( "x" => 33, "y" => 3 ),
) );
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-080-scaleimage.phpt 0000644 00000000426 15173020774 0012612 0 ustar 00 --TEST--
scaleImage test
--SKIPIF--
<?php
/* $Id: gmagick-080-scaleimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->scaleImage(5, 5);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-096-setinterlacescheme.phpt 0000644 00000000351 15173020775 0014374 0 ustar 00 --TEST--
setInterlaceScheme test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->setInterlaceScheme(Gmagick::INTERLACE_LINE);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-005-draw.phpt 0000644 00000001052 15173020775 0011447 0 ustar 00 --TEST--
Test read/write
--SKIPIF--
<?php
/* $Id: gmagick-005-draw.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$color = "rgb(255,255,123)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
$gd->setStrokeColor($pixel)->setStrokeWidth( 2 )->setFillColor($pixel)->ellipse( 200, 100, 50, 50, 0, 360 );
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick("magick:rose");
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok
tests/gmagick-040-getimagehistogram.phpt 0000644 00000000451 15173020776 0014214 0 ustar 00 --TEST--
Set, get image histogram
--SKIPIF--
<?php
/* $Id: gmagick-040-getimagehistogram.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->getImageHistogram();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-039-getimageheight.phpt 0000644 00000000432 15173020776 0013476 0 ustar 00 --TEST--
Set, get image height
--SKIPIF--
<?php
/* $Id: gmagick-039-getimageheight.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->getImageHeight();
?>
--EXPECTF--
46 tests/gmagick-099-appendimages.phpt 0000644 00000000351 15173020776 0013166 0 ustar 00 --TEST--
appendimages test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->newImage(100, 50, "blue");
$image->appendImages();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-013-setstrokecolor_getstrokecolor.phpt 0000644 00000000757 15173020777 0017614 0 ustar 00 --TEST--
Test setstrokecolor, getstrokecolor
--SKIPIF--
<?php
/* $Id: gmagickdraw-013-setstrokecolor_getstrokecolor.phpt 331869 2013-10-20 11:27:00Z remi $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
print_r($gd->setStrokeColor($pixel)->getStrokeColor()->getColor());
?>
--EXPECT--
rgb(255,255,255)
tests/gmagickdraw_036_pushPattern_basic.phpt 0000644 00000003007 15173020777 0015222 0 ustar 00 --TEST--
Test GmagickDraw, pushPattern
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function pushPattern($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->pushPattern("MyFirstPattern", 0, 0, 50, 50);
for ($x = 0; $x < 50; $x += 10) {
for ($y = 0; $y < 50; $y += 5) {
$positionX = $x + (($y / 5) % 5);
$draw->rectangle($positionX, $y, $positionX + 5, $y + 5);
}
}
$draw->popPattern();
$draw->setFillOpacity(0);
$draw->rectangle(100, 100, 400, 400);
$draw->setFillOpacity(1);
$draw->setFillOpacity(1);
$draw->pushGraphicContext();
$draw->setFillPatternURL('#MyFirstPattern');
$draw->setFillColor('yellow');
$draw->rectangle(100, 100, 400, 400);
$draw->popGraphicContext();
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
pushPattern($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-027-set_getimagebordercolor_q16.phpt 0000644 00000000775 15173020777 0016114 0 ustar 00 --TEST--
Imagebordercolor test
--SKIPIF--
<?php
/* $Id: gmagick-027-set_getimagebordercolor.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 16) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$pixel = $gm->setImageBorderColor($color)->getImageBorderColor();
print_r($pixel->getColor());
?>
--EXPECTF--
rgb(65535,65535,65535)
tests/gmagick-091-getimage.phpt 0000644 00000000404 15173020777 0012303 0 ustar 00 --TEST--
getImage test
--SKIPIF--
<?php
/* $Id: gmagick-086-getimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->getImage();
echo "1";
?>
--EXPECTF--
1
tests/gmagick-122_unsharpMaskImage_basic.phpt 0000644 00000001216 15173020777 0015200 0 ustar 00 --TEST--
Test Gmagick, unsharpMaskImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$radius = 5;
$sigma = 1;
$amount = 5;
$unsharpThreshold = 0;
$channel = Gmagick::CHANNEL_DEFAULT;
function unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-053-getpackagename.phpt 0000644 00000000440 15173020777 0013453 0 ustar 00 --TEST--
get packagename
--SKIPIF--
<?php
/* $Id: gmagick-053-getpackagename.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->getPackageName();
?>
--EXPECTF--
GraphicsMagick tests/gmagick-035-set_getfilename.phpt 0000644 00000000504 15173020777 0013653 0 ustar 00 --TEST--
Set, get filename
--SKIPIF--
<?php
/* $Id: gmagick-035-set_getfilename.phpt 295011 2010-02-13 17:06:23Z mkoppanen $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setFilename("magickrose.png")->getFilename();
?>
--EXPECTF--
magickrose.png tests/gmagick-065-mapimage.phpt 0000644 00000000634 15173020777 0012307 0 ustar 00 --TEST--
mapImage test
--SKIPIF--
<?php
/* $Id: gmagick-065-mapimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH == 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$gm = new Gmagick();
$gm2 = new Gmagick();
$gm->read("magick:rose");
$gm2->read("magick:rose");
$gm->mapImage($gm2, true);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-019-embossimage.phpt 0000644 00000000423 15173020777 0013015 0 ustar 00 --TEST--
Emboss
--SKIPIF--
<?php
/* $Id: gmagick-019-embossimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->embossImage(0.8, 0.5);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-003-resize_variations.phpt 0000644 00000000656 15173020777 0014263 0 ustar 00 --TEST--
Test resize
--SKIPIF--
<?php
/* $Id: gmagick-003-resize_variations.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick("magick:rose");
$gm->resizeImage(10, 10, Gmagick::FILTER_LANCZOS, 0.5);
$gm->resizeImage(10, 10, Gmagick::FILTER_UNDEFINED, 0.5, true);
$gm->resizeImage(10, 10, Gmagick::FILTER_GAUSSIAN, 0.5, false);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-028-set_getimagechanneldepth.phpt 0000644 00000000517 15173020777 0015541 0 ustar 00 --TEST--
Set, get imagechanneldepth test
--SKIPIF--
<?php
/* $Id: gmagick-028-set_getimagechanneldepth.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageChannelDepth(1,1)->getImageChannelDepth(1);
?>
--EXPECTF--
1 tests/gmagick-100-coalesceimages.phpt 0000644 00000000422 15173020777 0013454 0 ustar 00 --TEST--
coalesceimages test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->newImage(100, 50, "blue");
$image->newImage(100, 50, "yellow");
$image->coalesceImages();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-010-borderimage.phpt 0000644 00000000634 15173020777 0012775 0 ustar 00 --TEST--
Test border image
--SKIPIF--
<?php
/* $Id: gmagick-010-borderimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$gm->borderImage($color,3,3);
$gm->write($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-101-sharpenimage.phpt 0000644 00000000316 15173020777 0013156 0 ustar 00 --TEST--
sharpenimage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->sharpenImage(1.5, 1.2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw_044_setTextUnderColor_basic.phpt 0000644 00000002052 15173020777 0016340 0 ustar 00 --TEST--
Test GmagickDraw, setTextUnderColor
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
$textUnderColor = 'DeepPink2';
function setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->annotate(50, 75, "Lorem Ipsum!");
$draw->setTextUnderColor($textUnderColor);
$draw->annotate(50, 175, "Lorem Ipsum!");
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-103-setgetimagecompression.phpt 0000644 00000000404 15173020777 0015273 0 ustar 00 --TEST--
setImageCompression test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->setImageCompression(Gmagick::COMPRESSION_JPEG);
echo $image->getImageCompression();
?>
--EXPECTF--
5 tests/gmagick-036-set_getimagefilename.phpt 0000644 00000000523 15173020777 0014660 0 ustar 00 --TEST--
Set, get imagefilename
--SKIPIF--
<?php
/* $Id: gmagick-036-set_getimagefilename.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageFilename('magickrose.png')->getImageFilename();
?>
--EXPECTF--
magickrose.png tests/gmagickdraw-006-setfillcolor_getfillcolor.phpt 0000644 00000000743 15173020777 0016647 0 ustar 00 --TEST--
Test setfillcolor, getfillcolor
--SKIPIF--
<?php
/* $Id: gmagickdraw-006-setfillcolor_getfillcolor.phpt 331869 2013-10-20 11:27:00Z remi $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
print_r($gd->setFillColor($pixel)->getFillColor()->getColor());
?>
--EXPECT--
rgb(255,255,255)
tests/gmagick-076-queryfonts.phpt 0000644 00000000423 15173020777 0012744 0 ustar 00 --TEST--
queryFonts test
--SKIPIF--
<?php
/* $Id: gmagick-076-queryfonts.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->queryFonts();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-016-settextencoding_gettextencoding.phpt 0000644 00000000506 15173020777 0020061 0 ustar 00 --TEST--
Test settextencoding, gettextencoding
--SKIPIF--
<?php
/* $Id: gmagickdraw-016-settextencoding_gettextencoding.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setTextEncoding("UTF-8")->getTextEncoding();
?>
--EXPECT--
UTF-8 tests/gmagick-084-spreadimage.phpt 0000644 00000000430 15173020777 0013003 0 ustar 00 --TEST--
spreadImage test
--SKIPIF--
<?php
/* $Id: gmagick-084-spreadimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->spreadImage(0.2);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-043-set_getimageprofile.phpt 0000644 00000000531 15173020777 0014535 0 ustar 00 --TEST--
Set, get imageprofile
--SKIPIF--
<?php
/* $Id: gmagick-043-set_getimageprofile.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageProfile("test", "test_profile")->getImageProfile("test");
?>
--EXPECTF--
test_profile tests/gmagickdraw-015-settextdecoration_gettextdecoration.phpt 0000644 00000000544 15173021000 0020740 0 ustar 00 --TEST--
Test settextdecoration, gettextdecoration
--SKIPIF--
<?php
/* $Id: gmagickdraw-015-settextdecoration_gettextdecoration.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setTextDecoration(Gmagick::DECORATION_UNDERLINE)->getTextDecoration();
?>
--EXPECT--
1 tests/gmagick-034-set_getimagedispose.phpt 0000644 00000000460 15173021000 0014520 0 ustar 00 --TEST--
Set, getimagedepth
--SKIPIF--
<?php
/* $Id: gmagick-034-set_getimagedispose.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageDispose(2)->getImageDispose();
?>
--EXPECTF--
2 tests/skipif.inc 0000644 00000000372 15173021000 0007655 0 ustar 00 <?php
if (!extension_loaded("gmagick")) die("skip");
function checkClassMethods($class, $methods)
{
foreach ($methods as $method) {
if (method_exists($class, $method) == false) {
die("skip Class method $class::$method not present");
}
}
}
tests/gmagick-014-current.phpt 0000644 00000000420 15173021000 0012150 0 ustar 00 --TEST--
Test current
--SKIPIF--
<?php
/* $Id: gmagick-014-current.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm2 = $gm->current();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-024-getcopyright_getfilename.phpt 0000644 00000000505 15173021000 0015543 0 ustar 00 --TEST--
Test getCopyright, getFileName
--SKIPIF--
<?php
/* $Id: gmagick-024-getcopyright_getfilename.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->getCopyright();
$gm->getFilename();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-072-oilpaintimage.phpt 0000644 00000000437 15173021000 0013324 0 ustar 00 --TEST--
oilPaintImage test
--SKIPIF--
<?php
/* $Id: gmagick-072-oilpaintimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->oilPaintImage(0.2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-071-next_previousimage.phpt 0000644 00000000470 15173021000 0014413 0 ustar 00 --TEST--
next,previousImage test
--SKIPIF--
<?php
/* $Id: gmagick-071-next_previousimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->nextImage();
$gm->previousImage();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-113_compareImages.phpt 0000644 00000001716 15173021000 0013335 0 ustar 00 --TEST--
Test PHP bug #59378 writing to php://memory is incomplete
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$gmagick = new Gmagick("magick:logo");
//$gmagick->setFormat("png");
$fp = fopen("php://memory", 'r+');
$gmagick->writeImageFile($fp);
rewind($fp);
$memoryBlob = stream_get_contents($fp);
fclose($fp);
//This test depends on getImageBlob working correctly.
$imageBlob = $gmagick->getImageBlob();
//Read the images from the data blobs.
$imageReopened = new Gmagick();
$imageReopened->readImageBlob($imageBlob);
$memoryReopened = new Gmagick();
$memoryReopened->readImageBlob($memoryBlob);
//Compare to see if they are identical.
$result = $imageReopened->compareImages($memoryReopened, \Gmagick::METRIC_MEANABSOLUTEERROR);
if ($result[1] == 0) {
echo "Reopened images are identical.";
}
else {
echo "Error, reopened images have changed.";
var_dump($result);
}
?>
--EXPECTF--
Reopened images are identical.
tests/bug71626.phpt 0000644 00000001476 15173021000 0007763 0 ustar 00 --TEST--
Test bug 71626 - multiple calls to queryFontMetrics
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$textWidth = null;
for ($i=0; $i<5; $i++) {
$image = new Gmagick();
$fontDraw = new GmagickDraw();
$fontMetrics = $image->queryFontMetrics($fontDraw, 'g');
if (is_array($fontMetrics) === false ||
isset($fontMetrics['textWidth']) === false) {
echo "fontMetrics contains bad data".PHP_EOL;
var_dump($fontMetrics);
}
}
for ($i=0; $i<5; $i++) {
$gmagick = new \Gmagick("magick:logo");
$fontDraw = new GmagickDraw();
$fontMetrics = $image->queryFontMetrics($fontDraw, 'g');
if (is_array($fontMetrics) === false ||
isset($fontMetrics['textWidth']) === false) {
echo "fontMetrics contains bad data".PHP_EOL;
var_dump($fontMetrics);
}
}
echo "ok";
?>
--EXPECT--
ok
tests/gmagick-081-separateimagechannel.phpt 0000644 00000000461 15173021000 0014637 0 ustar 00 --TEST--
separateImageChannel test
--SKIPIF--
<?php
/* $Id: gmagick-081-separateimagechannel.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->separateImageChannel(1);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-121_deconstructGif_basic.phpt 0000644 00000004274 15173021000 0014706 0 ustar 00 --TEST--
Test Tutorial, deconstructGif
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods("GmagickDraw", array('circle', 'translate'));
?>
--XFAIL--
GraphicMagick has multiple issues with 'image counts'. It appears to be confused how many images are in the list.
--FILE--
<?php
$aniGif = new \Gmagick();
$aniGif->setFormat("gif");
$circleRadius = 20;
$imageFrames = 6;
$imageSize = 200;
$background = new \Gmagick();
$background->newImage($imageSize, $imageSize, "gray");
$blackWhite = new \Gmagick();
$blackWhite->newImage($imageSize, $imageSize, "white");
$backgroundPalette = clone $background;
$backgroundPalette->quantizeImage(240, \Gmagick::COLORSPACE_RGB, 8, false, false);
$blackWhitePalette = clone $blackWhite;
$blackWhitePalette->quantizeImage(16, \Gmagick::COLORSPACE_RGB, 8, false, false);
$backgroundPalette->addimage($blackWhitePalette);
/*
for($count=0 ; $count<$imageFrames ; $count++) {
echo "Frame: ".$count."\n";
$drawing = new \GmagickDraw();
$drawing->setFillColor('white');
$drawing->setStrokeColor('rgba(64, 64, 64, 0.8)');
$strokeWidth = 4;
$drawing->setStrokeWidth($strokeWidth);
$distanceToMove = $imageSize + (($circleRadius + $strokeWidth) * 2);
$offset = ($distanceToMove * $count / ($imageFrames -1)) - ($circleRadius + $strokeWidth);
$drawing->translate(
$offset,
($imageSize / 2) + ($imageSize / 3 * cos(20 * $count / $imageFrames))
);
$drawing->circle(0, 0, $circleRadius, 0);
$frame = clone $background;
$frame->drawimage($drawing);
$frame->setImageDelay(10);
$frame = new Gmagick();
$frame->newimage( int $width , int $height , string $background [, string $format ] )
$aniGif->addImage($frame);
}
*/
$colors = array(
"Red",
"Orange",
"Yellow",
"Green",
"Indigo",
"Violet",
);
foreach ($colors as $color) {
$frame = new Gmagick();
$frame->newimage(100, 100, $color);
$aniGif->addImage($frame);
}
$aniGif->setImageFormat('gif');
//Even this fails.
//$aniGif->writeImage("./testgif.gif");
$aniGif = $aniGif->deconstructImages();
$bytes = $aniGif->getImagesBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
echo "Ok";
?>
--EXPECTF--
Frame: 0
Frame: 1
Frame: 2
Frame: 3
Frame: 4
Frame: 5
Ok tests/gmagickpixel-006-setcolorcount.phpt 0000644 00000000516 15173021000 0014442 0 ustar 00 --TEST--
Test getColorcount method
--SKIPIF--
<?php
/* $Id: gmagickpixel-003-getcolorcount.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$pixel->setColorCount(2);
echo $pixel->getColorCount();
?>
--EXPECTF--
2 tests/gmagickdraw_034_setClipRule_basic.phpt 0000644 00000002554 15173021000 0015120 0 ustar 00 --TEST--
Test GmagickDraw, setClipRule
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setClipRule($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(2);
//\Gmagick::FILLRULE_EVENODD
//\Gmagick::FILLRULE_NONZERO
$clipPathName = 'testClipPath';
$draw->pushClipPath($clipPathName);
$draw->setClipRule(\Gmagick::FILLRULE_EVENODD);
$draw->rectangle(0, 0, 300, 500);
$draw->rectangle(200, 0, 500, 500);
$draw->popClipPath();
$draw->setClipPath($clipPathName);
$draw->rectangle(200, 200, 300, 300);
$clipRule = $draw->getClipRule();
if ($clipRule !== \Gmagick::FILLRULE_EVENODD) {
echo "Failed to get correct clipRule $clipRule != \Gmagick::FILLRULE_EVENODD \n";
}
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setClipRule($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-088-getimageblob.phpt 0000644 00000000435 15173021000 0013130 0 ustar 00 --TEST--
getimageBlob test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick("magick:rose");
$blob = $gm->getimageBlob();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-031-set_getimagecompose.phpt 0000644 00000000467 15173021001 0014524 0 ustar 00 --TEST--
Set and get image compose
--SKIPIF--
<?php
/* $Id: gmagick-031-set_getimagecompose.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageCompose(1)->getImageCompose();
?>
--EXPECTF--
1 tests/gmagick-078-rollimage.phpt 0000644 00000000422 15173021001 0012456 0 ustar 00 --TEST--
rollImage test
--SKIPIF--
<?php
/* $Id: gmagick-078-rollimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->rollImage(5,5);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-085-stripimage.phpt 0000644 00000000422 15173021001 0012645 0 ustar 00 --TEST--
stripImage test
--SKIPIF--
<?php
/* $Id: gmagick-085-stripimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->stripImage();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-079-rotateimage.phpt 0000644 00000000515 15173021001 0013010 0 ustar 00 --TEST--
rotateImage test
--SKIPIF--
<?php
/* $Id: gmagick-079-rotateimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$gm->rotateImage($color, 0.8);
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw-031-setdashstrokearray_getdashstrokearray.phpt 0000644 00000000617 15173021001 0021264 0 ustar 00 --TEST--
Test set and get stroke dash array
--SKIPIF--
<?php
/* $Id: gmagickdraw-031-setdashstrokearray_getdashstrokearray.phpt 280206 2013-12-14 18:04:00Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setStrokeDashArray(array(3, 2));
print_r($gDraw->getStrokeDashArray());
?>
--EXPECT--
Array
(
[0] => 3
[1] => 2
) tests/gmagickdraw-013-setstrokecolor_getstrokecolor_q16.phpt 0000644 00000000766 15173021002 0020261 0 ustar 00 --TEST--
Test setstrokecolor, getstrokecolor
--SKIPIF--
<?php
/* $Id: gmagickdraw-013-setstrokecolor_getstrokecolor.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 16) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
print_r($gd->setStrokeColor($pixel)->getStrokeColor()->getColor());
?>
--EXPECT--
rgb(65535,65535,65535)
tests/gmagick-022-flip_and_flop_image.phpt 0000644 00000000451 15173021002 0014431 0 ustar 00 --TEST--
Flip and flop image
--SKIPIF--
<?php
/* $Id: gmagick-022-flip_and_flop_image.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->flipImage()->flopImage();
echo "1";
?>
--EXPECTF--
1 tests/gmagick-089-getnumberimages.phpt 0000644 00000000430 15173021002 0013663 0 ustar 00 --TEST--
getNumberImages test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick("magick:rose");
print_r($gm->getNumberImages());
?>
--EXPECTF--
1
tests/gmagick-123_sharpenImage_basic.phpt 0000644 00000000740 15173021002 0014324 0 ustar 00 --TEST--
Test Gmagick, sharpenImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$radius = 5;
$sigma = 1;
function sharpenImage($radius, $sigma) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->sharpenimage($radius, $sigma);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
sharpenImage($radius, $sigma);
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-106-testConstants.phpt 0000644 00000000553 15173021002 0013355 0 ustar 00 --TEST--
Test contants have symbols.
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$reflClass = new ReflectionClass('Gmagick');
// This just checks that the symbols that Gmagick was compiled with
// are actually present.
$constants = $reflClass->getConstants();
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw_041_popDefs_basic.phpt 0000644 00000001742 15173021003 0014264 0 ustar 00 --TEST--
Test GmagickDraw, popDefs
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function popDefs($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setstrokeOpacity(1);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->pushDefs();
$draw->setStrokeColor('white');
$draw->rectangle(50, 50, 200, 200);
$draw->popDefs();
$draw->rectangle(300, 50, 450, 200);
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
popDefs($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-068-modulateimage.phpt 0000644 00000000451 15173021003 0013323 0 ustar 00 --TEST--
modulateImage test
--SKIPIF--
<?php
/* $Id: gmagick-068-modulateimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->modulateImage(0.2, 0.2, 0.2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-006-setfillcolor_getfillcolor_q16.phpt 0000644 00000000752 15173021003 0017315 0 ustar 00 --TEST--
Test setfillcolor, getfillcolor
--SKIPIF--
<?php
/* $Id: gmagickdraw-006-setfillcolor_getfillcolor.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 16) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
print_r($gd->setFillColor($pixel)->getFillColor()->getColor());
?>
--EXPECT--
rgb(65535,65535,65535)
tests/gmagick-117_haldClutImage_basic.phpt 0000644 00000001025 15173021003 0014425 0 ustar 00 --TEST--
Test Gmagick, haldClutImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
function haldClutImage() {
$gmagick = new \Gmagick("magick:logo");
$gmagickPalette = new \Gmagick(__DIR__."/hald_8.png");
//$gmagickPalette->sepiatoneImage(55);
$gmagick->haldClutImage($gmagickPalette);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
haldClutImage() ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-058-getversion.phpt 0000644 00000000423 15173021003 0012671 0 ustar 00 --TEST--
getVersion test
--SKIPIF--
<?php
/* $Id: gmagick-058-getversion.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->getVersion();
echo "ok";
?>
--EXPECTF--
ok
tests/bug_71742.phpt 0000644 00000001750 15173021003 0010117 0 ustar 00 --TEST--
Bug #71742 polyline touched by array_walk
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc');
--FILE--
<?php
$coordinates = [];
foreach (range (0, 100) as $index) {
$coordinates[] = array(
'x' => 2 * $index,
'y' => pow($index, 2)
);
}
$callback = function (&$coordinate) {
$coordinate['y'] = 200 - $coordinate['y'] / 50;
};
array_walk($coordinates, $callback);
$imagick = new GMagick();
$imagick->newImage(200, 200, "white");
$draw = new GmagickDraw();
$draw->setFillColor("none");
$draw->setStrokeColor("black");
//Fatal error in PHP 7, but not in PHP <= 5.6
$draw->polyline($coordinates);
$draw->translate(0, -20);
////Works in PHP 7
$draw->polyline (array_values($coordinates));
$imagick->drawImage($draw);
//$imagick->writeImage(getcwd(). "/test.png");
$imagick->setImageFormat('png');
$bytes = $imagick->getImageBlob();
if (strlen($bytes) <= 0) {
echo "Failed to generate image.";
}
//$imagick->writeImage("./bugTest.png");
echo "Ok";
?>
--EXPECT--
Ok tests/gmagick-118_shaveImage_basic.phpt 0000644 00000000632 15173021003 0013777 0 ustar 00 --TEST--
Test Gmagick, shaveImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
function shaveImage() {
$gmagick = new \Gmagick("magick:logo");
$gmagick->shaveImage(100, 50);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
shaveImage() ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickdraw-009-setfontsize_getfontsize.phpt 0000644 00000000444 15173021004 0016360 0 ustar 00 --TEST--
Test setfontsize, getfontsize
--SKIPIF--
<?php
/* $Id: gmagickdraw-009-setfontsize_getfontsize.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setFontSize(1)->getFontSize();
?>
--EXPECT--
1 tests/gmagick-026-set_getimageblueprimary.phpt 0000644 00000000571 15173021004 0015415 0 ustar 00 --TEST--
Set, get imageblueprimary test
--SKIPIF--
<?php
/* $Id: gmagick-026-set_getimageblueprimary.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setImageBluePrimary(0.2, 0.2)->getImageBluePrimary());
?>
--EXPECTF--
Array
(
[x] => 0.2
[y] => 0.2
) tests/gmagick-032-set_getimagedelay.phpt 0000644 00000000460 15173021004 0014152 0 ustar 00 --TEST--
Set, getimagedelay test
--SKIPIF--
<?php
/* $Id: gmagick-032-set_getimagedelay.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageDelay(2)->getImageDelay();
?>
--EXPECTF--
2 tests/gmagick-098-cloneimage.phpt 0000644 00000000314 15173021004 0012613 0 ustar 00 --TEST--
cloneimage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$cloned = $image->cloneimage();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-025-set_and_getimageckgroundcolor_q16.phpt 0000644 00000001067 15173021004 0017246 0 ustar 00 --TEST--
Test setImageBackgroundColor and getImageBackgroundColor methods
--SKIPIF--
<?php
/* $Id: gmagick-025-set_and_getimageckgroundcolor.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 16) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$color=new GmagickPixel("rgb(255,255,255)");
$pixel = $gm->setImageBackgroundColor($color)->getimagebackgroundcolor();
print_r($pixel->getColor());
?>
--EXPECTF--
rgb(65535,65535,65535)
tests/gmagick-059-hasnextimage.phpt 0000644 00000000431 15173021004 0013162 0 ustar 00 --TEST--
hasNextImage test
--SKIPIF--
<?php
/* $Id: gmagick-059-hasnextimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->hasNextImage();
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-006-annotateimage.phpt 0000644 00000000637 15173021004 0013321 0 ustar 00 --TEST--
Test annotate image
--SKIPIF--
<?php
/* $Id: gmagick-006-annotateimage.phpt 333024 2014-03-17 05:37:54Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$fonts = $gm->queryFonts();
if (!empty($fonts))
$gd->setFont($fonts[0]);
$gm->annotateImage($gd, 5, 15, 0, 'Test Text');
echo "ok";
?>
--EXPECT--
ok
tests/gmagickdraw-024-scale.phpt 0000644 00000000673 15173021004 0012452 0 ustar 00 --TEST--
Test scale
--SKIPIF--
<?php
/* $Id: gmagickdraw-024-scale.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->rectangle(20,20,30,30);
$gd->scale(0.5,0.5);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw-001-setstrokecolor_setstrokewidth.phpt 0000644 00000000607 15173021004 0017600 0 ustar 00 --TEST--
Test set stroke color, set stroke width
--SKIPIF--
<?php
/* $Id: gmagickdraw-001-setstrokecolor_setstrokewidth.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$color = "rgb(255,255,123)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
$gd->setStrokeColor($pixel)->setStrokeWidth(2);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw-008-setfont_getfont.phpt 0000644 00000000504 15173021004 0014566 0 ustar 00 --TEST--
Test setfont, getfont
--SKIPIF--
<?php
/* $Id: gmagickdraw-008-setfont_getfont.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo strstr($gd->setFont(dirname(__FILE__) . "/Vera.ttf")->getFont(),"Vera.ttf");
?>
--EXPECT--
Vera.ttf tests/gmagickdraw-018-point.phpt 0000644 00000000634 15173021004 0012514 0 ustar 00 --TEST--
Test point
--SKIPIF--
<?php
/* $Id: gmagickdraw-018-point.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->point(20,20);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw-028-setlinecap_getlinecap.phpt 0000644 00000000472 15173021004 0015706 0 ustar 00 --TEST--
Test set and get line cap
--SKIPIF--
<?php
/* $Id: gmagickdraw-028-setlinecap_getlinecap.phpt 280206 2013-11-05 12:46:00Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setStrokeLineCap(2);
echo $gDraw->getStrokeLineCap();
?>
--EXPECT--
2
tests/gmagick-030-getimagecolors.phpt 0000644 00000000436 15173021004 0013503 0 ustar 00 --TEST--
Getimagecolors test
--SKIPIF--
<?php
/* $Id: gmagick-030-getimagecolors.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->getImageColors());
?>
--EXPECTF--
3019 tests/gmagick-125_radialBlurImage_basic.phpt 0000644 00000001005 15173021004 0014744 0 ustar 00 --TEST--
Test Gmagick, radialBlurImage
--SKIPIF--
<?php
die("skip - not implemented by GraphicsMagick");
//checkClassMethods('Gmagick', array('radialBlurImage'));
?>
--FILE--
<?php
function radialBlurImage() {
$gmagick = new \Gmagick("magick:logo");
$gmagick->radialBlurImage(3);
$gmagick->radialBlurImage(5);
$gmagick->radialBlurImage(7);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
radialBlurImage() ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickdraw_038_setFontStretch_basic.phpt 0000644 00000003143 15173021004 0015647 0 ustar 00 --TEST--
Test GmagickDraw, setFontStretch
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setFontStretch($fillColor, $strokeColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(36);
$fontStretchTypes = array(
\Gmagick::STRETCH_ULTRACONDENSED,
\Gmagick::STRETCH_CONDENSED,
\Gmagick::STRETCH_SEMICONDENSED,
\Gmagick::STRETCH_SEMIEXPANDED,
\Gmagick::STRETCH_EXPANDED,
\Gmagick::STRETCH_EXTRAEXPANDED,
\Gmagick::STRETCH_ULTRAEXPANDED,
\Gmagick::STRETCH_ANY
);
$offset = 0;
foreach ($fontStretchTypes as $fontStretch) {
$draw->setFontStretch($fontStretch);
$draw->annotate(50, 75 + $offset, "Lorem Ipsum!");
$offset += 50;
$currentFontStretch = $draw->getFontStretch($fontStretch);
if ($currentFontStretch !== $fontStretch) {
echo "Failed to get correct fontStretch $currentFontStretch != $fontStretch \n";
}
}
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setFontStretch($fillColor, $strokeColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-050-set_getimageunits.phpt 0000644 00000000453 15173021004 0014220 0 ustar 00 --TEST--
Set, get imageunits
--SKIPIF--
<?php
/* $Id: gmagick-050-set_getimageunits.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageUnits(2)->getImageUnits();
?>
--EXPECTF--
2 tests/gmagickdraw-017-line.phpt 0000644 00000000640 15173021004 0012306 0 ustar 00 --TEST--
Test line
--SKIPIF--
<?php
/* $Id: gmagickdraw-017-line.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->line(8, 8, 18, 18);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-047-set_getimagescene.phpt 0000644 00000000453 15173021004 0014161 0 ustar 00 --TEST--
Set, get imagescene
--SKIPIF--
<?php
/* $Id: gmagick-047-set_getimagescene.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageScene(1)->getImageScene();
?>
--EXPECTF--
1 tests/gmagickdraw-020-polyline.phpt 0000644 00000001576 15173021004 0013215 0 ustar 00 --TEST--
Test polyline
--SKIPIF--
<?php
/* $Id: gmagickdraw-020-polyline.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$intPoints = array(
array( 'x' => 3, 'y' => 4 ),
array( 'x' => 2, 'y' => 6 ),
array( 'x' => 5, 'y' => 10 ),
array( 'x' => 3, 'y' => 4 )
);
$floatPoints = array(
array( 'x' => 3.5, 'y' => 4.5 ),
array( 'x' => 2.5, 'y' => 6.5 ),
array( 'x' => 5.5, 'y' => 10.5 ),
array( 'x' => 3.5, 'y' => 4.5 )
);
$tests = array(
$intPoints,
$floatPoints
);
foreach ($tests as $polArray) {
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$gd->polyline($polArray);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok".PHP_EOL;
}
?>
--EXPECT--
ok
ok tests/gmagick-002-crop_variations.phpt 0000644 00000000677 15173021004 0013707 0 ustar 00 --TEST--
Test crop with and without an image
--SKIPIF--
<?php
/* $Id: gmagick-002-crop_variations.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose")->cropImage(10, 10, 10, 10);
echo "ok\n--\n";
$gm = new Gmagick();
try {
$gm->cropImage(10, 10, 10, 10);
} catch (GmagickException $e) {
echo "got exception";
}
?>
--EXPECTF--
ok
--
got exception tests/gmagick-004-composite_variations.phpt 0000644 00000001010 15173021004 0014726 0 ustar 00 --TEST--
Test composite variations
--SKIPIF--
<?php
/* $Id: gmagick-004-composite_variations.phpt 294865 2010-02-10 23:50:11Z mkoppanen $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick("magick:rose");
$source = new Gmagick();
try {
$gm->compositeImage($source, Gmagick::COMPOSITE_OVER, 0, 0);
} catch (Exception $e) {
echo "got exception\n";
}
$source->read("magick:rose");
$gm->compositeImage($source, Gmagick::COMPOSITE_OVER, 0, 0);
echo "ok";
?>
--EXPECTF--
got exception
ok tests/gmagick-051-set_getimagewhitepoint.phpt 0000644 00000000560 15173021004 0015250 0 ustar 00 --TEST--
Set, get imagewhitepoint
--SKIPIF--
<?php
/* $Id: gmagick-051-set_getimagewhitepoint.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setImageWhitePoint(0.2, 0.2)->getImageWhitePoint());
?>
--EXPECTF--
Array
(
[x] => 0.2
[y] => 0.2
) tests/gmagick-020-enhanceimage.phpt 0000644 00000000416 15173021004 0013100 0 ustar 00 --TEST--
Enhance
--SKIPIF--
<?php
/* $Id: gmagick-020-enhanceimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->enhanceImage();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-007-blurimage.phpt 0000644 00000000573 15173021004 0012454 0 ustar 00 --TEST--
Test blur image
--SKIPIF--
<?php
/* $Id: gmagick-007-blurimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gm->read("magick:rose");
$gm->blurImage(5, 3);
$gm->writeImage($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-064-magnifyimage.phpt 0000644 00000000430 15173021004 0013135 0 ustar 00 --TEST--
magnifyImage test
--SKIPIF--
<?php
/* $Id: gmagick-064-magnifyimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->magnifyImage();
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw-029-setlinejoin_getlinejoin.phpt 0000644 00000000473 15173021004 0016300 0 ustar 00 --TEST--
Test stroke line join
--SKIPIF--
<?php
/* $Id: gmagickdraw-0229-setlinejoin_getlinejoin.phpt 280206 2013-11-05 12:46:00Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setStrokeLineJoin(2);
echo $gDraw->getStrokeLineJoin();
?>
--EXPECT--
2
tests/gmagick-055-getreleasedate.phpt 0000644 00000000432 15173021004 0013460 0 ustar 00 --TEST--
get releasedate
--SKIPIF--
<?php
/* $Id: gmagick-055-getreleasedate.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->getReleaseDate();
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-129_gettersAndSetters.phpt 0000644 00000004727 15173021004 0014253 0 ustar 00 --TEST--
Test static methods
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$gmagick = new \Gmagick("magick:logo");
$gmagick->getImageVirtualPixelMethod();
$gmagick->getImageBackgroundColor();
$gmagick->getImageBluePrimary();
$gmagick->getImageBorderColor();
$gmagick->getImagesBlob();
$gmagick->getImageColorspace();
$gmagick->getImageCompose();
$gmagick->getImageDelay();
$gmagick->getImageDepth();
$gmagick->getImageCompression();
$gmagick->getImageDispose();
$gmagick->getImageExtrema();
$gmagick->getImageFilename();
$gmagick->getImageFormat();
$gmagick->getImageGamma();
$gmagick->getImageGreenPrimary();
$gmagick->getImageIndex();
$gmagick->getImageInterlaceScheme();
$gmagick->getImageIterations();
$gmagick->getImageMatteColor();
$gmagick->getImageRedPrimary();
$gmagick->getImageRenderingIntent();
$gmagick->getImageResolution();
$gmagick->getImageScene();
$gmagick->getImageBoundingbox(0.1);
$gmagick->getImageFuzz();
$gmagick->getImageSavedType();
$gmagick->getImageType();
$gmagick->getImageUnits();
$gmagick->getImageWhitepoint();
$gmagick->getSamplingfactors();
$gmagick->getSize();
$gmagick->getImageGeometry();
$gmagick->setImageAttribute("comment", "this is a comment");
$gmagick->setImageColormapColor(0, 'red');
$gmagick->setImageMatteColor('pink');
$gmagick->setDepth(16);
$gmagick->setImageFuzz(0.1 * \GMAGICK::QUANTUM);
$gmagick->setImageOption("jpeg", "preserve-settings", "true");
$gmagick->setImageSavedType(\GMAGICK::IMGTYPE_TRUECOLOR);
$gmagick->setResolutionUnits(\GMAGICK::RESOLUTION_PIXELSPERCENTIMETER);
$gmagick->setImageIndex(0);
$gmagick->setInterlaceScheme(\GMAGICK::INTERLACE_PLANE);
$gmagick->setImageCompression(\GMAGICK::COMPRESSION_NO);
$gmagick->setImageFormat("BMP");
$gmagick->setResourceLimit(\GMAGICK::RESOURCETYPE_MEMORY, 16*1024*1024);
$gmagick->getImageAttribute("comment");
$gmagick->getImageChannelExtrema(\GMAGICK::CHANNEL_RED);
$gmagick->getImageChannelMean(\GMAGICK::CHANNEL_RED);
$gmagick->getImageColormapColor(0);
$gmagick->getImageChannelDepth(\GMAGICK::CHANNEL_RED);
$gmagick->getResourceLimit(\GMAGICK::RESOURCETYPE_MEMORY);
if (method_exists($gmagick, 'setImageGravity')) {
$gmagick->setImageGravity(\GMAGICK::GRAVITY_SOUTHWEST);
}
if (method_exists($gmagick, 'getImageGravity')) {
$gmagick->getImageGravity();
}
if (method_exists($gmagick, 'getImagePage')) {
$gmagick->getImagePage();
}
// Don't know how to call this successfully.
// $gmagick->get ImageProfile("ICC");
echo 'ok';
?>
--EXPECT--
ok tests/gmagickdraw-026-setgravity_getgravity.phpt 0000644 00000000552 15173021004 0016027 0 ustar 00 --TEST--
Test affine
--SKIPIF--
<?php
/* $Id: gmagickdraw-025-affine.phpt 280206 2010-08-07 12:46:00Z vito $ */
require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods(
'GmagickDraw',
array('setGravity', 'getGravity')
);
?>
--FILE--
<?php
$gDraw = new GmagickDraw();
$gDraw->setGravity(2);
echo $gDraw->getGravity();
?>
--EXPECT--
2
tests/gmagick-018-edgeimage.phpt 0000644 00000000410 15173021004 0012404 0 ustar 00 --TEST--
Edge
--SKIPIF--
<?php
/* $Id: gmagick-018-edgeimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->edgeImage(0.8);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-124__reduceNoiseImage_basic.phpt 0000644 00000001033 15173021004 0015267 0 ustar 00 --TEST--
Test Gmagick, reduceNoiseImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods('Gmagick', array('reduceNoiseImage'));
?>
--FILE--
<?php
$reduceNoise = 5;
function reduceNoiseImage($reduceNoise) {
$gmagick = new \Gmagick("magick:logo");
@$gmagick->reduceNoiseImage($reduceNoise);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
reduceNoiseImage($reduceNoise) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickpixel-001-setcolor_getcolor.phpt 0000644 00000001053 15173021004 0015263 0 ustar 00 --TEST--
Test setColor and getColor methods
--SKIPIF--
<?php
/* $Id: gmagickpixel-001-setcolor_getcolor.phpt 331869 2013-10-20 11:27:00Z remi $ */
if(!extension_loaded('gmagick')) die('skip');
if (Gmagick::QUANTUM_DEPTH != 8) die('skip QUANTUM_DEPTH='.Gmagick::QUANTUM_DEPTH);
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
echo strcmp($color, $pixel->getColor()) . "\n";
var_dump($pixel->setColor($pixel->getColor()));
echo strcmp($color, $pixel->getColor()) . "\n";
?>
--EXPECTF--
0
object(GmagickPixel)#%d (%d) {
}
0
tests/gmagick-054-getquantumdepth.phpt 0000644 00000001352 15173021004 0013722 0 ustar 00 --TEST--
get quantumdepth
--SKIPIF--
<?php
/* $Id: gmagick-054-getquantumdepth.phpt 331865 2013-10-19 09:28:23Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$q=$gm->getQuantumDepth();
if (is_array($q) && count($q)==2 && isset($q['quantumDepthLong']) && isset($q['quantumDepthString'])) {
echo "Struct OK\n";
if ($q['quantumDepthLong']=='8' && $q['quantumDepthString']=='Q8') {
echo "Quantum OK\n";
} else if ($q['quantumDepthLong']=='16' && $q['quantumDepthString']=='Q16') {
echo "Quantum OK\n";
} else {
echo "Quantum KO\n";
print_r($q);
}
} else {
echo "Struct KO\n";
print_r($q);
}
?>
--EXPECTF--
Struct OK
Quantum OK tests/gmagick-128_staticMethods.phpt 0000644 00000000620 15173021004 0013377 0 ustar 00 --TEST--
Test static methods
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$gmagick = new Gmagick ();
//echo gettype (Gmagick::queryFormats ()) . PHP_EOL;
echo gettype ($gmagick->queryFormats ()) . PHP_EOL;
//echo gettype (Gmagick::queryFonts ()) . PHP_EOL;
echo gettype ($gmagick->queryFonts ()) . PHP_EOL;
echo 'success';
?>
--EXPECT--
array
array
success tests/gmagick-119_thumbnail_fill.phpt 0000644 00000000777 15173021004 0013572 0 ustar 00 --TEST--
Test filling thumbnail with color
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc');
$v = Gmagick::getVersion();
if ($v['versionNumber'] < 0x632)
die ('skip too old ImageMagick');
if ($v ['versionNumber'] >= 0x660 && $v ['versionNumber'] < 0x670)
die ('skip seems to be broken in this version of ImageMagick');
?>
--FILE--
<?php
$gmagick = new Gmagick("magick:logo");
$gmagick->setImageBackgroundColor("pink");
$gmagick->thumbnailImage(200, 200, true);
echo "ok"
?>
--EXPECT--
ok tests/gmagick-012-chopimage.phpt 0000644 00000000554 15173021004 0012434 0 ustar 00 --TEST--
Test chop image
--SKIPIF--
<?php
/* $Id: gmagick-012-chopimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm->read("magick:rose");
$gm->chopImage(10, 10, 0, 0);
$gm->write($filename);
echo "ok";
?>
--EXPECTF--
ok tests/gmagickdraw-011-setfontweight_getfontweight.phpt 0000644 00000000464 15173021004 0017205 0 ustar 00 --TEST--
Test setfontweight, getfontweight
--SKIPIF--
<?php
/* $Id: gmagickdraw-011-setfontweight_getfontweight.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gd = new GMagickDraw();
echo $gd->setFontWeight(101)->getFontWeight();
?>
--EXPECT--
101 tests/gmagick-108_adaptiveThresholdImage_basic.phpt 0000644 00000001251 15173021004 0016341 0 ustar 00 --TEST--
Test Gmagick, adaptiveThresholdImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$width = 50;
$height = 20;
$adaptiveOffset = 0.125;
function adaptiveThresholdImage($width, $height, $adaptiveOffset) {
$gmagick = new \Gmagick('magick:rose');
$adaptiveOffsetQuantum = intval($adaptiveOffset * \Gmagick::QUANTUM);
$gmagick->adaptiveThresholdImage($width, $height, $adaptiveOffsetQuantum);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
adaptiveThresholdImage($width, $height, $adaptiveOffset) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-008-addimage.phpt 0000644 00000000455 15173021004 0012240 0 ustar 00 --TEST--
Test add image
--SKIPIF--
<?php
/* $Id: gmagick-008-addimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new GMagick();
$image = new GMagick();
$image->read("magick:rose");
$gm->addImage($image);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw-003-annotate.phpt 0000644 00000000710 15173021004 0013161 0 ustar 00 --TEST--
Test annotate
--SKIPIF--
<?php
/* $Id: gmagickdraw-003-annotate.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");//->write($filename);
$gd->annotate(10, 20, "Test Text");
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/gmagick-109_affineTransformImage_basic.phpt 0000644 00000001300 15173021004 0016007 0 ustar 00 --TEST--
Test Gmagick, affineTransformImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
function affineTransformImage() {
$gmagick = new \Gmagick("magick:logo");
$draw = new \GmagickDraw();
$angle = 40 ;
$affineRotate = array(
"sx" => cos($angle), "sy" => cos($angle),
"rx" => sin($angle), "ry" => -sin($angle),
"tx" => 0, "ty" => 0,
);
$draw->affine($affineRotate);
$gmagick->affineTransformImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
affineTransformImage() ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-033-set_getimagedepth.phpt 0000644 00000000452 15173021004 0014162 0 ustar 00 --TEST--
Set, getimagedepth
--SKIPIF--
<?php
/* $Id: gmagick-033-set_getimagedepth.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->setImageDepth(2)->getImageDepth();
?>
--EXPECTF--
2 tests/gmagick-095-negateimage.phpt 0000644 00000000310 15173021004 0012747 0 ustar 00 --TEST--
negateImage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->negateImage(TRUE);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-046-set_getimagerresolution.phpt 0000644 00000000560 15173021004 0015447 0 ustar 00 --TEST--
Set, get imageresolution
--SKIPIF--
<?php
/* $Id: gmagick-046-set_getimagerresolution.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setImageResolution(0.2,0.2)->getImageResolution());
?>
--EXPECTF--
Array
(
[x] => 0.2
[y] => 0.2
) tests/gmagick-009-addimagenoise.phpt 0000644 00000000464 15173021004 0013277 0 ustar 00 --TEST--
Test addnoiseimage image
--SKIPIF--
<?php
/* $Id: gmagick-009-addimagenoise.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new GMagick();
$gm->read("magick:rose");
$gm->addNoiseImage(Gmagick::COLOR_BLACK);
echo "ok";
?>
--EXPECT--
ok tests/gmagickdraw_043_setViewBox_basic.phpt 0000644 00000002456 15173021004 0014771 0 ustar 00 --TEST--
Test GmagickDraw, setViewBox
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
function setViewBox($strokeColor, $fillColor, $backgroundColor) {
$draw = new \GmagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
/*
Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
*/
$draw->circle(250, 250, 250, 0);
$draw->setviewbox(0, 0, 200, 200);
$draw->circle(125, 250, 250, 250);
$draw->translate(250, 125);
$draw->circle(0, 0, 125, 0);
$gmagick = new \Gmagick();
$gmagick->newImage(500, 500, $backgroundColor);
$gmagick->setImageFormat("png");
$gmagick->drawImage($draw);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
setViewBox($strokeColor, $fillColor, $backgroundColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-115_equalizeImage_case2.phpt 0000644 00000001223 15173021004 0014417 0 ustar 00 --TEST--
Test Gmagick, equalizeImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
//This appears to corrupt the image colors?
function extentImage($startX, $startY, $width, $height) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->equalizeImage();
$gmagick->extentImage(
$startX, $startY, $width, $height
);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
$startX = 50;
$startY = 50;
$width = 150;
$height = 150;
extentImage($startX, $startY, $width, $height) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickpixel-004-clone.phpt 0000644 00000000323 15173021004 0012635 0 ustar 00 --TEST--
Test object cloning and get
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
clone $pixel;
?>
--EXPECTF--
tests/gmagick-052-getimagewidth.phpt 0000644 00000000421 15173021004 0013317 0 ustar 00 --TEST--
get imagewidth
--SKIPIF--
<?php
/* $Id: gmagick-052-getimagewidth.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->getImageWidth();
?>
--EXPECTF--
70 tests/gmagick-077-cropthumbnail.phpt 0000644 00000004204 15173021004 0013356 0 ustar 00 --TEST--
cropthumbnail test
--SKIPIF--
<?php
/* $Id: gmagick-077-cropthumbnail.phpt 280549 2009-05-14 21:45:39Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->cropThumbnailImage(3, 3);
//Test the the calculated values are actually correct.
$desired_height = 250;
$imageWidth = 1128;
//Test the the calculated values are actually correct.
$desired_height = 250;
$imageWidth = 1128;
$imageHeight = 1128;
$legacySettings = array(0, 1);
foreach($legacySettings as $legacy) {
for ($desired_width = 245; $desired_width < 255; $desired_width++) {
$gmagick = new Gmagick();
$gmagick->newImage ($imageWidth, $imageHeight, 'blue');
$gmagick->cropThumbnailImage(
$desired_width,
$desired_height,
$legacy
);
$error = false;
$thumbnailImageWidth = $gmagick->getImageWidth();
$thumbnailImageHeight = $gmagick->getImageHeight();
if ($thumbnailImageHeight != $desired_height) {
echo "Incorrect height for desired_width $desired_width imageHeight $imageHeight".PHP_EOL;
$error = true;
}
$expectedWidth = $desired_width;
$expectedHeight = $desired_height;
if ($legacy == true &&
$desired_width == 250 &&
$desired_height == 250) {
// The legacy behaviour is to generate a wrong size for this setting.
// Thumbnail size of 249 x 250 does not matched desired size 250 x 250
// for source image of 1128 x 1128
$expectedWidth = 249;
}
if ($thumbnailImageWidth != $expectedWidth) {
echo "Unexpected width of $thumbnailImageWidth for desired_width $desired_width, expected width is $expectedWidth".PHP_EOL;
$error = true;
}
if ($thumbnailImageHeight != $expectedHeight) {
echo "Unexpected height $thumbnailImageHeight for desired_width $desired_width, expected height is $expectedHeight".PHP_EOL;
$error = true;
}
if ($error) {
printf(
"Thumbnail size of %d x %d does not matched expected size %d x %d for source image of %d x %d. Legacy is %d\n",
$thumbnailImageWidth, $thumbnailImageHeight,
$desired_width, $desired_height,
$imageWidth, $imageHeight,
$legacy
);
}
}
}
echo "ok";
?>
--EXPECTF--
ok
tests/gmagickdraw-032_circle_basic.phpt 0000644 00000002206 15173021004 0014040 0 ustar 00 --TEST--
Test GmagickDraw, circle
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$backgroundColor = 'rgb(225, 225, 225)';
$strokeColor = 'rgb(0, 0, 0)';
$fillColor = 'DodgerBlue2';
$originX = 250;
$originY = 250;
$endX = 400;
$endY = 400;
function circle($strokeColor, $fillColor, $backgroundColor, $originX, $originY, $endX, $endY) {
//Create a GmagickDraw object to draw into.
$draw = new \GmagickDraw();
$strokeColor = new \GmagickPixel($strokeColor);
$fillColor = new \GmagickPixel($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->circle($originX, $originY, $endX, $endY);
$imagick = new \Gmagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
$bytes = $imagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
circle($strokeColor, $fillColor, $backgroundColor, $originX, $originY, $endX, $endY) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickdraw-002-ellipse.phpt 0000644 00000000546 15173021004 0013013 0 ustar 00 --TEST--
Test ellipse
--SKIPIF--
<?php
/* $Id: gmagickdraw-002-ellipse.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$color = "rgb(255,255,255)";
$pixel = new GmagickPixel($color);
$gd = new GMagickDraw();
$gd->setFillColor($pixel)->ellipse( 200, 100, 50, 50, 0, 360 );
echo "ok";
?>
--EXPECT--
ok tests/gmagick-107_setimagevirtualpixelmethod.phpt 0000644 00000002736 15173021004 0016243 0 ustar 00 --TEST--
Test Tutorial, edgeExtend
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$virtualPixelType = 5;
function edgeExtend($virtualPixelType) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->setImageVirtualPixelMethod($virtualPixelType);
$gmagick->scaleimage(400, 300, true);
$gmagick->setimagebackgroundcolor('pink');
$desiredWidth = 600;
$originalWidth = $gmagick->getImageWidth();
//Make the image be the desired width.
$gmagick->sampleimage($desiredWidth, $gmagick->getImageHeight());
//Now scale, rotate, translate (aka affine project) it
//to be how you want
$points = array(//The x scaling factor is 0.5 when the desired width is double
//the source width
($originalWidth / $desiredWidth), 0, //Don't scale vertically
0, 1, //Offset the image so that it's in the centre
($desiredWidth - $originalWidth) / 2, 0);
$amplitude = 5;
$length = 20;
$gmagick->waveImage($amplitude, $length);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
//Fyi it may be easier to think of the affine transform by
//how it works for a rotation:
//$affineRotate = array(
// "sx" => cos($angle),
// "sy" => cos($angle),
// "rx" => sin($angle),
// "ry" => -sin($angle),
// "tx" => 0,
// "ty" => 0,
//);
}
edgeExtend($virtualPixelType) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-116_waveImage_basic.phpt 0000644 00000000746 15173021004 0013640 0 ustar 00 --TEST--
Test Gmagick, waveImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$amplitude = 5;
$length = 20;
function waveImage($amplitude, $length) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->waveImage($amplitude, $length);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
waveImage($amplitude, $length) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-048-getimagesignature.phpt 0000644 00000000540 15173021004 0014210 0 ustar 00 --TEST--
Set, get imagesignature
--SKIPIF--
<?php
/* $Id: gmagick-048-getimagesignature.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
echo $gm->getImageSignature();
?>
--EXPECTF--
8b19185a62241bd7b79ecf3f619711f4ebbedd73eaeca0366f05778762b6614f tests/gmagick-082-shearimage.phpt 0000644 00000000517 15173021004 0012613 0 ustar 00 --TEST--
shearImage test
--SKIPIF--
<?php
/* $Id: gmagick-082-shearimage.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$color=new GmagickPixel("rgb(255,255,255)");
$gm->read("magick:rose");
$gm->shearImage($color, 0.2, 0.2);
echo "ok";
?>
--EXPECTF--
ok tests/gmagick-057-set_getsize.phpt 0000644 00000000515 15173021004 0013033 0 ustar 00 --TEST--
set,get size test
--SKIPIF--
<?php
/* $Id: gmagick-057-set_getsize.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
print_r($gm->setSize(20, 20)->getSize());
?>
--EXPECTF--
Array
(
[columns] => 20
[rows] => 20
) tests/gmagick-094-thresholdimage.phpt 0000644 00000000313 15173021004 0013502 0 ustar 00 --TEST--
thresholdImage test
--SKIPIF--
<?php
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$image = new Gmagick('magick:rose');
$image->thresholdImage(2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-110_blackThresholdImage_basic.phpt 0000644 00000001014 15173021004 0015606 0 ustar 00 --TEST--
Test Gmagick, blackThresholdImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$thresholdColor = 'rgb(127, 127, 127)';
function blackThresholdImage($thresholdColor) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->blackthresholdimage($thresholdColor);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
blackThresholdImage($thresholdColor) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagick-087-setcompressionquality.phpt 0000644 00000000465 15173021004 0015203 0 ustar 00 --TEST--
setCompressionQuality test
--SKIPIF--
<?php
/* $Id: gmagick-086-setcompressionquality.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->setCompressionQuality(2);
echo "ok";
?>
--EXPECTF--
ok
tests/gmagick-111_whiteThresholdImage_basic.phpt 0000644 00000000750 15173021004 0015661 0 ustar 00 --TEST--
Test Gmagick, whiteThresholdImage
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x675;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$color = 'rgb(127, 127, 127)';
function whiteThresholdImage($color) {
$gmagick = new \Gmagick("magick:logo");
$gmagick->whiteThresholdImage($color);
$bytes = $gmagick->getImageBlob();
if (strlen($bytes) <= 0) { echo "Failed to generate image.";}
}
whiteThresholdImage($color) ;
echo "Ok";
?>
--EXPECTF--
Ok tests/gmagickdraw-019-polygon.phpt 0000644 00000001057 15173021004 0013053 0 ustar 00 --TEST--
Test polygon
--SKIPIF--
<?php
/* $Id: gmagickdraw-019-polygon.phpt 280206 2009-05-09 18:22:48Z vito $ */
if(!extension_loaded('gmagick')) die('skip');
?>
--FILE--
<?php
$filename = dirname(__FILE__) . '/test_constructor.jpg';
$gm = new GMagick();
$gd = new GMagickDraw();
$gm->read("magick:rose");
$polArray = array( array( 'x' => 3, 'y' => 4 ), array( 'x' => 2, 'y' => 6 ) ,array( 'x' => 5, 'y' => 10 ), array( 'x' => 3, 'y' => 4 ));
$gd->polygon($polArray);
$gm->drawImage($gd);
$gm->write($filename);
unlink($filename);
echo "ok";
?>
--EXPECT--
ok tests/hald_8.png 0000644 00000024626 15173021004 0007556 0 ustar 00 �PNG
IHDR +��� gAMA ���a cHRM z&