コード例 #1
0
ファイル: fontcreate.php プロジェクト: promoso/HVAC
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
ファイル: ps.php プロジェクト: abbeet/server39
 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
ファイル: ps.php プロジェクト: railfuture/tiki-website
 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
ファイル: fontsample.php プロジェクト: promoso/HVAC
     $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);
 for ($j = 0; $j < 16; $j++) {
     for ($i = 0; $i < 16; $i++) {
         $text = ps_symbol_name($ps, $j * 16 + $i, $samplefont);
         ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + 2);
         ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + 2);
         ps_show($ps, $text);
         $text = sprintf(" (%d)", $j * 16 + $i);
         ps_show($ps, $text);
     }
 }
コード例 #5
0
ファイル: PS.php プロジェクト: ronaldoof/geocloud2
 /**
  * Parameter array:
  * 'connect': bool [optional] Specifies whether the start point should be
  *   connected to the endpoint (closed polygon) or not (connected line)
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function polygon($params = array())
 {
     $connectEnds = isset($params['connect']) ? $params['connect'] : false;
     $fillColor = isset($params['fill']) ? $params['fill'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $line = $this->_setLineStyle($lineColor);
     $fill = false;
     if ($connectEnds) {
         $fill = $this->_setFillStyle($fillColor);
     }
     $first = true;
     foreach ($this->_polygon as $point) {
         if ($first === true) {
             ps_moveto($this->_ps, $point['X'], $point['Y']);
             $first = $point;
         } else {
             if (isset($last['P1X'])) {
                 ps_curveto($this->_ps, $last['P1X'], $last['P1Y'], $last['P2X'], $last['P2Y'], $point['X'], $point['Y']);
             } else {
                 ps_lineto($this->_ps, $point['X'], $point['Y']);
             }
         }
         $last = $point;
     }
     if ($connectEnds) {
         if (isset($last['P1X'])) {
             ps_curveto($this->_ps, $last['P1X'], $last['P1Y'], $last['P2X'], $last['P2Y'], $first['X'], $first['Y']);
         } else {
             ps_lineto($this->_ps, $first['X'], $first['Y']);
         }
     }
     if ($line && $fill) {
         ps_fill_stroke($this->_ps);
     } elseif ($line) {
         ps_stroke($this->_ps);
     } elseif ($fill) {
         ps_fill($this->_ps);
     }
     parent::polygon($params);
 }
コード例 #6
0
ファイル: psclock.php プロジェクト: promoso/HVAC
    /* 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);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=foo.pdf");