GeeksforGeeks App
Open App
Browser
Continue

# PHP | ImagickDraw skewX() Function

The ImagickDraw::skewX() function is an inbuilt function in PHP which is used to skews the current coordinate system in the horizontal direction.

Syntax:

`bool ImagickDraw::skewX( \$degrees )`

Parameters: This function accepts a single parameter \$degrees which is used to hold the degrees to skew.

Return Value: This function does not return any value.

Below programs illustrates the ImagickDraw::skewX() function in PHP:

Program 1:

 `setFillColor(``'blue'``);``\$points` `= [[``'x'` `=> 40 * 5, ``'y'` `=> 10 * 5], ``           ``[``'x'` `=> 70 * 5, ``'y'` `=> 50 * 5], ``           ``[``'x'` `=> 60 * 5, ``'y'` `=> 15 * 5], ];``            ` `// Draw the polygon``\$draw``->polygon(``\$points``);`` ` `// Set the image filled color``\$draw``->setFillColor(``'red'``);``\$draw``->skewX(-60);``\$points` `= [[``'x'` `=> 40 * 5, ``'y'` `=> 10 * 5], ``           ``[``'x'` `=> 70 * 5, ``'y'` `=> 50 * 5], ``           ``[``'x'` `=> 60 * 5, ``'y'` `=> 15 * 5], ];``            ` `// Draw the polygon           ``\$draw``->polygon(``\$points``);``  ` `// Set the image filled color``\$draw``->setFillColor(``'green'``);``\$draw``->skewX(30);``\$points` `= [[``'x'` `=> 40 * 5, ``'y'` `=> 10 * 5], ``           ``[``'x'` `=> 70 * 5, ``'y'` `=> 50 * 5], ``           ``[``'x'` `=> 60 * 5, ``'y'` `=> 15 * 5], ];``            ` `// Draw the polygon           ``\$draw``->polygon(``\$points``);`` ` `// Create new Imagick object``\$image` `= ``new` `Imagick();``\$image``->newImage(500, 500, ``'white'``);`` ` `// Set the image format``\$image``->setImageFormat(``"png"``);``   ` `// Draw the image``\$image``->drawImage(``\$draw``);``   ` `header(``"Content-Type: image/png"``);`` ` `// Display the image``echo` `\$image``->getImageBlob();``?>`

Output:

Program 2:

 `setStrokeColor(``'black'``);`` ` `// Set the filled color``\$draw``->setFillColor(``'red'``);`` ` `// Draw the circle``\$draw``->circle(250, 250, 100, 150); ``  ` `// Set the filled color``\$draw``->setFillColor(``'green'``);`` ` `// Set the skew of X``\$draw``->skewX(30);`` ` `// Draw the circle``\$draw``->circle(250, 250, 100, 150); ``  ` `// Set the filled color``\$draw``->setFillColor(``'yellow'``);`` ` `// Set the skew of X``\$draw``->skewX(30);`` ` `// Draw the circle``\$draw``->circle(250, 250, 100, 150); ``  ` `// Create new imagick object``\$image` `= ``new` `Imagick();`` ` `// Create new image of given size``\$image``->newImage(900, 600, ``'white'``);`` ` `// Set the image format``\$image``->setImageFormat(``"png"``);`` ` `// Draw the image``\$image``->drawImage(``\$draw``);``   ` `header(``"Content-Type: image/png"``);`` ` `// Display the output image``echo` `\$image``->getImageBlob();``?>`

Output:

My Personal Notes arrow_drop_up
Related Tutorials