当前位置: 首页>>代码示例>>PHP>>正文


PHP ImagickDraw::setStrokeOpacity方法代码示例

本文整理汇总了PHP中ImagickDraw::setStrokeOpacity方法的典型用法代码示例。如果您正苦于以下问题:PHP ImagickDraw::setStrokeOpacity方法的具体用法?PHP ImagickDraw::setStrokeOpacity怎么用?PHP ImagickDraw::setStrokeOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImagickDraw的用法示例。


在下文中一共展示了ImagickDraw::setStrokeOpacity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: perform

 /**
  * Draws an ellipse on the handle
  *
  * @param ImageMagick-object $handle The handle on which the ellipse is drawn
  * @param Zend_Image_Action_DrawEllipse $ellipseObject The object that with all info
  */
 public function perform(Zend_Image_Adapter_ImageMagick $adapter, Zend_Image_Action_DrawEllipse $ellipseObject)
 {
     $draw = new ImagickDraw();
     $strokeColor = (string) $ellipseObject->getStrokeColor();
     $strokeAlpha = $ellipseObject->getStrokeAlpha() * 0.01;
     $draw->setStrokeColor($strokeColor);
     $draw->setStrokeOpacity($strokeAlpha);
     $draw->setStrokeWidth($ellipseObject->getStrokeWidth());
     $strokeDashArray = $ellipseObject->getStrokeDashPattern();
     if (count($strokeDashArray) > 0) {
         $draw->setStrokeDashArray($strokeDashArray);
     }
     $draw->setStrokeDashOffset($ellipseObject->getStrokeDashOffset());
     if ($ellipseObject->filled()) {
         $fillColor = (string) $ellipseObject->getFillColor();
         $draw->setFillColor($fillColor);
         $draw->setFillOpacity($ellipseObject->getFillAlpha() * 0.01);
     } else {
         $draw->setFillOpacity(0);
     }
     $width = $ellipseObject->getWidth();
     $height = $ellipseObject->getHeight();
     $x = $ellipseObject->getLocation()->getX();
     $y = $ellipseObject->getLocation()->getY();
     $draw->ellipse($x, $y, $width / 2, $height / 2, 0, 360);
     $adapter->getHandle()->drawImage($draw);
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:33,代码来源:DrawEllipse.php

示例2: renderImage

 public function renderImage()
 {
     //Create a ImagickDraw object to draw into.
     $draw = new \ImagickDraw();
     $darkColor = new \ImagickPixel('brown');
     //http://www.imagemagick.org/Usage/compose/#compose_terms
     $draw->setStrokeColor($darkColor);
     $draw->setFillColor('white');
     $draw->setStrokeWidth(2);
     $draw->setFontSize(72);
     $draw->setStrokeOpacity(1);
     $draw->setStrokeColor($darkColor);
     $draw->setStrokeWidth(2);
     $draw->setFont("../fonts/CANDY.TTF");
     $draw->setFontSize(140);
     $draw->setFillColor('none');
     $draw->rectangle(0, 0, 1000, 300);
     $draw->setFillColor('white');
     $draw->annotation(50, 180, "Lorem Ipsum!");
     $imagick = new \Imagick(realpath("images/TestImage.jpg"));
     $draw->composite(\Imagick::COMPOSITE_MULTIPLY, -500, -200, 2000, 600, $imagick);
     //Create an image object which the draw commands can be rendered into
     $imagick = new \Imagick();
     $imagick->newImage(1000, 300, "SteelBlue2");
     $imagick->setImageFormat("png");
     //Render the draw commands in the ImagickDraw object
     //into the image.
     $imagick->drawImage($draw);
     //Send the image to the browser
     header("Content-Type: image/png");
     echo $imagick->getImageBlob();
 }
开发者ID:finelinePG,项目名称:imagick,代码行数:32,代码来源:compositeText.php

示例3: renderImage1

 public function renderImage1()
 {
     $draw = new \ImagickDraw();
     $strokeColor = new \ImagickPixel($this->strokeColor);
     $fillColor = new \ImagickPixel($this->fillColor);
     $draw->setStrokeOpacity(1);
     $draw->setStrokeWidth(1.5);
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     $fillRules = [\Imagick::FILLRULE_NONZERO, \Imagick::FILLRULE_EVENODD];
     $offset = 220;
     for ($x = 0; $x < 2; $x++) {
         $draw->setFillRule($fillRules[$x]);
         $draw->pathStart();
         $draw->pathmovetoabsolute(40 * 5, 10 * 5 + $x * $offset);
         $draw->pathlinetoabsolute(20 * 5, 20 * 5 + $x * $offset);
         $draw->pathlinetoabsolute(70 * 5, 50 * 5 + $x * $offset);
         $draw->pathclose();
         $draw->pathmovetoabsolute(20 * 5, 40 * 5 + $x * $offset);
         $draw->pathlinetoabsolute(70 * 5, 40 * 5 + $x * $offset);
         $draw->pathlinetoabsolute(90 * 5, 10 * 5 + $x * $offset);
         $draw->pathclose();
         $draw->pathfinish();
     }
     //Create an image object which the draw commands can be rendered into
     $image = new \Imagick();
     $image->newImage(500, 500, $this->backgroundColor);
     $image->setImageFormat("png");
     //Render the draw commands in the ImagickDraw object
     //into the image.
     $image->drawImage($draw);
     //Send the image to the browser
     header("Content-Type: image/png");
     echo $image->getImageBlob();
 }
开发者ID:atawsports2,项目名称:Imagick-demos,代码行数:35,代码来源:setFillRule.php

示例4: perform

    /**
     * Draws a polygon on the handle
     *
     * @param ImageMagick-object $handle The handle on which the polygon is drawn
     * @param Zend_Image_Action_DrawPolygon $polygon The object that with all info
     */
    public function perform($handle, Zend_Image_Action_DrawPolygon $polygon) { // As of ZF2.0 / PHP5.3, this can be made static.
        
        $points = $this->_parsePoints($polygon->getPoints());

        if ($polygon->isClosed()){
            //add first point at the end to close
            $points[count($points)] = $points[0];
        }

        $draw = new ImagickDraw();

        $draw->setStrokeColor('#' . $polygon->getStrokeColor()->getHex());

        $draw->setStrokeOpacity($polygon->getStrokeAlpha()/100);
        $draw->setStrokeWidth($polygon->getStrokeWidth());

        $strokeDashArray = $polygon->getStrokeDashPattern();
        if (count($strokeDashArray) > 0){
            $draw->setStrokeDashArray($strokeDashArray);
        }
        $draw->setStrokeDashOffset($polygon->getStrokeDashOffset());

        if($polygon->isFilled()) {
            $fillColor = $polygon->getFillColor();
            $draw->setFillColor('#' . $fillColor->getHex());
            $draw->polygon($points);

        } else {
            //Use transparent fill to render unfilled
            $draw->setFillOpacity(0);
            $draw->polyline($points);
        }

        $handle->getHandle()->drawImage($draw);
    }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:41,代码来源:DrawPolygon.php

示例5: draw

 /**
  * @param ImageInterface $image
  * @return Image
  */
 public function draw($image)
 {
     // Localize vars
     $width = $image->getWidth();
     $height = $image->getHeight();
     $imagick = $image->getCore();
     $draw = new \ImagickDraw();
     $strokeColor = new \ImagickPixel($this->getColor()->getHexString());
     $fillColor = new \ImagickPixel('rgba(0,0,0,0)');
     $draw->setStrokeOpacity(1);
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     list($x1, $y1) = $this->point1;
     list($x2, $y2) = $this->control;
     list($x3, $y3) = $this->point2;
     $draw->pathStart();
     $draw->pathMoveToAbsolute($x1, $y1);
     $draw->pathCurveToQuadraticBezierAbsolute($x2, $y2, $x3, $y3);
     $draw->pathFinish();
     // Render the draw commands in the ImagickDraw object
     $imagick->drawImage($draw);
     $type = $image->getType();
     $file = $image->getImageFile();
     return new Image($imagick, $file, $width, $height, $type);
     // Create new image with updated core
 }
开发者ID:kosinix,项目名称:grafika,代码行数:30,代码来源:QuadraticBezier.php

示例6: blueDiscAlpha

function blueDiscAlpha($width, $height)
{
    $imagick = new Imagick();
    $imagick->newImage($width, $height, 'none');
    $draw = new ImagickDraw();
    $draw->setStrokeOpacity(0);
    $draw->setFillColor('blue');
    $draw->circle(2 * $width / 3, 2 * $height / 3, $width - ($width / 3 - $width / 4), 2 * $height / 3);
    $imagick->drawImage($draw);
    return $imagick;
}
开发者ID:atawsports2,项目名称:Imagick-demos,代码行数:11,代码来源:createSourceImages.php

示例7: perform

 /**
  * Draw a line on the image, returns the GD-handle
  *
  * @param  Zend_Image_Adapter_ImageMagick image resource    $handle Image to work on
  * @param  Zend_Image_Action_DrawLine   $lineObject The object containing all settings needed for drawing a line.
  * @return void
  */
 public function perform(Zend_Image_Adapter_ImageMagick $adapter, Zend_Image_Action_DrawLine $lineObject)
 {
     $handle = $adapter->getHandle();
     $draw = new ImagickDraw();
     $draw->setStrokeWidth($lineObject->getStrokeWidth());
     $color = $lineObject->getStrokeColor();
     $draw->setStrokeColor((string) $color);
     $draw->setStrokeOpacity($lineObject->getStrokeAlpha());
     $draw->line($lineObject->getPointStart()->getX(), $lineObject->getPointStart()->getY(), $lineObject->getPointEnd()->getX(), $lineObject->getPointEnd()->getY());
     $handle->drawImage($draw);
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:18,代码来源:DrawLine.php

示例8: getDraw

 public function getDraw()
 {
     $draw = new \ImagickDraw();
     $strokeColor = new \ImagickPixel($this->strokeColor);
     $fillColor = new \ImagickPixel($this->fillColor);
     $draw->setStrokeOpacity(1);
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     $draw->setStrokeWidth(2);
     return $draw;
 }
开发者ID:spanov,项目名称:test,代码行数:11,代码来源:Shape.php

示例9: draw

 public function draw($image)
 {
     $draw = new \ImagickDraw();
     $draw->setStrokeWidth($this->borderSize);
     if (null !== $this->fillColor) {
         $fillColor = new \ImagickPixel($this->fillColor->getHexString());
         $draw->setFillColor($fillColor);
     } else {
         $draw->setFillOpacity(0);
     }
     if (null !== $this->borderColor) {
         $borderColor = new \ImagickPixel($this->borderColor->getHexString());
         $draw->setStrokeColor($borderColor);
     } else {
         $draw->setStrokeOpacity(0);
     }
     $draw->polygon($this->points());
     $image->getCore()->drawImage($draw);
     return $image;
 }
开发者ID:kosinix,项目名称:grafika,代码行数:20,代码来源:Polygon.php

示例10: draw

 /**
  * @param ImageInterface $image
  * @return Image
  */
 public function draw($image)
 {
     // Localize vars
     $width = $image->getWidth();
     $height = $image->getHeight();
     $imagick = $image->getCore();
     $draw = new \ImagickDraw();
     $strokeColor = new \ImagickPixel($this->getColor()->getHexString());
     $fillColor = new \ImagickPixel('rgba(0,0,0,0)');
     $draw->setStrokeOpacity(1);
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     $points = array(array('x' => $this->point1[0], 'y' => $this->point1[1]), array('x' => $this->control1[0], 'y' => $this->control1[1]), array('x' => $this->control2[0], 'y' => $this->control2[1]), array('x' => $this->point2[0], 'y' => $this->point2[1]));
     $draw->bezier($points);
     // Render the draw commands in the ImagickDraw object
     $imagick->drawImage($draw);
     $type = $image->getType();
     $file = $image->getImageFile();
     return new Image($imagick, $file, $width, $height, $type);
     // Create new image with updated core
 }
开发者ID:kosinix,项目名称:grafika,代码行数:25,代码来源:CubicBezier.php

示例11: renderImage

 function renderImage()
 {
     //Create a ImagickDraw object to draw into.
     $draw = new \ImagickDraw();
     $darkColor = new \ImagickPixel('brown');
     //http://www.imagemagick.org/Usage/compose/#compose_terms
     $draw->setStrokeColor($darkColor);
     $draw->setFillColor('white');
     $draw->setStrokeWidth(2);
     $draw->setFontSize(72);
     $draw->setStrokeOpacity(1);
     $draw->setStrokeColor($darkColor);
     $draw->setStrokeWidth(2);
     $draw->setFont("../fonts/CANDY.TTF");
     $draw->setFontSize(140);
     $draw->setFillColor('none');
     $draw->rectangle(0, 0, 1000, 300);
     $draw->setFillColor('white');
     $draw->annotation(50, 180, "Lorem Ipsum!");
     $imagick = new \Imagick(realpath("images/TestImage.jpg"));
     //        $compositeModes = [
     //
     //            \Imagick::COMPOSITE_NO, \Imagick::COMPOSITE_ADD, \Imagick::COMPOSITE_ATOP, \Imagick::COMPOSITE_BLEND, \Imagick::COMPOSITE_BUMPMAP, \Imagick::COMPOSITE_CLEAR, \Imagick::COMPOSITE_COLORBURN, \Imagick::COMPOSITE_COLORDODGE, \Imagick::COMPOSITE_COLORIZE, \Imagick::COMPOSITE_COPYBLACK, \Imagick::COMPOSITE_COPYBLUE, \Imagick::COMPOSITE_COPY, \Imagick::COMPOSITE_COPYCYAN, \Imagick::COMPOSITE_COPYGREEN, \Imagick::COMPOSITE_COPYMAGENTA, \Imagick::COMPOSITE_COPYOPACITY, \Imagick::COMPOSITE_COPYRED, \Imagick::COMPOSITE_COPYYELLOW, \Imagick::COMPOSITE_DARKEN, \Imagick::COMPOSITE_DSTATOP, \Imagick::COMPOSITE_DST, \Imagick::COMPOSITE_DSTIN, \Imagick::COMPOSITE_DSTOUT, \Imagick::COMPOSITE_DSTOVER, \Imagick::COMPOSITE_DIFFERENCE, \Imagick::COMPOSITE_DISPLACE, \Imagick::COMPOSITE_DISSOLVE, \Imagick::COMPOSITE_EXCLUSION, \Imagick::COMPOSITE_HARDLIGHT, \Imagick::COMPOSITE_HUE, \Imagick::COMPOSITE_IN, \Imagick::COMPOSITE_LIGHTEN, \Imagick::COMPOSITE_LUMINIZE, \Imagick::COMPOSITE_MINUS, \Imagick::COMPOSITE_MODULATE, \Imagick::COMPOSITE_MULTIPLY, \Imagick::COMPOSITE_OUT, \Imagick::COMPOSITE_OVER, \Imagick::COMPOSITE_OVERLAY, \Imagick::COMPOSITE_PLUS, \Imagick::COMPOSITE_REPLACE, \Imagick::COMPOSITE_SATURATE, \Imagick::COMPOSITE_SCREEN, \Imagick::COMPOSITE_SOFTLIGHT, \Imagick::COMPOSITE_SRCATOP, \Imagick::COMPOSITE_SRC, \Imagick::COMPOSITE_SRCIN, \Imagick::COMPOSITE_SRCOUT, \Imagick::COMPOSITE_SRCOVER, \Imagick::COMPOSITE_SUBTRACT, \Imagick::COMPOSITE_THRESHOLD, \Imagick::COMPOSITE_XOR,
     //
     //        ];
     $draw->composite(\Imagick::COMPOSITE_MULTIPLY, -500, -200, 2000, 600, $imagick);
     //Create an image object which the draw commands can be rendered into
     $imagick = new \Imagick();
     $imagick->newImage(1000, 300, "SteelBlue2");
     $imagick->setImageFormat("png");
     //Render the draw commands in the ImagickDraw object
     //into the image.
     $imagick->drawImage($draw);
     //Send the image to the browser
     header("Content-Type: image/png");
     echo $imagick->getImageBlob();
 }
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:37,代码来源:compositeText.php

示例12: draw

 public function draw($image)
 {
     $draw = new \ImagickDraw();
     $draw->setStrokeWidth($this->borderSize);
     if (null !== $this->fillColor) {
         $fillColor = new \ImagickPixel($this->fillColor->getHexString());
         $draw->setFillColor($fillColor);
     } else {
         $draw->setFillOpacity(0);
     }
     if (null !== $this->borderColor) {
         $borderColor = new \ImagickPixel($this->borderColor->getHexString());
         $draw->setStrokeColor($borderColor);
     } else {
         $draw->setStrokeOpacity(0);
     }
     $x1 = $this->pos[0];
     $x2 = $x1 + $this->getWidth();
     $y1 = $this->pos[1];
     $y2 = $y1 + $this->getHeight();
     $draw->rectangle($x1, $y1, $x2, $y2);
     $image->getCore()->drawImage($draw);
     return $image;
 }
开发者ID:kosinix,项目名称:grafika,代码行数:24,代码来源:Rectangle.php

示例13: __getImage

 private static function __getImage($img, $type)
 {
     $client = new Client(Config::get('services.dropbox.token'), Config::get('services.dropbox.appName'));
     $fileSystem = new Filesystem(new DropboxAdapter($client, '/images/'));
     $biggerW = $biggerH = false;
     if ($img->width > $img->height) {
         $biggerW = true;
     } else {
         $biggerH = true;
     }
     $image = $w = $h = null;
     $public_path = public_path($img->path);
     //code minh
     //get image from dropbox
     if ($img->store == 'dropbox') {
         try {
             $file = $fileSystem->read($img->path);
             $public_path = $file;
         } catch (Exception $e) {
             return false;
         }
     }
     //end code
     if (in_array($type, ['with-logo', 'large-thumb'])) {
         if ($biggerW) {
             $w = 450;
         } else {
             $h = 450;
         }
     } else {
         if (in_array($type, ['thumb', 'small-thumb'])) {
             if ($type == 'thumb') {
                 if ($biggerW) {
                     $w = 150;
                 } else {
                     $h = 150;
                 }
             } else {
                 if ($biggerW) {
                     $w = 100;
                 } else {
                     $h = 100;
                 }
             }
         } else {
             if (in_array($type, ['crop', 'newcrop'])) {
                 $h = 300;
                 $w = 300;
                 if ($type == 'newcrop') {
                     $w = 600;
                 }
             }
         }
     }
     try {
         if (in_array($type, ['crop', 'newcrop'])) {
             $image = Image::make($public_path)->fit($w, $h, function ($constraint) {
                 $constraint->aspectRatio();
             });
         } else {
             $image = Image::make($public_path)->resize($w, $h, function ($constraint) {
                 $constraint->aspectRatio();
             });
         }
     } catch (Exception $e) {
         return false;
     }
     if ($type == 'with-logo') {
         if (Cache::has('mask')) {
             $mask = Cache::get('mask');
         } else {
             $mask = Configure::where('ckey', 'mask')->pluck('cvalue');
             if (empty($mask)) {
                 $mask = 'Visual Impact';
             }
             Cache::forever('mask', $mask);
         }
         $size = 50;
         $w = $image->width();
         $h = $image->height();
         $x = round($w / 2);
         $y = round($h / 2);
         $img = Image::canvas($w, $h);
         $string = wordwrap($mask, 15, '|');
         $strings = explode('|', $string);
         $line = 2;
         $i = round($y - count($strings) / 2 * ($size + $line));
         $from = $i - 20;
         foreach ($strings as $string) {
             $draw = new \ImagickDraw();
             $draw->setStrokeAntialias(true);
             $draw->setTextAntialias(true);
             $draw->setFont(public_path('assets' . DS . 'fonts' . DS . 'times.ttf'));
             $draw->setFontSize($size);
             $draw->setFillColor('rgb(0, 0, 0)');
             $draw->setFillOpacity(0.2);
             $draw->setTextAlignment(\Imagick::ALIGN_CENTER);
             $draw->setStrokeColor('#fff');
             $draw->setStrokeOpacity(0.2);
             $draw->setStrokeWidth(1);
//.........这里部分代码省略.........
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:101,代码来源:VIImage.php

示例14: createMask

function createMask()
{
    $draw = new \ImagickDraw();
    $draw->setStrokeOpacity(0);
    $draw->setStrokeColor('rgb(255, 255, 255)');
    $draw->setFillColor('rgb(255, 255, 255)');
    //Draw a circle on the y-axis, with it's centre
    //at x, y that touches the origin
    $draw->circle(250, 250, 220, 250);
    $imagick = new \Imagick();
    $imagick->newImage(512, 512, "black");
    $imagick->drawImage($draw);
    $imagick->gaussianBlurImage(20, 20);
    $imagick->autoLevelImage();
    return $imagick;
}
开发者ID:atawsports2,项目名称:Imagick-demos,代码行数:16,代码来源:functions.php

示例15: ImagickPixel

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);
var_dump($draw->getTextDecoration() === Imagick::DECORATION_LINETROUGH);
$draw->setTextEncoding('UTF-8');
var_dump($draw->getTextEncoding());
$draw->setTextUnderColor('cyan');
var_dump($draw->getTextUnderColor()->getColor());
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:draw_accessor.php


注:本文中的ImagickDraw::setStrokeOpacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。