HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

clear

  construct →
Clears the ImagickPixel object, leaving it in a fresh state. This also unsets any color associated with the object.

Honestly, doesn't do much useful. It appears to reset the colorspace setting of the ImagickPixel to sRGBColorspace and clear an internal exception setting. I'd recommend not using it.


Example

function clear()
{
    $draw = new \ImagickDraw();

    $strokeColor = new \ImagickPixel('black');
    $fillColor = new \ImagickPixel();
    $fillColor->setColor('rgba(100%, 75%, 0%, 1.0)');

    $fillColor->clear();

    $draw->setstrokewidth(3.0);
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->rectangle(200, 200, 300, 300);

    $image = new \Imagick();
    $image->newImage(500, 500, "SteelBlue2");
    $image->setImageFormat("png");

    $image->drawImage($draw);

    header("Content-Type: image/png");
    echo $image->getImageBlob();
}