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

search for in the

ImagickDraw::pushDefs> <ImagickDraw::push
[edit] Last updated: Fri, 24 May 2013

view this page in

ImagickDraw::pushClipPath

(PECL imagick 2.0.0)

ImagickDraw::pushClipPathStarts a clip path definition

Description

bool ImagickDraw::pushClipPath ( string $clip_mask_id )
Warning

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

Starts a clip path definition which is comprised of any number of drawing commands and terminated by a ImagickDraw::popClipPath() command.

Parameters

clip_mask_id

Clip mask Id

Return Values

No value is returned.



add a note add a note User Contributed Notes ImagickDraw::pushClipPath - [1 notes]
up
0
bogdan at moongate dot ro
2 years ago
Here's an interactive example for your enjoyment, featuring two intersecting discs. My version doesn't antialias the clipping path; I suppose YMMV.

<?php

// Simple clip path example
// Bogdan Stancescu

$showClipping=1; // Try setting this to 0!
$showDrawing=1// Try setting this to 0!

// Don't edit below this line (at least until you understand the example)

$showBoth=$showClipping && $showDrawing;
$showAny=$showClipping || $showDrawing;

$image=new Imagick(); // Create image

// Image size
$width=151;
$height=101;

$image->newImage($width, $height, new ImagickPixel('lightgray')); // some visible background

$draw=new ImagickDraw(); // Create draw object

if ($showBoth)
       
$draw->pushClipPath('circle_left'); // Start clipping path

if ($showClipping) {
       
$draw->setFillColor('red'); // The color doesn't matter if we clip
       
$draw->circle(50,50,50,0); // A circle that occupies 100x100px on the left
}

if (
$showBoth) {
       
$draw->popClipPath(); // Finish clipping path
       
$draw->setClipPath('circle_left'); // Use the clipping path above
}

if (
$showDrawing) {
       
$draw->setFillColor('navy'); // This is the actual drawing color
       
$draw->circle(100,50,100,0); // A circle that occupies 100x100px on the right
}

if (
$showAny)
       
$image->drawImage($draw); // Render $draw unto $image

$image->setImageFormat('png'); // Tell ImageMagick how to render this
header("Content-Type: image/png"); // Tell the browser how to render this

echo $image; // Render the image into the browser
?>

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