/[opencvs]/eyes/plottest.c
ViewVC logotype

Contents of /eyes/plottest.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Apr 16 13:59:15 2013 UTC (5 years, 3 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
Added hpgl2 routines and bitmap_to_hpgl2 - this allows
us to use the vector mode to print out 600 dots per inch
on the hp designjet 600.  It is kind of a folloy, but it is a use of what I have versus what I dont have.
I only made a 36 x 1/2 inch strip so far.  This has no scaling defined so it
should be asolute.  the print area is about 3 inches smaller (or more) than the printer size. Also,  the printer margins is not even.  But hey,
it probably works.

Right now I am testing a 2.3 inch long strip which will take 20 minutes to run.
And then there is the question of if the plotter can handle millions
of vector commands - which we just don't know yet.
If it can't then there might be a way to send it in blocks - I guess blocks of 12 million or so because that is the memory size of the plotter I got.
1 #include <stdio.h>
2 #include <plot.h>
3 #define MAXORDER 12
4
5 void draw_c_curve (plPlotter *plotter, double dx, double dy, int order)
6 {
7 if (order >= MAXORDER)
8 /* continue path along (dx, dy) */
9 pl_fcontrel_r (plotter, dx, dy);
10 else
11 {
12 draw_c_curve (plotter,
13 0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
14 draw_c_curve (plotter,
15 0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
16 }
17 }
18
19 int main ()
20 {
21 int xsize=600*36;
22 int ysize=600*3;
23
24 plPlotter *plotter;
25 plPlotterParams *plotter_params;
26
27 /* set a Plotter parameter */
28 plotter_params = pl_newplparams ();
29 pl_setplparam (plotter_params, "PAGESIZE",
30 "letter,xsize=36in,xoffset=0.0in,ysize=3in,yoffset=0.0in");
31 {
32 char buf[20000];
33 sprintf(buf,"%dx%d",xsize,ysize);
34 // pl_setplparam (plotter_params, "BITMAPSIZE", buf);
35 }
36
37 /* create a Postscript Plotter that writes to standard output */
38 if ((plotter = pl_newpl_r ("hpgl", stdin, stdout, stderr,
39 plotter_params)) == NULL)
40 {
41 fprintf (stderr, "Couldn't create Plotter\n");
42 return 1;
43 }
44
45 if (pl_openpl_r (plotter) < 0) /* open Plotter */
46 {
47 fprintf (stderr, "Couldn't open Plotter\n");
48 return 1;
49 }
50 pl_fspace_r (plotter, 0.0, ((float)ysize-1),((float)xsize-1), 0.0); /* set coor system */
51 pl_flinewidth_r (plotter, 0.0); /* set line thickness */
52 pl_erase_r (plotter); /* erase graphics display */
53 int x,y;
54 for (y=0;y<ysize;y++) {
55 for (x=0;x<xsize;x++) {
56 if ((y%10)==0) {
57 if ((x%10)==0) {
58 pl_point_r(plotter,x,y);
59 }
60 }
61 }
62 }
63 if (pl_closepl_r (plotter) < 0) /* close Plotter */
64 {
65 fprintf (stderr, "Couldn't close Plotter\n");
66 return 1;
67 }
68
69 if (pl_deletepl_r (plotter) < 0) /* delete Plotter */
70 {
71 fprintf (stderr, "Couldn't delete Plotter\n");
72 return 1;
73 }
74 return 0;
75 }

  ViewVC Help
Powered by ViewVC 1.1.5