ps_fill($psdoc); ps_circle($psdoc, 250, 450, 80); ps_fill($psdoc); ps_circle($psdoc, 250, 650, 80); ps_fill($psdoc); ps_circle($psdoc, 450, 250, 80); ps_fill($psdoc); ps_circle($psdoc, 450, 450, 80); ps_fill($psdoc); ps_circle($psdoc, 450, 650, 80); ps_fill($psdoc); ps_circle($psdoc, 650, 250, 80); ps_fill($psdoc); ps_circle($psdoc, 650, 450, 80); ps_fill($psdoc); ps_circle($psdoc, 650, 650, 80); ps_fill($psdoc); ps_end_glyph($psdoc); ps_add_kerning($psdoc, "one", "two", 100); ps_add_ligature($psdoc, "one", "two", "nine"); ps_add_ligature($psdoc, "nine", "three", "zero"); ps_end_font($psdoc); ps_begin_page($psdoc, 596, 842); ps_setfont($psdoc, $myfont, 80.0); ps_show_xy($psdoc, "123456", 80, 700); ps_setfont($psdoc, $myfont, 60.0); ps_show_xy($psdoc, "12345678", 80, 600); ps_setfont($psdoc, $myfont, 40.0); ps_show_xy($psdoc, "1234567890", 80, 500); ps_setfont($psdoc, $myfont, 20.0); ps_show_xy($psdoc, "1234567890", 80, 400);
/** * 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); }
$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") { if ($x > 3) { $y -= 150; $x = 0; } begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Path (1)", $psfont); ps_moveto($ps, 10, 10); ps_lineto($ps, 50, 50); ps_moveto($ps, 20, 10); ps_lineto($ps, 60, 50); ps_circle($ps, 60, 60, 20); ps_lineto($ps, 90, 70); ps_stroke($ps); end_example_box($ps); } if (isset($_REQUEST['box10']) && $_REQUEST['box10'] == "true") { if ($x > 3) { $y -= 150; $x = 0; } begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Path (2)", $psfont); ps_moveto($ps, 10, 10); ps_lineto($ps, 20, 20); ps_rect($ps, 30, 30, 10, 20); ps_lineto($ps, 50, 10); ps_stroke($ps);
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"); print $buf; */ ps_close($ps); ps_delete($ps);