Ticket #36397: patch-printline.c.diff
File patch-printline.c.diff, 4.4 KB (added by stevecheckoway (Stephen Checkoway), 12 years ago) |
---|
-
printline.c
old new 7 7 8 8 #include "jgraph.h" 9 9 #include <stdio.h> 10 #include <string.h> 10 11 11 12 #define LINEWIDTHFACTOR 0.700 12 13 #define MAX(a, b) ((a > b) ? (a) : (b)) … … static Fontlist Jgraph_fonts; 23 24 static int Jgraph_gsave_level = -100; 24 25 static int Jgraph_comment; 25 26 26 gsave()27 void gsave() 27 28 { 28 29 if (Jgraph_gsave_level == -100) { 29 30 Jgraph_gsave_level = 0; … … gsave() 33 34 printf(" gsave "); 34 35 } 35 36 36 grestore()37 void grestore() 37 38 { 38 39 Fontlist l; 39 40 … … grestore() 48 49 printf(" grestore "); 49 50 } 50 51 51 setfont(f, s) 52 char *f; 53 float s; 52 void setfont(char *f, float s) 54 53 { 55 54 Fontlist l; 56 55 int ins; … … float s; 75 74 } 76 75 } 77 76 78 setfill( x, y, t, f, p, a) 79 char t, p ; 80 float x, y; 81 float f[], a ; 77 void setfill(float x, float y, char t, float *f, char p, float a) 82 78 { 83 79 /* fprintf(stderr, "Hello? %c %f %c %f\n", t, f[0], p, a); */ 84 80 if (t == 'g' && f[0] < 0.0) return; … … float f[], a ; 100 96 printf(" grestore\n"); 101 97 } 102 98 103 setgray( t, f) 104 char t ; 105 float f[] ; 99 void setgray(char t, float *f) 106 100 { 107 101 if ( t == 'g' ) { 108 102 if( f[0] >= 0.0 ) printf("%f setgray\n", f[0] ); … … float f[] ; 111 105 } 112 106 } 113 107 114 printline(x1, y1,x2, y2, orientation) 115 float x1, y1, x2, y2; 116 char orientation; 108 void printline(float x1, float y1, float x2, float y2, char orientation) 117 109 { 118 110 if (orientation == 'x') 119 111 printf("newpath %f %f moveto %f %f lineto stroke\n", x1, y1, x2, y2); … … char orientation; 122 114 fflush(stdout); 123 115 } 124 116 125 print_ebar(x1, y1, x2, ms, orientation) 126 float x1, y1, x2, ms; 127 char orientation; 117 void print_ebar(float x1, float y1, float x2, float ms, char orientation) 128 118 { 129 119 printline(x1, y1, x2, y1, orientation); 130 120 printline(x2, y1-ms, x2, y1+ms, orientation); 131 121 } 132 122 133 start_line(x1, y1, c) 134 float x1, y1; 135 Curve c; 123 void start_line(float x1, float y1, Curve c) 136 124 { 137 125 setlinewidth(c->linethick); 138 126 setlinestyle(c->linetype, c->gen_linetype); 139 127 printf("%f %f moveto ", x1, y1); 140 128 } 141 129 142 cont_line(x1, y1) 143 float x1, y1; 130 void cont_line(float x1, float y1) 144 131 { 145 132 printf(" %f %f lineto\n", x1, y1); 146 133 } 147 134 148 end_line()135 void end_line() 149 136 { 150 137 printf("stroke\n"); 151 138 setlinewidth(1.0); … … end_line() 154 141 155 142 } 156 143 157 bezier_control(x1, y1) 158 float x1, y1; 144 void bezier_control(float x1, float y1) 159 145 { 160 146 printf(" %f %f ", x1, y1); 161 147 } 162 148 163 bezier_end(x1, y1) 164 float x1, y1; 149 void bezier_end(float x1, float y1) 165 150 { 166 151 printf(" %f %f curveto\n", x1, y1); 167 152 } 168 153 169 154 170 start_poly(x1, y1) 171 float x1, y1; 155 void start_poly(float x1, float y1) 172 156 { 173 157 printf(" newpath %f %f moveto", x1, y1); 174 158 } 175 159 176 cont_poly(x1, y1) 177 float x1, y1; 160 void cont_poly(float x1, float y1) 178 161 { 179 162 printf(" %f %f lineto\n", x1, y1); 180 163 } 181 164 182 end_poly(x, y, ftype, fill, pattern, parg) 183 float x, y; 184 char ftype, pattern ; 185 float fill[], parg; 165 void end_poly(float x, float y, char ftype, float *fill, char pattern, float parg) 186 166 { 187 167 printf("closepath "); 188 168 setfill( x, y, ftype, fill, pattern, parg ); … … float fill[], parg; 192 172 193 173 /* Ellipse at 0, 0 -- assumes that you've already translated to x, y */ 194 174 195 printellipse(x, y, radius1, radius2, ftype, fill, pattern, parg) 196 char ftype, pattern; 197 float x, y, radius1, radius2, fill[], parg; 175 void printellipse(float x, float y, float radius1, float radius2, char ftype, float *fill, char pattern, float parg) 198 176 { 199 177 printf("newpath %f %f JDE\n", radius1, radius2); 200 178 setfill( x, y, ftype, fill, pattern, parg ); … … float x, y, radius1, radius2, fill[], pa 202 180 fflush(stdout); 203 181 } 204 182 205 set_comment(c) 206 int c; 183 void set_comment(int c) 207 184 { 208 185 Jgraph_comment = c; 209 186 } 210 187 211 comment(s) 212 char *s; 188 void comment(const char *s) 213 189 { 214 190 if (Jgraph_comment) printf("%% %s\n", s); 215 191 } 216 192 217 printline_c(x1, y1, x2, y2, g) 218 float x1, y1, x2, y2; 219 Graph g; 193 #if 0 194 static void printline_c(float x1, float y1, float x2, float y2, Graph g) 220 195 { 221 196 printline(ctop(x1, g->x_axis), ctop(y1, g->y_axis), 222 197 ctop(x2, g->x_axis), ctop(y2, g->y_axis), 'x'); 223 198 } 199 #endif 224 200 225 print_label(l) 226 Label l; 201 void print_label(Label l) 227 202 { 228 203 int f, i, nlines; 229 204 float fnl; … … Label l; 290 265 printf("grestore\n"); 291 266 } 292 267 293 setlinewidth(size) 294 float size; 268 void setlinewidth(float size) 295 269 { 296 270 printf("%f setlinewidth ", size * LINEWIDTHFACTOR); 297 271 } 298 272 299 setlinestyle(style, glist) 300 char style; 301 Flist glist; 273 void setlinestyle(char style, Flist glist) 302 274 { 303 275 Flist fl; 304 276