コード例 #1
0
ファイル: spotcolor.php プロジェクト: promoso/HVAC
function colorline($ps, $leftborder, $spot)
{
    for ($i = 1; $i <= 10; $i++) {
        PS_setcolor($ps, "fill", "spot", $spot["id"], $i * 0.1, 0.0, 0.0);
        PS_rect($ps, $leftborder, 35 + $i * 65, 50, 50);
        PS_fill($ps);
    }
    PS_setcolor($ps, "stroke", "gray", 0.0, 0.0, 0.0, 0.0);
    $psfont = PS_findfont($ps, "Helvetica", "", 0);
    PS_setfont($ps, $psfont, 7.0);
    PS_show_xy($ps, $spot["name"], $leftborder, 100 + 10 * 65 + 13);
    if (!strcmp($spot["colorspace"], "cmyk")) {
        $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);
        }
    }
}
コード例 #2
0
ファイル: shading.php プロジェクト: promoso/HVAC
PS_rect($ps, LEFT_BORDER + 390, 550, 100, 100);
PS_fill($ps);
PS_show_boxed($ps, "The line of rectangles illustrates one important aspect of shading. The shading is defined relativ to the current coordinate system. In this case it starts at x-position 50 and ends at x-position 470 in an unmodified coordinate system. The right most rectangle is not filled completly because of the shadings end. Filling areas is like punching wholes in a white coat on top of the page and peeking through. This is mostly not what you want. If you would like to fill the rectangle with the full range of the shading, you will have to create a shading starting at 0 and ending at the width of the rectangle. Before filling the rectangle you will have to translate the coordinate system to the lower left corner of the rectangle, create the pattern in the modified coordinate system and draw a filled rectangle at (0, 0). The pattern must be created after the translation, because it always uses the active coordinate system.", LEFT_BORDER, 170, 360, 360, "left", NULL);
PS_save($ps);
PS_translate($ps, LEFT_BORDER, 240);
$pspattern = PS_shading_pattern($ps, $shading2, NULL);
PS_setcolor($ps, "fill", "pattern", (double) $pspattern, 0.0, 0.0, 0.0);
PS_rect($ps, 0, 0, 100, 100);
PS_fill($ps);
PS_restore($ps);
PS_save($ps);
PS_translate($ps, LEFT_BORDER + 130, 240);
$pspattern = PS_shading_pattern($ps, $shading2, NULL);
PS_setcolor($ps, "fill", "pattern", (double) $pspattern, 0.0, 0.0, 0.0);
PS_rect($ps, 0, 0, 100, 100);
PS_fill($ps);
PS_restore($ps);
PS_end_page($ps);
/* Page 4 */
PS_begin_page($ps, 596, 842);
PS_setcolor($ps, "fill", "rgb", 0, 0, 1, 0);
$shading1 = PS_shading($ps, "axial", (double) 0, 0.0, 470.0, 0.0, 1.0, 1.0, 0.0, 0.0, "N 1");
PS_setfont($ps, $antiqua, 20.0);
PS_show_xy($ps, "Using shading patterns for drawing", LEFT_BORDER, 763);
PS_setfont($ps, $antiqua, 10.0);
PS_set_value($ps, "leading", 15.0);
PS_show_boxed($ps, "A pattern is like a color and be used like one. The examples on the previous pages used the pattern for filling rectangles. Why not use it for something more fancy like filling the outline of a text or drawing with a pattern.", LEFT_BORDER, 170, 360, 580, "left", NULL);
PS_save($ps);
PS_translate($ps, LEFT_BORDER, 620);
$pspattern = PS_shading_pattern($ps, $shading1, NULL);
PS_setcolor($ps, "stroke", "pattern", (double) $pspattern, 0.0, 0.0, 0.0);