在线文档教程
PHP
Image/ImageMagick

ImagickDraw::setViewbox

ImagickDraw::setViewbox

(PECL imagick 2.0.0)

ImagickDraw::setViewbox — Sets the overall canvas size

Description

bool ImagickDraw::setViewbox ( int $x1 , int $y1 , int $x2 , int $y2 )

Warning

This function is currently not documented; only its argument list is available.

Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.

Parameters

x1

left x coordinate

y1

left y coordinate

x2

right x coordinate

y2

right y coordinate

Return Values

No value is returned.

Examples

Example #1 ImagickDraw::setViewBox()

<?php function setViewBox($strokeColor, $fillColor, $backgroundColor) {     $draw = new \ImagickDraw(     $draw->setStrokeColor($strokeColor     $draw->setFillColor($fillColor     $draw->setStrokeWidth(2     $draw->setFontSize(72     /*           Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.           */     $draw->circle(250, 250, 250, 0     $draw->setviewbox(0, 0, 200, 200     $draw->circle(125, 250, 250, 250     $draw->translate(250, 125     $draw->circle(0, 0, 125, 0     $imagick = new \Imagick(     $imagick->newImage(500, 500, $backgroundColor     $imagick->setImageFormat("png"     $imagick->drawImage($draw     header("Content-Type: image/png"     echo $imagick->getImageBlob( } ?>

← ImagickDraw::setVectorGraphics

ImagickDraw::skewX →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/imagickdraw.setviewbox.php