當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ImagickDraw::setClipUnits方法代碼示例

本文整理匯總了PHP中ImagickDraw::setClipUnits方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImagickDraw::setClipUnits方法的具體用法?PHP ImagickDraw::setClipUnits怎麽用?PHP ImagickDraw::setClipUnits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ImagickDraw的用法示例。


在下文中一共展示了ImagickDraw::setClipUnits方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setClipUnits

function setClipUnits($strokeColor, $fillColor, $backgroundColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeOpacity(1);
    $draw->setStrokeWidth(2);
    $clipPathName = 'testClipPath';
    $draw->setClipUnits(\Imagick::RESOLUTION_PIXELSPERINCH);
    $draw->pushClipPath($clipPathName);
    $draw->rectangle(0, 0, 250, 250);
    $draw->popClipPath();
    $draw->setClipPath($clipPathName);
    //RESOLUTION_PIXELSPERINCH
    //RESOLUTION_PIXELSPERCENTIMETER
    $draw->rectangle(200, 200, 300, 300);
    $imagick = new \Imagick();
    $imagick->newImage(500, 500, $backgroundColor);
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}
開發者ID:sdmmember,項目名稱:Imagick-demos,代碼行數:23,代碼來源:functions.php

示例2: ImagickDraw

<?php

$draw = new ImagickDraw();
// clip
$draw->setClipRule(Imagick::FILLRULE_EVENODD);
var_dump($draw->getClipRule() === Imagick::FILLRULE_EVENODD);
$draw->setClipUnits(10);
var_dump($draw->getClipUnits());
// fill
$draw->setFillColor('yellow');
var_dump($draw->getFillColor()->getColor());
$draw->setFillOpacity(0.5);
printf("%.2f\n", $draw->getFillOpacity());
$draw->setFillRule(Imagick::FILLRULE_NONZERO);
var_dump($draw->getClipRule() === Imagick::FILLRULE_NONZERO);
// gravity
$draw->setGravity(Imagick::GRAVITY_SOUTHEAST);
var_dump($draw->getGravity() === Imagick::GRAVITY_SOUTHEAST);
// stroke
$draw->setStrokeAntialias(false);
var_dump($draw->getStrokeAntialias());
$draw->setStrokeColor(new ImagickPixel('#F02B88'));
var_dump($draw->getStrokeColor()->getColor());
$draw->setStrokeDashArray(array(1, 2, 3));
var_dump($draw->getStrokeDashArray());
$draw->setStrokeDashOffset(-1);
var_dump($draw->getStrokeDashOffset());
$draw->setStrokeLineCap(Imagick::LINECAP_SQUARE);
var_dump($draw->getStrokeLineCap() === Imagick::LINECAP_SQUARE);
$draw->setStrokeLineJoin(Imagick::LINEJOIN_BEVEL);
var_dump($draw->getStrokeLineJoin() === Imagick::LINEJOIN_BEVEL);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:31,代碼來源:draw_accessor.php


注:本文中的ImagickDraw::setClipUnits方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。