(no commit message)
[geda-pcb/pcjc2.git] / src / hid_draw.h
blobb65d8046d8f8ee5519c4f20ba8f2dadce037236a
1 enum mask_mode {
2 HID_MASK_OFF = 0, /* Flush the buffer and return to non-mask operation. */
3 HID_MASK_BEFORE = 1, /* Polygons being drawn before clears. */
4 HID_MASK_CLEAR = 2, /* Clearances being drawn. */
5 HID_MASK_AFTER = 3, /* Polygons being drawn after clears. */
6 };
8 /* Low level drawing API */
10 struct hid_draw_st
12 /* Drawing Functions. Coordinates and distances are ALWAYS in PCB's
13 default coordinates (1 nm at the time this comment was written).
14 Angles are always in degrees, with 0 being "right" (positive X)
15 and 90 being "up" (positive Y). */
17 /* Make an empty graphics context. */
18 hidGC (*make_gc) (void);
19 void (*destroy_gc) (hidGC gc);
20 void (*use_mask) (enum mask_mode mode);
22 /* Set a color. Names can be like "red" or "#rrggbb" or special
23 names like "erase". *Always* use the "erase" color for removing
24 ink (like polygon reliefs or thermals), as you cannot rely on
25 knowing the background color or special needs of the HID. Always
26 use the "drill" color to draw holes. You may assume this is
27 cheap enough to call inside the redraw callback, but not cheap
28 enough to call for each item drawn. */
29 void (*set_color) (hidGC gc, const char *name);
31 /* Set the line style. While calling this is cheap, calling it with
32 different values each time may be expensive, so grouping items by
33 line style is helpful. */
34 void (*set_line_cap) (hidGC gc, EndCapStyle style);
35 void (*set_line_width) (hidGC gc, Coord width);
36 void (*set_draw_xor) (hidGC gc, int xor_);
38 /* Blends 20% or so color with 80% background. Only used for
39 assembly drawings so far. */
40 void (*set_draw_faded) (hidGC gc, int faded);
42 /* The usual drawing functions. "draw" means to use segments of the
43 given width, whereas "fill" means to fill to a zero-width
44 outline. */
45 void (*draw_line) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
46 void (*draw_arc) (hidGC gc, Coord cx, Coord cy, Coord xradius, Coord yradius, Angle start_angle, Angle delta_angle);
47 void (*draw_rect) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
48 void (*fill_circle) (hidGC gc, Coord cx, Coord cy, Coord radius);
49 void (*fill_polygon) (hidGC gc, int n_coords, Coord *x, Coord *y);
50 void (*fill_rect) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
52 /* The following APIs render using PCB data-structures, not immediate parameters */
54 void (*draw_pcb_line) (hidGC gc, LineType *line);
55 void (*draw_pcb_arc) (hidGC gc, ArcType *arc);
56 void (*draw_pcb_text) (hidGC gc, TextType *, Coord);
57 void (*draw_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
59 void (*fill_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
60 void (*thindraw_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
61 void (*fill_pcb_pad) (hidGC gc, PadType *pad, bool clip, bool mask);
62 void (*thindraw_pcb_pad) (hidGC gc, PadType *pad, bool clip, bool mask);
63 void (*fill_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);
64 void (*thindraw_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);