Esempio n. 1
0
 if (isset($_REQUEST['box7']) && $_REQUEST['box7'] == "true") {
     if ($x > 3) {
         $y -= 150;
         $x = 0;
     }
     begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Curves", $psfont);
     ps_moveto($ps, 10, 10);
     ps_curveto($ps, 10, 40, 40, 20, 50, 20);
     ps_curveto($ps, 50, 20, 80, 90, 20, 70);
     ps_curveto($ps, 20, 70, 80, 20, 10, 10);
     ps_stroke($ps);
     ps_setcolor($ps, "both", "rgb", 1.0, 0.0, 0.0, 0.0);
     ps_moveto($ps, 50, 10);
     ps_curveto($ps, 50, 10, 110, 40, 90, 90);
     ps_curveto($ps, 90, 90, 30, 90, 80, 70);
     ps_curveto($ps, 80, 70, 100, 10, 50, 10);
     ps_fill($ps);
     end_example_box($ps);
 }
 if (isset($_REQUEST['box8']) && $_REQUEST['box8'] == "true") {
     if ($x > 3) {
         $y -= 150;
         $x = 0;
     }
     begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "EPS-Image", $psfont);
     $psimage = ps_open_image_file($ps, "eps", "picture.eps", NULL, 0);
     ps_place_image($ps, $psimage, 10, 10, 0.3);
     ps_close_image($ps, $psimage);
     end_example_box($ps);
 }
 if (isset($_REQUEST['box9']) && $_REQUEST['box9'] == "true") {
Esempio n. 2
0
 /**
  * Draw an ellipse
  *
  * Parameter array:
  * 'x': int X center point
  * 'y': int Y center point
  * 'rx': int X radius
  * 'ry': int Y radius
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function ellipse($params)
 {
     $x = $params['x'];
     $y = $params['y'];
     $rx = $params['rx'];
     $ry = $params['ry'];
     $fillColor = isset($params['fill']) ? $params['fill'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $line = $this->_setLineStyle($lineColor);
     $fill = $this->_setFillStyle($fillColor);
     if ($line || $fill) {
         if ($rx == $ry) {
             ps_circle($this->_ps, $this->_getX($x), $this->_getY($y), $rx);
         } else {
             ps_moveto($this->_ps, $this->_getX($x - $rx), $this->_getY($y));
             ps_curveto($this->_ps, $this->_getX($x - $rx), $this->_getY($y), $this->_getX($x - $rx), $this->_getY($y - $ry), $this->_getX($x), $this->_getY($y - $ry));
             ps_curveto($this->_ps, $this->_getX($x), $this->_getY($y - $ry), $this->_getX($x + $rx), $this->_getY($y - $ry), $this->_getX($x + $rx), $this->_getY($y));
             ps_curveto($this->_ps, $this->_getX($x + $rx), $this->_getY($y), $this->_getX($x + $rx), $this->_getY($y + $ry), $this->_getX($x), $this->_getY($y + $ry));
             ps_curveto($this->_ps, $this->_getX($x), $this->_getY($y + $ry), $this->_getX($x - $rx), $this->_getY($y + $ry), $this->_getX($x - $rx), $this->_getY($y));
         }
         if ($line && $fill) {
             ps_fill_stroke($this->_ps);
         } elseif ($line) {
             ps_stroke($this->_ps);
         } elseif ($fill) {
             ps_fill($this->_ps);
         }
     }
     parent::ellipse($params);
 }