ImageMagick ImagickDraw::setViewbox

(PECL imagick 2, PECL imagick 3)

ImagickDraw::setViewbox — 전체 캔버스 크기를 설정합니다.


설명

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

경고 이 함수는 현재 문서화되어 있지 않습니다. 해당 인수 목록만 사용할 수 있습니다.

그리기 벡터 데이터로 기록할 전체 캔버스 크기를 설정합니다. 일반적으로 캔버스 이미지와 동일한 크기를 사용하여 지정됩니다. 벡터 데이터가 SVG 또는 MVG 형식으로 저장될 때 뷰박스는 뷰어가 벡터 데이터를 렌더링할 캔버스 이미지의 크기를 지정하는 데 사용됩니다.


매개변수

x1
left x coordinate
y1
left y coordinate
x2
right x coordinate
y2
right y coordinate

반환 값

값이 반환되지 않습니다.


Examples

예제 #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();
}

?>