# ImagickDraw::setViewbox

(PECL imagick 2, PECL imagick 3)

ImagickDraw::setViewbox — Sets the overall canvas size

### 说明

public ImagickDraw::setViewbox(
int `$left_x`,
int `$top_y`,
int `$right_x`,
int `$bottom_y`
): bool
警告

本函数还未编写文档，仅有参数列表。

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.

### 参数

`left_x`

  left x coordinate

`top_y`

  left y coordinate

`right_x`

  right x coordinate

`bottom_y`

  right y coordinate

### 返回值

没有返回值。

### 示例

示例 #1 ImagickDraw::setViewBox() example

`<?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();
}
?>`
`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open