Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: PDF_shading - Manual
[go: Go Back, main page]

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

search for in the

PDF_shfill" width="11" height="7"/> <PDF_shading_pattern
Last updated: Wed, 01 Nov 2006
view this page in

PDF_shading

(PECL)

PDF_shading -- 混色を定義する

説明

int PDF_shading ( resource pdfdoc, string shtype, float x0, float y0, float x1, float y1, float c1, float c2, float c3, float c4, string optlist )

現在の塗りつぶし色と他の色との混色を定義します。

この関数は、PDF 1.4 以降で使用可能です。



add a note add a note User Contributed Notes
PDF_shading
Mike Zmuda
11-May-2006 08:22
<?php
//Here be the circle code... Arrrrr
//Notes:
//        The shading command can create a simple shaded
//        circle, a donut (mmmmm.... donuts....,) or a circle
//        with a hi-lite (aka offset shade.)
//
//        A simple circle is just two circles with the same origin,
//        in which one has a radius of x, and the other has a
//        radius of 0.
//
//        A donut is a circle with two circles with the same
//        origin, in which one has a radius of x, and the
//        other has a radius of y (presumably, non-zero.)
//
//        A hi-lit circle is more like a sphere in that is has an
//        area (presumably a highlight,) which is off-center.

//Standard php5 init routines.
//    NOTE: For php4, do pdf_[commandname]($p,.....)
//                - example: PDF_set_info($p,"Title", "Moe");

$p = new PDFlib();
if (
$p->begin_document("", "") == 0) {
     die(
"Error: " . $p->get_errmsg());
}
$p->set_info("Creator", "Homer");
$p->set_info("Author", "Lisa");
$p->set_info("Title", "Simpsons Circle");
$p->begin_page_ext(612, 792, ""); // This is letter.

//Smart idea to set up clipping:
$p->save();
//Set up clipping rectangle at pos (100,100) with wid/hei=100.
$p->rect(100,600,100,100);
//Designate it a CLIPPING rectangle.
$p->clip();

//Simple shaded circle
//  radial = circular.      (axial = linear)
//  Origin of first circle = 150,650
//  Origin of second circle = 150,650
//  Hilite color = 1 (full on in a grayscale image = white.)
//  0,0,0 = the rest of the color pallatte.
//  options: "r0=50 r1=0":
//      Radius of circle "0" = 50.
//      Radius of circle "1" = 0. (in other words, not a donut!)
$shading=$p->shading("radial", 150, 650, 150, 650, 1, 0, 0, 0, "r0=50 r1=0");
//This command actually does the shading.
$p->shfill($shading);
//Restore after saving...
$p->restore();

//Simple, non-offset (aka "funky") donut. (mmmmmm....)
// Again, set up clipping rect.
$p->save();
// This time at pos 300, 600 with width & height at 100 ea.
$p->rect(300,600,100,100);
$p->clip();

//Le Donut
//  radial = circular
//  Origin of first circle = 350,650
//  Origin of second circle = 350,650
//  Hilite color = 1 (white)
//  0,0,0 = the rest of the color pallatte.
//  options: "r0=50 r1=25":
//      Radius of circle "0" = 50.
//      Radius of circle "1" = 25. (in other words, a donut!)
$shading=$p->shading("radial", 350, 650, 350, 650, 1, 0, 0, 0, "r0=50 r1=25");
$p->shfill($shading);
$p->restore();

//And finally, the hilight sphere / orb of death... whatever.
// Again, set up clipping rect...
$p->save();
$p->rect(500,600,100,100);
$p->clip();

//Simple shaded circle
//  radial = circular.
//  Origin of first circle = 550,650
//  Origin of second circle = 575,675
//  Hilite color = 1
//  0,0,0 = the rest of the color pallatte.
//  options: "r0=50 r1=0":
//      Radius of circle "0" = 50.
//      Radius of circle "1" = 0. (a solid)
$shading=$p->shading("radial", 550, 650, 575, 675, 1, 0, 0, 0, "r0=50 r1=0");
$p->shfill($shading);
$p->restore();

//Send the end-of-page routines.
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=CircTest.pdf");
print
$buf;
?>

PDF_shfill" width="11" height="7"/> <PDF_shading_pattern
Last updated: Wed, 01 Nov 2006
 
 
show source | credits | sitemap | contact | advertising | mirror sites