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); }
$margin = 20; $pagecount = 300; $ps = ps_new(); if (!ps_open_file($ps, "psclock.ps")) { print "Cannot open PostScript file\n"; exit; } ps_set_parameter($ps, "warning", "true"); ps_set_info($ps, "Creator", "psclock.php"); ps_set_info($ps, "Author", "Uwe Steinmann"); ps_set_info($ps, "Title", "Analog Clock"); while ($pagecount-- > 0) { ps_begin_page($ps, 2 * ($radius + $margin), 2 * ($radius + $margin)); ps_set_parameter($ps, "transition", "wipe"); ps_set_value($ps, "duration", 0.5); ps_translate($ps, $radius + $margin, $radius + $margin); ps_save($ps); ps_setcolor($ps, "both", "rgb", 0.0, 0.0, 1.0, 0.0); /* minute strokes */ ps_setlinewidth($ps, 2.0); for ($alpha = 0; $alpha < 360; $alpha += 6) { ps_rotate($ps, 6.0); ps_moveto($ps, $radius, 0.0); ps_lineto($ps, $radius - $margin / 3, 0.0); ps_stroke($ps); } ps_restore($ps); ps_save($ps); /* 5 minute strokes */ ps_setlinewidth($ps, 3.0); for ($alpha = 0; $alpha < 360; $alpha += 30) {