Exemplo n.º 1
0
        $buffer = sprintf("%.2f, %.2f, %.2f, %.2f", $spot["c1"], $spot["c2"], $spot["c3"], $spot["c4"]);
        PS_show_xy($ps, $buffer, $leftborder, 100 + 10 * 65 + 3);
    } else {
        if (!strcmp($spot["colorspace"], "rgb")) {
            $buffer = sprintf("%.2f, %.2f, %.2f", $spot["c1"], $spot["c2"], $spot["c3"]);
            PS_show_xy($ps, $buffer, $leftborder, 100 + 10 * 65 + 3);
        }
    }
}
$spotcolors[] = array("id" => 0, "name" => "PANTONE Violet C", "colorspace" => "cmyk", "c1" => 0.75, "c2" => 0.9399999999999999, "c3" => 0.0, "c4" => 0.0);
$spotcolors[] = array("id" => 0, "name" => "PANTONE 114 C", "colorspace" => "cmyk", "c1" => 0.0, "c2" => 0.11, "c3" => 0.6899999999999999, "c4" => 0.0);
$spotcolors[] = array("id" => 0, "name" => "PANTONE 5565 C", "colorspace" => "cmyk", "c1" => 0.37, "c2" => 0.0, "c3" => 0.34, "c4" => 0.34);
$spotcolors[] = array("id" => 0, "name" => "RGB Blue", "colorspace" => "rgb", "c1" => 0.0, "c2" => 0.0, "c3" => 1.0, "c4" => 0.0);
$spotcolors[] = array("id" => 0, "name" => "Gray Black", "colorspace" => "gray", "c1" => 0.0, "c2" => 0.0, "c3" => 0.0, "c4" => 0.0);
$ps = PS_new();
if (0 > PS_open_file($ps, "spotcolor.ps")) {
    printf("Cannot open PostScript file\n");
    exit(1);
}
PS_set_parameter($ps, "warning", "true");
PS_set_info($ps, "Creator", __FILE__);
PS_set_info($ps, "Author", "Uwe Steinmann");
PS_set_info($ps, "Title", "Spotcolor demonstration");
PS_set_info($ps, "Keywords", "Spot color");
for ($i = 0; $i < 5; $i++) {
    PS_setcolor($ps, "fill", $spotcolors[$i]["colorspace"], $spotcolors[$i]["c1"], $spotcolors[$i]["c2"], $spotcolors[$i]["c3"], $spotcolors[$i]["c4"]);
    $spotcolors[$i]["id"] = PS_makespotcolor($ps, $spotcolors[$i]["name"], 0);
}
PS_begin_page($ps, 596, 842);
footer($ps, "");
$psfont = PS_findfont($ps, "Helvetica", "", 0);
Exemplo n.º 2
0
<?php

define(LEFT_BORDER, 50);
function footer($p, $text)
{
    $psfont = PS_findfont($p, "Helvetica", "", 0);
    PS_setfont($p, $psfont, 8.0);
    $buffer = sprintf("This file has been created with pslib %s", PS_get_parameter($p, "dottedversion", 0.0));
    PS_show_xy($p, $buffer, LEFT_BORDER, 25);
}
$ps = PS_new();
if (0 > PS_open_file($ps, "shading.ps")) {
    printf("Cannot open PostScript file\n");
    exit(1);
}
PS_set_parameter($ps, "warning", "false");
PS_set_value($ps, "parskip", 10);
PS_set_info($ps, "Creator", __FILE__);
PS_set_info($ps, "Author", "Uwe Steinmann");
PS_set_info($ps, "Title", "Shading Examples");
PS_set_info($ps, "Keywords", "shading");
$antiqua = PS_findfont($ps, "Helvetica", "", 0);
/* Page 2 */
PS_begin_page($ps, 596, 842);
footer($ps, "");
$shading1 = PS_shading($ps, "axial", 0.0, 0.0, 90.0, 0.0, 1.0, 0.0, 0.0, 0.0, NULL);
$shading2 = PS_shading($ps, "axial", 10.0, 10.0, 90.0, 90.0, 1.0, 0.0, 0.0, 0.0, NULL);
$shading3 = PS_shading($ps, "axial", 10.0, 10.0, 90.0, 90.0, 1.0, 0.0, 0.0, 0.0, "extend0 true extend1 true");
$shading4 = PS_shading($ps, "radial", 29.0, 29.0, 55.0, 55.0, 1.0, 0.0, 0.0, 0.0, "r0 0 r1 45");
$shading5 = PS_shading($ps, "radial", 29.0, 29.0, 55.0, 55.0, 1.0, 0.0, 0.0, 0.0, "r0 5 r1 45");
PS_save($ps);