略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ImagickDraw::setViewbox

2024-12-22

ImagickDraw::setViewbox

(PECL imagick 2, PECL imagick 3)

ImagickDraw::setViewboxSets the overall canvas size

说明

public ImagickDraw::setViewbox(
    int $x1,
    int $y1,
    int $x2,
    int $y2
): 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.

参数

x1

left x coordinate

y1

left y coordinate

x2

right x coordinate

y2

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(2502502500);
    
$draw->setviewbox(00200200);
    
$draw->circle(125250250250);
    
$draw->translate(250125);
    
$draw->circle(001250);


    
$imagick = new \Imagick();
    
$imagick->newImage(500500$backgroundColor);
    
$imagick->setImageFormat("png");

    
$imagick->drawImage($draw);

    
header("Content-Type: image/png");
    echo 
$imagick->getImageBlob();
}

?>
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/imagickdraw.setviewbox.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3