#include #include #include #include #include "global.h" #include "data.h" #include "hid.h" #include "../hidint.h" #ifndef MAXINT #define MAXINT (((unsigned int)(~0))>>1) #endif static BoxType box; typedef struct hid_gc_struct { int width; } hid_gc_struct; static int extents_set_layer (const char *name, int group) { int idx = group; if (idx >= 0 && idx < MAX_LAYER) { idx = PCB->LayerGroups.Entries[idx][0]; } if (idx >= 0 && idx < MAX_LAYER+2) return 1; if (idx < 0) { switch (SL_TYPE (idx)) { case SL_INVISIBLE: case SL_MASK: case SL_ASSY: return 0; case SL_SILK: case SL_DRILL: return 1; } } return 0; } static hidGC extents_make_gc (void) { hidGC rv = malloc (sizeof(hid_gc_struct)); memset (rv, 0, sizeof(hid_gc_struct)); return rv; } static void extents_destroy_gc (hidGC gc) { free (gc); } static void extents_use_mask (int use_it) { } static void extents_set_color (hidGC gc, const char *name) { } static void extents_set_line_cap (hidGC gc, EndCapStyle style) { } static void extents_set_line_width (hidGC gc, int width) { gc->width = width; } static void extents_set_draw_xor (hidGC gc, int xor) { } static void extents_set_draw_faded (hidGC gc, int faded) { } static void extents_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2) { } #define PEX(x,w) if (box.X1 > (x)-(w)) box.X1 = (x)-(w); \ if (box.X2 < (x)+(w)) box.X2 = (x)+(w) #define PEY(y,w) if (box.Y1 > (y)-(w)) box.Y1 = (y)-(w); \ if (box.Y2 < (y)+(w)) box.Y2 = (y)+(w) static void extents_draw_line (hidGC gc, int x1, int y1, int x2, int y2) { PEX(x1, gc->width); PEY(y1, gc->width); PEX(x2, gc->width); PEY(y2, gc->width); } static void extents_draw_arc (hidGC gc, int cx, int cy, int width, int height, int start_angle, int end_angle) { /* Naive but good enough. */ PEX(cx, width + gc->width); PEY(cy, height + gc->width); } static void extents_draw_rect (hidGC gc, int x1, int y1, int x2, int y2) { PEX(x1, gc->width); PEY(y1, gc->width); PEX(x2, gc->width); PEY(y2, gc->width); } static void extents_fill_circle (hidGC gc, int cx, int cy, int radius) { PEX(cx, radius); PEY(cy, radius); } static void extents_fill_polygon (hidGC gc, int n_coords, int *x, int *y) { int i; for (i=0; i