pcb 4.1.1
An interactive printed circuit board layout editor.
|
00001 #ifdef HAVE_CONFIG_H 00002 #include "config.h" 00003 #endif 00004 00005 #include <stdio.h> 00006 #include <stdarg.h> 00007 #include <stdlib.h> 00008 #include <string.h> 00009 #include <assert.h> 00010 00011 #include "global.h" 00012 #include "data.h" 00013 #include "misc.h" 00014 #include "pcb-printf.h" 00015 00016 #include "hid.h" 00017 #include "hid_draw.h" 00018 #include "../hidint.h" 00019 #include "hid/common/hidnogui.h" 00020 #include "hid/common/draw_helpers.h" 00021 #include "../ps/ps.h" 00022 #include "hid/common/hidinit.h" 00023 00024 #ifdef HAVE_LIBDMALLOC 00025 #include <dmalloc.h> 00026 #endif 00027 00028 #define CRASH fprintf(stderr, "HID error: pcb called unimplemented EPS function %s.\n", __FUNCTION__); abort() 00029 00030 /*----------------------------------------------------------------------------*/ 00031 /* Function prototypes */ 00032 /*----------------------------------------------------------------------------*/ 00033 static HID_Attribute * eps_get_export_options (int *n); 00034 static void eps_do_export (HID_Attr_Val * options); 00035 static void eps_parse_arguments (int *argc, char ***argv); 00036 static int eps_set_layer (const char *name, int group, int empty); 00037 static hidGC eps_make_gc (void); 00038 static void eps_destroy_gc (hidGC gc); 00039 static void eps_use_mask (enum mask_mode mode); 00040 static void eps_set_color (hidGC gc, const char *name); 00041 static void eps_set_line_cap (hidGC gc, EndCapStyle style); 00042 static void eps_set_line_width (hidGC gc, Coord width); 00043 static void eps_set_draw_xor (hidGC gc, int _xor); 00044 static void eps_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); 00045 static void eps_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); 00046 static void eps_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle); 00047 static void eps_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); 00048 static void eps_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius); 00049 static void eps_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y); 00050 static void eps_calibrate (double xval, double yval); 00051 static void eps_set_crosshair (int x, int y, int action); 00052 /*----------------------------------------------------------------------------*/ 00053 00054 typedef struct hid_gc_struct 00055 { 00056 EndCapStyle cap; 00057 Coord width; 00058 int color; 00059 int erase; 00060 } hid_gc_struct; 00061 00062 static HID eps_hid; 00063 static HID_DRAW eps_graphics; 00064 00065 static FILE *f = 0; 00066 static Coord linewidth = -1; 00067 static int lastcap = -1; 00068 static int lastcolor = -1; 00069 static int print_group[MAX_GROUP]; 00070 static int print_layer[MAX_ALL_LAYER]; 00071 static int fast_erase = -1; 00072 00073 static HID_Attribute eps_attribute_list[] = { 00074 /* other HIDs expect this to be first. */ 00075 00076 /* %start-doc options "92 Encapsulated Postscript Export" 00077 @ftable @code 00078 @item --eps-file <string> 00079 Name of the encapsulated postscript output file. Can contain a path. 00080 @end ftable 00081 %end-doc 00082 */ 00083 {"eps-file", "Encapsulated Postscript output file", 00084 HID_String, 0, 0, {0, 0, 0}, 0, 0}, 00085 #define HA_psfile 0 00086 00087 /* %start-doc options "92 Encapsulated Postscript Export" 00088 @ftable @code 00089 @item --eps-scale <num> 00090 Scale EPS output by the parameter @samp{num}. 00091 @end ftable 00092 %end-doc 00093 */ 00094 {"eps-scale", "EPS scale", 00095 HID_Real, 0, 100, {0, 0, 1.0}, 0, 0}, 00096 #define HA_scale 1 00097 00098 /* %start-doc options "92 Encapsulated Postscript Export" 00099 @ftable @code 00100 @cindex screen-layer-order (EPS) 00101 @item --screen-layer-order 00102 Export layers as shown on screen. 00103 @end ftable 00104 %end-doc 00105 */ 00106 {"screen-layer-order", "Export layers in the order shown on screen", 00107 HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, 00108 #define HA_as_shown 2 00109 00110 /* %start-doc options "92 Encapsulated Postscript Export" 00111 @ftable @code 00112 @item --monochrome 00113 Convert output to monochrome. 00114 @end ftable 00115 %end-doc 00116 */ 00117 {"monochrome", "Convert to monochrome", 00118 HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, 00119 #define HA_mono 3 00120 00121 /* %start-doc options "92 Encapsulated Postscript Export" 00122 @ftable @code 00123 @cindex only-visible 00124 @item --only-visible 00125 Limit the bounds of the EPS file to the visible items. 00126 @end ftable 00127 %end-doc 00128 */ 00129 {"only-visible", "Limit the bounds of the EPS file to the visible items", 00130 HID_Boolean, 0, 0, {0, 0, 0}, 0, 0}, 00131 #define HA_only_visible 4 00132 }; 00133 00134 #define NUM_OPTIONS (sizeof(eps_attribute_list)/sizeof(eps_attribute_list[0])) 00135 00136 REGISTER_ATTRIBUTES (eps_attribute_list) 00137 00138 static HID_Attr_Val eps_values[NUM_OPTIONS]; 00139 00140 static HID_Attribute * 00141 eps_get_export_options (int *n) 00142 { 00143 static char *last_made_filename = 0; 00144 00145 if (PCB) derive_default_filename(PCB->Filename, &eps_attribute_list[HA_psfile], ".eps", &last_made_filename); 00146 00147 if (n) 00148 *n = NUM_OPTIONS; 00149 return eps_attribute_list; 00150 } 00151 00152 static int top_group, bottom_group; 00153 00154 static int 00155 layer_stack_sort (const void *va, const void *vb) 00156 { 00157 int a_layer = *(int *) va; 00158 int b_layer = *(int *) vb; 00159 int a_group = GetLayerGroupNumberByNumber (a_layer); 00160 int b_group = GetLayerGroupNumberByNumber (b_layer); 00161 int aside = (a_group == bottom_group ? 0 : a_group == top_group ? 2 : 1); 00162 int bside = (b_group == bottom_group ? 0 : b_group == top_group ? 2 : 1); 00163 00164 if (bside != aside) 00165 return bside - aside; 00166 00167 if (b_group != a_group) 00168 return b_group - a_group; 00169 00170 return b_layer - a_layer; 00171 } 00172 00173 static const char *filename; 00174 static BoxType *bounds; 00175 static int in_mono, as_shown; 00176 00177 void 00178 eps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options) 00179 { 00180 int i; 00181 static int saved_layer_stack[MAX_LAYER]; 00182 BoxType region; 00183 FlagType save_thindraw; 00184 00185 save_thindraw = PCB->Flags; 00186 CLEAR_FLAG(THINDRAWFLAG, PCB); 00187 CLEAR_FLAG(THINDRAWPOLYFLAG, PCB); 00188 CLEAR_FLAG(CHECKPLANESFLAG, PCB); 00189 00190 f = the_file; 00191 00192 region.X1 = 0; 00193 region.Y1 = 0; 00194 region.X2 = PCB->MaxWidth; 00195 region.Y2 = PCB->MaxHeight; 00196 00197 if (options[HA_only_visible].int_value) 00198 bounds = GetDataBoundingBox (PCB->Data); 00199 else 00200 bounds = ®ion; 00201 00202 memset (print_group, 0, sizeof (print_group)); 00203 memset (print_layer, 0, sizeof (print_layer)); 00204 00205 /* Figure out which layers actually have stuff on them. */ 00206 for (i = 0; i < max_copper_layer; i++) 00207 { 00208 LayerType *layer = PCB->Data->Layer + i; 00209 if (layer->On) 00210 if (layer->LineN || layer->TextN || layer->ArcN || layer->PolygonN) 00211 print_group[GetLayerGroupNumberByNumber (i)] = 1; 00212 } 00213 00214 /* Now, if only one layer has real stuff on it, we can use the fast 00215 erase logic. Otherwise, we have to use the expensive multi-mask 00216 erase. */ 00217 fast_erase = 0; 00218 for (i = 0; i < max_group; i++) 00219 if (print_group[i]) 00220 fast_erase ++; 00221 00222 /* If NO layers had anything on them, at least print the component 00223 layer to get the pins. */ 00224 if (fast_erase == 0) 00225 { 00226 print_group[GetLayerGroupNumberBySide (TOP_SIDE)] = 1; 00227 fast_erase = 1; 00228 } 00229 00230 /* "fast_erase" is 1 if we can just paint white to erase. */ 00231 fast_erase = fast_erase == 1 ? 1 : 0; 00232 00233 /* Now, for each group we're printing, mark its layers for 00234 printing. */ 00235 for (i = 0; i < max_copper_layer; i++) 00236 if (print_group[GetLayerGroupNumberByNumber (i)]) 00237 print_layer[i] = 1; 00238 00239 if (fast_erase) { 00240 eps_hid.poly_before = 1; 00241 eps_hid.poly_after = 0; 00242 } else { 00243 eps_hid.poly_before = 0; 00244 eps_hid.poly_after = 1; 00245 } 00246 00247 memcpy (saved_layer_stack, LayerStack, sizeof (LayerStack)); 00248 as_shown = options[HA_as_shown].int_value; 00249 if (!options[HA_as_shown].int_value) 00250 { 00251 top_group = GetLayerGroupNumberBySide (TOP_SIDE); 00252 bottom_group = GetLayerGroupNumberBySide (BOTTOM_SIDE); 00253 qsort (LayerStack, max_copper_layer, sizeof (LayerStack[0]), layer_stack_sort); 00254 } 00255 fprintf (f, "%%!PS-Adobe-3.0 EPSF-3.0\n"); 00256 linewidth = -1; 00257 lastcap = -1; 00258 lastcolor = -1; 00259 00260 in_mono = options[HA_mono].int_value; 00261 00262 #define pcb2em(x) 1 + COORD_TO_INCH (x) * 72.0 * options[HA_scale].real_value 00263 fprintf (f, "%%%%BoundingBox: 0 0 %lli %lli\n", 00264 llrint (pcb2em (bounds->X2 - bounds->X1)), 00265 llrint (pcb2em (bounds->Y2 - bounds->Y1)) ); 00266 fprintf (f, "%%%%HiResBoundingBox: 0.000000 0.000000 %.6f %.6f\n", 00267 pcb2em (bounds->X2 - bounds->X1), 00268 pcb2em (bounds->Y2 - bounds->Y1)); 00269 #undef pcb2em 00270 fprintf (f, "%%%%Pages: 1\n"); 00271 fprintf (f, 00272 "save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def\n"); 00273 fprintf (f, "%%%%EndProlog\n"); 00274 fprintf (f, "%%%%Page: 1 1\n"); 00275 fprintf (f, "%%%%BeginDocument: %s\n\n", filename); 00276 00277 fprintf (f, "72 72 scale\n"); 00278 fprintf (f, "1 dup neg scale\n"); 00279 fprintf (f, "%g dup scale\n", options[HA_scale].real_value); 00280 pcb_fprintf (f, "%mi %mi translate\n", -bounds->X1, -bounds->Y2); 00281 if (options[HA_as_shown].int_value && Settings.ShowBottomSide) 00282 pcb_fprintf (f, "-1 1 scale %mi 0 translate\n", bounds->X1 - bounds->X2); 00283 linewidth = -1; 00284 lastcap = -1; 00285 lastcolor = -1; 00286 #define Q (Coord) MIL_TO_COORD(10) 00287 pcb_fprintf (f, 00288 "/nclip { %mi %mi moveto %mi %mi lineto %mi %mi lineto %mi %mi lineto %mi %mi lineto eoclip newpath } def\n", 00289 bounds->X1 - Q, bounds->Y1 - Q, bounds->X1 - Q, bounds->Y2 + Q, 00290 bounds->X2 + Q, bounds->Y2 + Q, bounds->X2 + Q, bounds->Y1 - Q, 00291 bounds->X1 - Q, bounds->Y1 - Q); 00292 #undef Q 00293 fprintf (f, "/t { moveto lineto stroke } bind def\n"); 00294 fprintf (f, "/tc { moveto lineto strokepath nclip } bind def\n"); 00295 fprintf (f, "/r { /y2 exch def /x2 exch def /y1 exch def /x1 exch def\n"); 00296 fprintf (f, 00297 " x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto closepath fill } bind def\n"); 00298 fprintf (f, "/c { 0 360 arc fill } bind def\n"); 00299 fprintf (f, "/cc { 0 360 arc nclip } bind def\n"); 00300 fprintf (f, 00301 "/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n"); 00302 00303 hid_expose_callback (&eps_hid, bounds, 0); 00304 00305 fprintf (f, "showpage\n"); 00306 00307 fprintf (f, "%%%%EndDocument\n"); 00308 fprintf (f, "%%%%Trailer\n"); 00309 fprintf (f, "cleartomark countdictstack exch sub { end } repeat restore\n"); 00310 fprintf (f, "%%%%EOF\n"); 00311 00312 memcpy (LayerStack, saved_layer_stack, sizeof (LayerStack)); 00313 PCB->Flags = save_thindraw; 00314 } 00315 00316 static void 00317 eps_do_export (HID_Attr_Val * options) 00318 { 00319 int i; 00320 int save_ons[MAX_ALL_LAYER]; 00321 00322 if (!options) 00323 { 00324 eps_get_export_options (0); 00325 for (i = 0; i < NUM_OPTIONS; i++) 00326 eps_values[i] = eps_attribute_list[i].default_val; 00327 options = eps_values; 00328 } 00329 00330 filename = options[HA_psfile].str_value; 00331 if (!filename) 00332 filename = "pcb-out.eps"; 00333 00334 f = fopen (filename, "w"); 00335 if (!f) 00336 { 00337 perror (filename); 00338 return; 00339 } 00340 00341 if (!options[HA_as_shown].int_value) 00342 hid_save_and_show_layer_ons (save_ons); 00343 eps_hid_export_to_file (f, options); 00344 if (!options[HA_as_shown].int_value) 00345 hid_restore_layer_ons (save_ons); 00346 00347 fclose (f); 00348 } 00349 00350 static void 00351 eps_parse_arguments (int *argc, char ***argv) 00352 { 00353 hid_register_attributes (eps_attribute_list, 00354 sizeof (eps_attribute_list) / 00355 sizeof (eps_attribute_list[0])); 00356 hid_parse_command_line (argc, argv); 00357 } 00358 00359 static int is_mask; 00360 static int is_paste; 00361 static int is_drill; 00362 00363 static int 00364 eps_set_layer (const char *name, int group, int empty) 00365 { 00366 int idx = (group >= 0 00367 && group < 00368 max_group) ? PCB->LayerGroups.Entries[group][0] : group; 00369 if (name == 0) 00370 name = PCB->Data->Layer[idx].Name; 00371 00372 if (idx >= 0 && idx < max_copper_layer && !print_layer[idx]) 00373 return 0; 00374 if (SL_TYPE (idx) == SL_ASSY || SL_TYPE (idx) == SL_FAB) 00375 return 0; 00376 00377 if (strcmp (name, "invisible") == 0) 00378 return 0; 00379 00380 is_drill = (SL_TYPE (idx) == SL_PDRILL || SL_TYPE (idx) == SL_UDRILL); 00381 is_mask = (SL_TYPE (idx) == SL_MASK); 00382 is_paste = (SL_TYPE (idx) == SL_PASTE); 00383 00384 if (is_mask || is_paste) 00385 return 0; 00386 #if 0 00387 printf ("Layer %s group %d drill %d mask %d\n", name, group, is_drill, 00388 is_mask); 00389 #endif 00390 fprintf (f, "%% Layer %s group %d drill %d mask %d\n", name, group, 00391 is_drill, is_mask); 00392 00393 if (as_shown) 00394 { 00395 switch (idx) 00396 { 00397 case SL (SILK, TOP): 00398 case SL (SILK, BOTTOM): 00399 if (SL_MYSIDE (idx)) 00400 return PCB->ElementOn; 00401 else 00402 return 0; 00403 } 00404 } 00405 else 00406 { 00407 switch (idx) 00408 { 00409 case SL (SILK, TOP): 00410 return 1; 00411 case SL (SILK, BOTTOM): 00412 return 0; 00413 } 00414 } 00415 00416 return 1; 00417 } 00418 00419 static hidGC 00420 eps_make_gc (void) 00421 { 00422 hidGC rv = (hidGC) malloc (sizeof (hid_gc_struct)); 00423 rv->cap = Trace_Cap; 00424 rv->width = 0; 00425 rv->color = 0; 00426 return rv; 00427 } 00428 00429 static void 00430 eps_destroy_gc (hidGC gc) 00431 { 00432 free (gc); 00433 } 00434 00435 static void 00436 eps_use_mask (enum mask_mode mode) 00437 { 00438 static int mask_pending = 0; 00439 switch (mode) 00440 { 00441 case HID_MASK_CLEAR: 00442 if (!mask_pending) 00443 { 00444 mask_pending = 1; 00445 fprintf (f, "gsave\n"); 00446 } 00447 break; 00448 case HID_MASK_BEFORE: 00449 case HID_MASK_AFTER: 00450 break; 00451 case HID_MASK_OFF: 00452 if (mask_pending) 00453 { 00454 mask_pending = 0; 00455 fprintf (f, "grestore\n"); 00456 lastcolor = -1; 00457 } 00458 break; 00459 } 00460 } 00461 00462 static void 00463 eps_set_color (hidGC gc, const char *name) 00464 { 00465 static void *cache = 0; 00466 hidval cval; 00467 00468 if (strcmp (name, "erase") == 0) 00469 { 00470 gc->color = 0xffffff; 00471 gc->erase = fast_erase ? 0 : 1; 00472 return; 00473 } 00474 if (strcmp (name, "drill") == 0) 00475 { 00476 gc->color = 0xffffff; 00477 gc->erase = 0; 00478 return; 00479 } 00480 gc->erase = 0; 00481 if (hid_cache_color (0, name, &cval, &cache)) 00482 { 00483 gc->color = cval.lval; 00484 } 00485 else if (in_mono) 00486 { 00487 gc->color = 0; 00488 } 00489 else if (name[0] == '#') 00490 { 00491 unsigned int r, g, b; 00492 sscanf (name + 1, "%2x%2x%2x", &r, &g, &b); 00493 gc->color = (r << 16) + (g << 8) + b; 00494 } 00495 else 00496 gc->color = 0; 00497 } 00498 00499 static void 00500 eps_set_line_cap (hidGC gc, EndCapStyle style) 00501 { 00502 gc->cap = style; 00503 } 00504 00505 static void 00506 eps_set_line_width (hidGC gc, Coord width) 00507 { 00508 gc->width = width; 00509 } 00510 00511 static void 00512 eps_set_draw_xor (hidGC gc, int xor_) 00513 { 00514 ; 00515 } 00516 00517 static void 00518 use_gc (hidGC gc) 00519 { 00520 if (linewidth != gc->width) 00521 { 00522 pcb_fprintf (f, "%mi setlinewidth\n", gc->width); 00523 linewidth = gc->width; 00524 } 00525 if (lastcap != gc->cap) 00526 { 00527 int c; 00528 switch (gc->cap) 00529 { 00530 case Round_Cap: 00531 case Trace_Cap: 00532 c = 1; 00533 break; 00534 default: 00535 case Square_Cap: 00536 c = 2; 00537 break; 00538 } 00539 fprintf (f, "%d setlinecap\n", c); 00540 lastcap = gc->cap; 00541 } 00542 if (lastcolor != gc->color) 00543 { 00544 int c = gc->color; 00545 #define CV(x,b) (((x>>b)&0xff)/255.0) 00546 fprintf (f, "%g %g %g setrgbcolor\n", CV (c, 16), CV (c, 8), CV (c, 0)); 00547 lastcolor = gc->color; 00548 } 00549 } 00550 00551 static void eps_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2); 00552 static void eps_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius); 00553 00554 static void 00555 eps_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) 00556 { 00557 use_gc (gc); 00558 pcb_fprintf (f, "%mi %mi %mi %mi r\n", x1, y1, x2, y2); 00559 } 00560 00561 static void 00562 eps_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) 00563 { 00564 Coord w = gc->width / 2; 00565 if (x1 == x2 && y1 == y2) 00566 { 00567 if (gc->cap == Square_Cap) 00568 eps_fill_rect (gc, x1 - w, y1 - w, x1 + w, y1 + w); 00569 else 00570 eps_fill_circle (gc, x1, y1, w); 00571 return; 00572 } 00573 use_gc (gc); 00574 if (gc->erase && gc->cap != Square_Cap) 00575 { 00576 double ang = atan2 (y2 - y1, x2 - x1); 00577 double dx = w * sin (ang); 00578 double dy = -w * cos (ang); 00579 double deg = ang * 180.0 / M_PI; 00580 Coord vx1 = x1 + dx; 00581 Coord vy1 = y1 + dy; 00582 00583 pcb_fprintf (f, "%mi %mi moveto ", vx1, vy1); 00584 pcb_fprintf (f, "%mi %mi %mi %g %g arc\n", x2, y2, w, deg - 90, deg + 90); 00585 pcb_fprintf (f, "%mi %mi %mi %g %g arc\n", x1, y1, w, deg + 90, deg + 270); 00586 fprintf (f, "nclip\n"); 00587 00588 return; 00589 } 00590 pcb_fprintf (f, "%mi %mi %mi %mi %s\n", x1, y1, x2, y2, gc->erase ? "tc" : "t"); 00591 } 00592 00593 static void 00594 eps_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, 00595 Angle start_angle, Angle delta_angle) 00596 { 00597 Angle sa, ea; 00598 if (delta_angle > 0) 00599 { 00600 sa = start_angle; 00601 ea = start_angle + delta_angle; 00602 } 00603 else 00604 { 00605 sa = start_angle + delta_angle; 00606 ea = start_angle; 00607 } 00608 #if 0 00609 printf ("draw_arc %d,%d %dx%d %d..%d %d..%d\n", 00610 cx, cy, width, height, start_angle, delta_angle, sa, ea); 00611 #endif 00612 use_gc (gc); 00613 pcb_fprintf (f, "%ma %ma %mi %mi %mi %mi %g a\n", 00614 sa, ea, -width, height, cx, cy, (double) linewidth / width); 00615 } 00616 00617 static void 00618 eps_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius) 00619 { 00620 use_gc (gc); 00621 pcb_fprintf (f, "%mi %mi %mi %s\n", cx, cy, radius, gc->erase ? "cc" : "c"); 00622 } 00623 00624 static void 00625 eps_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y) 00626 { 00627 int i; 00628 char *op = "moveto"; 00629 use_gc (gc); 00630 for (i = 0; i < n_coords; i++) 00631 { 00632 pcb_fprintf (f, "%mi %mi %s\n", x[i], y[i], op); 00633 op = "lineto"; 00634 } 00635 fprintf (f, "fill\n"); 00636 } 00637 00638 static void 00639 eps_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2) 00640 { 00641 use_gc (gc); 00642 pcb_fprintf (f, "%mi %mi %mi %mi r\n", x1, y1, x2, y2); 00643 } 00644 00645 static void 00646 eps_calibrate (double xval, double yval) 00647 { 00648 CRASH; 00649 } 00650 00651 static void 00652 eps_set_crosshair (int x, int y, int action) 00653 { 00654 } 00655 00656 void 00657 hid_eps_init () 00658 { 00659 memset (&eps_hid, 0, sizeof (HID)); 00660 memset (&eps_graphics, 0, sizeof (HID_DRAW)); 00661 00662 common_nogui_init (&eps_hid); 00663 common_draw_helpers_init (&eps_graphics); 00664 00665 eps_hid.struct_size = sizeof (HID); 00666 eps_hid.name = "eps"; 00667 eps_hid.description = "Encapsulated Postscript"; 00668 eps_hid.exporter = 1; 00669 eps_hid.poly_after = 1; 00670 00671 eps_hid.get_export_options = eps_get_export_options; 00672 eps_hid.do_export = eps_do_export; 00673 eps_hid.parse_arguments = eps_parse_arguments; 00674 eps_hid.set_layer = eps_set_layer; 00675 eps_hid.calibrate = eps_calibrate; 00676 eps_hid.set_crosshair = eps_set_crosshair; 00677 00678 eps_hid.graphics = &eps_graphics; 00679 00680 eps_graphics.make_gc = eps_make_gc; 00681 eps_graphics.destroy_gc = eps_destroy_gc; 00682 eps_graphics.use_mask = eps_use_mask; 00683 eps_graphics.set_color = eps_set_color; 00684 eps_graphics.set_line_cap = eps_set_line_cap; 00685 eps_graphics.set_line_width = eps_set_line_width; 00686 eps_graphics.set_draw_xor = eps_set_draw_xor; 00687 eps_graphics.draw_line = eps_draw_line; 00688 eps_graphics.draw_arc = eps_draw_arc; 00689 eps_graphics.draw_rect = eps_draw_rect; 00690 eps_graphics.fill_circle = eps_fill_circle; 00691 eps_graphics.fill_polygon = eps_fill_polygon; 00692 eps_graphics.fill_rect = eps_fill_rect; 00693 00694 hid_register_hid (&eps_hid); 00695 }