pcb 4.1.1
An interactive printed circuit board layout editor.

eps.c File Reference

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "global.h"
#include "data.h"
#include "misc.h"
#include "pcb-printf.h"
#include "hid.h"
#include "hid_draw.h"
#include "../hidint.h"
#include "hid/common/hidnogui.h"
#include "hid/common/draw_helpers.h"
#include "../ps/ps.h"
#include "hid/common/hidinit.h"
Include dependency graph for eps.c:

Go to the source code of this file.

Data Structures

struct  hid_gc_struct

Defines

#define CRASH   fprintf(stderr, "HID error: pcb called unimplemented EPS function %s.\n", __FUNCTION__); abort()

Typedefs

typedef struct hid_gc_struct hid_gc_struct

Functions

static HID_Attributeeps_get_export_options (int *n)
static void eps_do_export (HID_Attr_Val *options)
static void eps_parse_arguments (int *argc, char ***argv)
static int eps_set_layer (const char *name, int group, int empty)
static hidGC eps_make_gc (void)
static void eps_destroy_gc (hidGC gc)
static void eps_use_mask (enum mask_mode mode)
static void eps_set_color (hidGC gc, const char *name)
static void eps_set_line_cap (hidGC gc, EndCapStyle style)
static void eps_set_line_width (hidGC gc, Coord width)
static void eps_set_draw_xor (hidGC gc, int _xor)
static void eps_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void eps_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void eps_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle)
static void eps_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void eps_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
static void eps_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y)
static void eps_calibrate (double xval, double yval)
static void eps_set_crosshair (int x, int y, int action)
 REGISTER_ATTRIBUTES (eps_attribute_list)
static int layer_stack_sort (const void *va, const void *vb)
void eps_hid_export_to_file (FILE *the_file, HID_Attr_Val *options)
static void use_gc (hidGC gc)
void hid_eps_init ()

Variables

static HID eps_hid
static HID_DRAW eps_graphics
static FILE * f = 0
static Coord linewidth = -1
static int lastcap = -1
static int lastcolor = -1
static int print_group [MAX_GROUP]
static int print_layer [MAX_ALL_LAYER]
static int fast_erase = -1
static HID_Attribute eps_attribute_list []
static int top_group
static int bottom_group
static const char * filename
static BoxTypebounds
static int in_mono
static int as_shown
static int is_mask
static int is_paste
static int is_drill

Define Documentation

#define CRASH   fprintf(stderr, "HID error: pcb called unimplemented EPS function %s.\n", __FUNCTION__); abort()

Definition at line 28 of file eps.c.

Referenced by eps_calibrate().


Typedef Documentation

typedef struct hid_gc_struct hid_gc_struct

Function Documentation

static void eps_calibrate ( double  xval,
double  yval 
) [static]

Definition at line 646 of file eps.c.

References CRASH.

Referenced by hid_eps_init().

static void eps_destroy_gc ( hidGC  gc) [static]

Definition at line 430 of file eps.c.

Referenced by hid_eps_init().

static void eps_do_export ( HID_Attr_Val options) [static]

Definition at line 317 of file eps.c.

References eps_get_export_options(), eps_hid_export_to_file(), f, filename, hid_restore_layer_ons(), hid_save_and_show_layer_ons(), MAX_ALL_LAYER, and HID_Attr_Val::str_value.

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_draw_arc ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  width,
Coord  height,
Angle  start_angle,
Angle  delta_angle 
) [static]

Definition at line 594 of file eps.c.

References f, linewidth, pcb_fprintf(), start_angle, and use_gc().

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_draw_line ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 562 of file eps.c.

References hid_gc_struct::cap, eps_fill_circle(), eps_fill_rect(), hid_gc_struct::erase, f, M_PI, pcb_fprintf(), Square_Cap, use_gc(), and hid_gc_struct::width.

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_draw_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 555 of file eps.c.

References f, pcb_fprintf(), and use_gc().

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_fill_circle ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  radius 
) [static]

Definition at line 618 of file eps.c.

References hid_gc_struct::erase, f, pcb_fprintf(), and use_gc().

Referenced by eps_draw_line(), and hid_eps_init().

Here is the call graph for this function:

static void eps_fill_polygon ( hidGC  gc,
int  n_coords,
Coord x,
Coord y 
) [static]

Definition at line 625 of file eps.c.

References f, pcb_fprintf(), and use_gc().

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_fill_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 639 of file eps.c.

References f, pcb_fprintf(), and use_gc().

Referenced by eps_draw_line(), and hid_eps_init().

Here is the call graph for this function:

static HID_Attribute* eps_get_export_options ( int *  n) [static]

Referenced by eps_do_export(), and hid_eps_init().

static hidGC eps_make_gc ( void  ) [static]

Definition at line 420 of file eps.c.

References hid_gc_struct::cap, hid_gc_struct::color, malloc(), Trace_Cap, and hid_gc_struct::width.

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_parse_arguments ( int *  argc,
char ***  argv 
) [static]

Definition at line 351 of file eps.c.

References hid_parse_command_line(), and hid_register_attributes().

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_set_color ( hidGC  gc,
const char *  name 
) [static]

Definition at line 463 of file eps.c.

References hid_gc_struct::color, hid_gc_struct::erase, fast_erase, hid_cache_color(), in_mono, and hidval::lval.

Referenced by hid_eps_init().

Here is the call graph for this function:

static void eps_set_crosshair ( int  x,
int  y,
int  action 
) [static]

Definition at line 652 of file eps.c.

Referenced by hid_eps_init().

static void eps_set_draw_xor ( hidGC  gc,
int  _xor 
) [static]

Definition at line 512 of file eps.c.

Referenced by hid_eps_init().

static int eps_set_layer ( const char *  name,
int  group,
int  empty 
) [static]
static void eps_set_line_cap ( hidGC  gc,
EndCapStyle  style 
) [static]

Definition at line 500 of file eps.c.

References hid_gc_struct::cap, and style.

Referenced by hid_eps_init().

static void eps_set_line_width ( hidGC  gc,
Coord  width 
) [static]

Definition at line 506 of file eps.c.

References hid_gc_struct::width.

Referenced by hid_eps_init().

static void eps_use_mask ( enum mask_mode  mode) [static]

Definition at line 436 of file eps.c.

References f, HID_MASK_AFTER, HID_MASK_BEFORE, HID_MASK_CLEAR, HID_MASK_OFF, and lastcolor.

Referenced by hid_eps_init().

static int layer_stack_sort ( const void *  va,
const void *  vb 
) [static]

Definition at line 155 of file eps.c.

References bottom_group, GetLayerGroupNumberByNumber(), and top_group.

Referenced by eps_hid_export_to_file().

Here is the call graph for this function:

REGISTER_ATTRIBUTES ( eps_attribute_list  )

Definition at line 136 of file eps.c.

References derive_default_filename(), eps_attribute_list, PCBType::Filename, and PCB.

Here is the call graph for this function:

static void use_gc ( hidGC  gc) [static]

Variable Documentation

int as_shown

Definition at line 175 of file eps.c.

Definition at line 152 of file eps.c.

BoxType* bounds [static]

Definition at line 174 of file eps.c.

Initial value:
 {
  


  {"eps-file", "Encapsulated Postscript output file",
   HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_psfile 0


  {"eps-scale", "EPS scale",
   HID_Real, 0, 100, {0, 0, 1.0}, 0, 0},
#define HA_scale 1


  {"screen-layer-order", "Export layers in the order shown on screen",
   HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_as_shown 2


  {"monochrome", "Convert to monochrome",
   HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_mono 3


  {"only-visible", "Limit the bounds of the EPS file to the visible items",
   HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_only_visible 4
}

Definition at line 73 of file eps.c.

Referenced by REGISTER_ATTRIBUTES().

Definition at line 63 of file eps.c.

Referenced by hid_eps_init().

HID eps_hid [static]

Definition at line 62 of file eps.c.

int fast_erase = -1 [static]

Definition at line 71 of file eps.c.

Referenced by eps_hid_export_to_file(), and eps_set_color().

const char* filename [static]

Definition at line 173 of file eps.c.

Referenced by eps_do_export(), and eps_hid_export_to_file().

int in_mono [static]

Definition at line 175 of file eps.c.

Referenced by eps_hid_export_to_file(), and eps_set_color().

int is_drill [static]

Definition at line 361 of file eps.c.

Referenced by eps_set_layer().

int is_mask [static]

Definition at line 359 of file eps.c.

Referenced by eps_set_layer().

int is_paste [static]

Definition at line 360 of file eps.c.

Referenced by eps_set_layer(), ps_draw_line(), ps_fill_rect(), and REGISTER_ATTRIBUTES().

int lastcap = -1 [static]

Definition at line 67 of file eps.c.

Referenced by eps_hid_export_to_file(), and use_gc().

int lastcolor = -1 [static]

Definition at line 68 of file eps.c.

Referenced by eps_hid_export_to_file(), eps_use_mask(), lesstif_set_color(), and use_gc().

Coord linewidth = -1 [static]

Definition at line 66 of file eps.c.

Referenced by eps_draw_arc(), eps_hid_export_to_file(), and use_gc().

int print_group[MAX_GROUP] [static]

Definition at line 69 of file eps.c.

Referenced by eps_hid_export_to_file().

int print_layer[MAX_ALL_LAYER] [static]

Definition at line 70 of file eps.c.

Referenced by eps_hid_export_to_file(), and eps_set_layer().

int top_group [static]

Definition at line 152 of file eps.c.

Referenced by eps_hid_export_to_file(), and layer_stack_sort().