Пример #1
0
function frame($psdoc)
{
    ps_setlinewidth($psdoc, 60);
    ps_moveto($psdoc, 150, 50);
    ps_lineto($psdoc, 750, 50);
    ps_arc($psdoc, 750, 150, 100, 270, 360);
    ps_lineto($psdoc, 850, 750);
    ps_arc($psdoc, 750, 750, 100, 0, 90);
    ps_lineto($psdoc, 150, 850);
    ps_arc($psdoc, 150, 750, 100, 90, 180);
    ps_lineto($psdoc, 50, 150);
    ps_arc($psdoc, 150, 150, 100, 180, 270);
    ps_stroke($psdoc);
}
Пример #2
0
 function begin_example_box($p, $llx, $lly, $title, $font)
 {
     ps_save($p);
     ps_translate($p, $llx, $lly);
     ps_setcolor($p, "fill", "gray", 0.5, 0.0, 0.0, 0.0);
     ps_rect($p, 0, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_TITLE_HEIGHT);
     ps_fill($p);
     ps_setcolor($p, "stroke", "gray", 1.0, 0.0, 0.0, 0.0);
     ps_setfont($p, $font, 12.0);
     ps_show_xy($p, $title, 10, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT + 5);
     ps_setlinewidth($p, 1.0);
     ps_setcolor($p, "stroke", "gray", 0.0, 0.0, 0.0, 0.0);
     ps_rect($p, 0, 0, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_HEIGHT);
     ps_stroke($p);
     ps_moveto($p, 0, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT);
     ps_lineto($p, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT);
     ps_stroke($p);
 }
Пример #3
0
 function drawPie($centerX, $centerY, $radius, $begin, $end, $style)
 {
     $this->_convertPosition($centerX, $centerY);
     $radius = $radius * min($this->width, $this->height);
     ps_setcolor($this->ps, 'stroke', $style['line'][0], $style['line'][1], $style['line'][2], $style['line'][3], $style['line'][4]);
     if (isset($style['fill'])) {
         ps_setcolor($this->ps, 'fill', $style['fill'][0], $style['fill'][1], $style['fill'][2], $style['fill'][3], $style['fill'][4]);
     }
     ps_setlinewidth($this->ps, $style['line-width']);
     ps_moveto($this->ps, $centerX, $centerY);
     ps_arc($this->ps, $centerX, $centerY, $radius, $begin, $end);
     ps_lineto($this->ps, $centerX, $centerY);
     ps_closepath($this->ps);
     if (isset($style['fill'])) {
         ps_fill_stroke($this->ps);
     } else {
         ps_stroke($this->ps);
     }
 }
Пример #4
0
     ps_lineto($ps, $leftmargin + 16 * $colwidth, $bottommargin + $j * $rowheight);
     ps_stroke($ps);
 }
 ps_setfont($ps, $psfont, $fontsize);
 for ($i = 0; $i < 16; $i++) {
     $text = sprintf("x%X", $i);
     $textwidth = ps_stringwidth($ps, $text, $psfont, $fontsize);
     ps_show_xy($ps, $text, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + 16 * $rowheight + $fontsize / 2);
 }
 for ($j = 0; $j < 16; $j++) {
     $text = sprintf("%Xx", $j);
     ps_show_xy($ps, $text, $leftmargin - 1.7 * $fontsize, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 - $fontsize / 2);
 }
 /* The symbol itself */
 ps_setfont($ps, $samplefont, $fontsamplesize);
 ps_setlinewidth($ps, 0.4);
 for ($j = 0; $j < 16; $j++) {
     for ($i = 0; $i < 16; $i++) {
         $textwidth = ps_symbol_width($ps, $j * 16 + $i, $psfont, $fontsize);
         ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2);
         ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
         //ps_show_xy($ps, $text, $leftmargin+$i*$colwidth+$colwidth/2-$textwidth/2, $bottommargin+(15-$j)*$rowheight+$rowheight/2-$fontsize/2);
         //			ps_show($ps, $text);
         ps_symbol($ps, $j * 16 + $i);
         ps_moveto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
         ps_lineto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 + $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
         ps_stroke($ps);
     }
 }
 /* The name of the symbol */
 ps_setfont($ps, $psfont, 3);
Пример #5
0
 /**
  * Get the PostScript linestyle
  *
  * @param mixed $lineStyle The line style to return, false if the one
  *   explicitly set
  * @return bool True if set (so that a line should be drawn)
  * @access private
  */
 function _setLineStyle($lineStyle = false)
 {
     if ($lineStyle === false) {
         $lineStyle = $this->_lineStyle;
     }
     if ($lineStyle == 'transparent' || $lineStyle === false) {
         return false;
     }
     if (is_array($lineStyle)) {
         // TODO Implement linestyles in pslib (using ps_setcolor(.., 'pattern'...); ?
         reset($lineStyle);
         $lineStyle = current($lineStyle);
     }
     $color = $this->_color($lineStyle);
     ps_setlinewidth($this->_ps, $this->_thickness);
     ps_setcolor($this->_ps, 'stroke', 'rgb', $color[0], $color[1], $color[2], 0);
     return true;
 }
Пример #6
0
     ps_lineto($ps, $leftmargin + 16 * $colwidth, $bottommargin + $j * $rowheight);
     ps_stroke($ps);
 }
 ps_setfont($ps, $psfont, $fontsize);
 for ($i = 0; $i < 16; $i++) {
     $text = sprintf("x%X", $i);
     $textwidth = ps_stringwidth($ps, $text, $psfont, $fontsize);
     ps_show_xy($ps, $text, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + 16 * $rowheight + $fontsize / 2);
 }
 for ($j = 0; $j < 16; $j++) {
     $text = sprintf("%Xx", $j);
     ps_show_xy($ps, $text, $leftmargin - 1.7 * $fontsize, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 - $fontsize / 2);
 }
 /* The symbol itself */
 ps_setfont($ps, $samplefont, $fontsamplesize);
 ps_setlinewidth($ps, 0.2);
 for ($j = 0; $j < 16; $j++) {
     for ($i = 0; $i < 16; $i++) {
         if ($glc + ($j * 16 + $i) < $listlen) {
             $textwidth = ps_glyph_width($ps, $glyphlist[$glc + ($j * 16 + $i)], 0, $fontsamplesize);
             ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2);
             ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
             ps_glyph_show($ps, $glyphlist[$glc + ($j * 16 + $i)]);
             ps_moveto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
             ps_lineto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 + $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
             ps_stroke($ps);
         }
     }
 }
 /* The name of the symbol */
 ps_setfont($ps, $psfont, 3);
Пример #7
0
    ps_lineto($ps, -$radius / 10, $radius / 20);
    ps_closepath($ps);
    ps_fill($ps);
    ps_restore($ps);
    /* draw minute hand */
    ps_save($ps);
    ps_rotate($ps, -($ltime['seconds'] / 60.0 + $ltime['minutes'] - 15.0) * 6.0);
    ps_moveto($ps, -$radius / 10, -$radius / 20);
    ps_lineto($ps, $radius * 0.8, 0.0);
    ps_lineto($ps, -$radius / 10, $radius / 20);
    ps_closepath($ps);
    ps_fill($ps);
    ps_restore($ps);
    /* draw second hand */
    //    ps_setrgbcolor($ps, 1.0, 0.0, 0.0);
    ps_setlinewidth($ps, 2);
    ps_save($ps);
    ps_rotate($ps, -(($ltime['seconds'] - 15.0) * 6.0));
    ps_moveto($ps, -$radius / 5, 0.0);
    ps_lineto($ps, $radius, 0.0);
    ps_stroke($ps);
    ps_restore($ps);
    /* draw little circle at center */
    ps_circle($ps, 0, 0, $radius / 30);
    ps_fill($ps);
    ps_end_page($ps);
    # to see some difference
    //	sleep(1);
}
/*$buf = ps_get_buffer($ps);
$len = strlen($buf);