downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ImagickDraw::render> <ImagickDraw::pushPattern
[edit] Last updated: Fri, 25 May 2012

view this page in

ImagickDraw::rectangle

(PECL imagick 2.0.0)

ImagickDraw::rectangle矩形を描画する

説明

bool ImagickDraw::rectangle ( float $x1 , float $y1 , float $x2 , float $y2 )
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

2 つの座標を与え、現在の枠線や線幅、塗りつぶしの設定を使用して矩形を描画します。

パラメータ

x1

左上の角の x 座標。

y1

左上の角の y 座標。

x2

右下の角の x 座標。

y2

右下の角の y 座標。

返り値

値を返しません。



add a note add a note User Contributed Notes ImagickDraw::rectangle
garym at binaryfarm dot com 28-Feb-2010 09:32
<?php

// Draw a simple rectangle or three for the newbies.
// I'm trying to comment these as best I can for a non-OOP person.
// commets or criticism are welcome. Gary Melander

$image = new Imagick();    // Create a new instance an $image class

$width 600;        // Some necessary dimensions
$height = 400;

// $image class now inherits some attributes. i.e. Dimensions, bkgcolor...
$image->newImage( $width, $height, new ImagickPixel( 'lightgray' ) );

$draw = new ImagickDraw();    //Create a new drawing class (?)

$draw->setFillColor('wheat');    // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'green' ) );
$draw->rectangle( 100, 100, 200, 200 );    // Draw the rectangle

// Lets draw another
$draw->setFillColor('navy');    // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'yellow' ) );
$draw->setStrokeWidth(4);
$draw->rectangle( 150, 225, 350, 300 );    // Draw the rectangle

// and another
$draw->setFillColor('magenta');    // Set up some colors to use for fill and outline
$draw->setStrokeColor( new ImagickPixel( 'cyan' ) );
$draw->setStrokeWidth(2);
$draw->rectangle( 380, 100, 400, 350 );    // Draw the rectangle

$image->drawImage( $draw );    // Apply the stuff from the draw class to the image canvas

$image->setImageFormat('jpg');    // Give the image a format

header('Content-type: image/jpeg');     // Prepare the web browser to display an image
echo $image;                // Publish it to the world!

//$image->writeImage('someimage.jpg");    // ...Or just write it to a file...

?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites