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


PHP ImagickDraw::setStrokeLineCap方法代碼示例

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


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

示例1: setStrokeLineCap

function setStrokeLineCap($strokeColor, $fillColor, $backgroundColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(25);
    $lineTypes = [\Imagick::LINECAP_BUTT, \Imagick::LINECAP_ROUND, \Imagick::LINECAP_SQUARE];
    $offset = 0;
    foreach ($lineTypes as $lineType) {
        $draw->setStrokeLineCap($lineType);
        $draw->line(50 + $offset, 50, 50 + $offset, 250);
        $offset += 50;
    }
    $imagick = new \Imagick();
    $imagick->newImage(300, 300, $backgroundColor);
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}
開發者ID:sdmmember,項目名稱:Imagick-demos,代碼行數:20,代碼來源:functions.php

示例2: brushpng

 public function brushpng($color, $size, $brushpath)
 {
     $info = $this->_handle->getImageGeometry();
     $image = new \Imagick();
     $image->newImage($info["width"], $info["height"], "transparent", "png");
     //$image->setImageFormat("png");
     $draw = new \ImagickDraw();
     $pixel = new \ImagickPixel();
     $pixel->setColor("transparent");
     $draw->setFillColor($pixel);
     $pixel->setColor($color);
     $draw->setStrokeColor($pixel);
     $draw->setStrokeWidth($size);
     $draw->setStrokeLineCap(\imagick::LINECAP_ROUND);
     $draw->setStrokeLineJoin(\imagick::LINEJOIN_ROUND);
     $draw->polyline($brushpath);
     $image->drawImage($draw);
     $pixel->destroy();
     $draw->destroy();
     $this->_handle = $image;
 }
開發者ID:locphp,項目名稱:rsf,代碼行數:21,代碼來源:HandleImagek.php

示例3: ImagickPixel

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);
$draw->setStrokeMiterLimit(3);
var_dump($draw->getStrokeMiterLimit());
$draw->setStrokeOpacity(0.9);
printf("%.2f\n", $draw->getStrokeOpacity());
$draw->setStrokeWidth(1.2);
printf("%.2f\n", $draw->getStrokeWidth());
// text
$draw->setTextAlignment(Imagick::ALIGN_CENTER);
var_dump($draw->getTextAlignment() === Imagick::ALIGN_CENTER);
$draw->setTextAntialias(false);
var_dump($draw->getTextAntialias());
$draw->setTextDecoration(Imagick::DECORATION_LINETROUGH);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:31,代碼來源:draw_accessor.php


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