$imagedata[0] = chr(0); $imagedata[5] = chr(0); $imagedata[10] = chr(0); $imagedata[15] = chr(0); $psimage = ps_open_image($ps, "memory", "memory", $imagedata, 16, 2, 2, 4, 8, NULL); ps_place_image($ps, $psimage, 20, 90, 20.0); ps_setfont($ps, $psfont, 8.0); ps_show_xy($ps, "CMYK", 20, 80); ps_show_xy($ps, "RGB", 20, 10); ps_show_xy($ps, "Gray", 90, 10); end_example_box($ps); begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Jpeg cmyk image, rotated", $psfont); $psimage = ps_open_image_file($ps, "jpeg", "cne-cmyk.jpg", NULL, 0); ps_save($ps); ps_translate($ps, 72, 10); ps_rotate($ps, 45); ps_place_image($ps, $psimage, 0, 0, 0.45); ps_restore($ps); $buffer = sprintf("%.0f x %.0f pixel", ps_get_value($ps, "imagewidth", $psimage), ps_get_value($ps, "imageheight", $psimage)); ps_setfont($ps, $psfont, 10.0); ps_show_xy($ps, $buffer, EXAMPLE_BOX_WIDTH - 10 - ps_stringwidth($ps, $buffer, $psfont, 10), 10); end_example_box($ps); begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "EPS read from memory", $psfont); $data = file_get_contents("picture.eps"); $psimage = ps_open_image($ps, "eps", "memory", $data, strlen($data), 0, 0, 0, 0, NULL); ps_place_image($ps, $psimage, 15, 25, 0.45); $buffer = sprintf("%.0f x %.0f pixel", ps_get_value($ps, "imagewidth", $psimage), ps_get_value($ps, "imageheight", $psimage)); ps_setfont($ps, $psfont, 10.0); ps_show_xy($ps, $buffer, EXAMPLE_BOX_WIDTH - 10 - ps_stringwidth($ps, $buffer, $psfont, 10), 10); end_example_box($ps); ps_end_page($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); header("Content-type: application/pdf");