Fix bug with expanding text.
[geda-pcb/pcjc2.git] / src / hid_draw.h
blob822e58add95074f589850e24b3d7af585d860a90
1 /*!
2 * \file src/hid_draw.h
4 * \brief Human Interface Device - Drawing.
5 * <hr>
7 * <h1><b>Copyright.</b></h1>\n
9 * PCB, interactive printed circuit board design
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Contact addresses for paper mail and Email:
26 * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
27 * haceaton@aplcomm.jhuapl.edu
31 /*!
32 * \brief Mask modes.
34 enum mask_mode
36 HID_MASK_OFF = 0, /*!< Flush the buffer and return to non-mask operation. */
37 HID_MASK_BEFORE = 1, /*!< Polygons being drawn before clears. */
38 HID_MASK_CLEAR = 2, /*!< Clearances being drawn. */
39 HID_MASK_AFTER = 3, /*!< Polygons being drawn after clears. */
43 /*!
44 * \brief Low level drawing API Drawing Functions.
46 * Coordinates and distances are ALWAYS in PCB's default coordinates
47 * (1 nm at the time this comment was written).
49 * Angles are always in degrees, with 0 being "right" (positive X) and
50 * 90 being "up" (positive Y).
52 struct hid_draw_st
54 hidGC (*make_gc) (void); /*!< Make an empty graphics context. */
55 void (*destroy_gc) (hidGC gc);
56 void (*use_mask) (enum mask_mode mode);
58 void (*set_color) (hidGC gc, const char *name);
59 /*!< Set a color. Names can be like "red" or "#rrggbb" or special
60 * names like "erase".
61 * *Always* use the "erase" color for removing ink (like polygon
62 * reliefs or thermals), as you cannot rely on knowing the background
63 * color or special needs of the HID.
64 * Always use the "drill" color to draw holes.
65 * You may assume this is cheap enough to call inside the redraw
66 * callback, but not cheap enough to call for each item drawn.
69 void (*set_line_cap) (hidGC gc, EndCapStyle style);
70 /*!< Set the line style. While calling this is cheap, calling it with
71 * different values each time may be expensive, so grouping items by
72 * line style is helpful.
74 void (*set_line_width) (hidGC gc, Coord width);
75 void (*set_draw_xor) (hidGC gc, int xor_);
77 void (*set_draw_faded) (hidGC gc, int faded);
78 /*!< Blends 20% or so color with 80% background.
79 * Only used for assembly drawings so far.
82 /* The usual drawing functions. "draw" means to use segments of the
83 given width, whereas "fill" means to fill to a zero-width
84 outline. */
85 void (*draw_line) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
86 void (*draw_arc) (hidGC gc, Coord cx, Coord cy, Coord xradius, Coord yradius, Angle start_angle, Angle delta_angle);
87 void (*draw_rect) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
88 void (*fill_circle) (hidGC gc, Coord cx, Coord cy, Coord radius);
89 void (*fill_polygon) (hidGC gc, int n_coords, Coord *x, Coord *y);
90 void (*fill_rect) (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2);
92 /* The following APIs render using PCB data-structures, not immediate parameters */
94 void (*draw_pcb_line) (hidGC gc, LineType *line);
95 void (*draw_pcb_arc) (hidGC gc, ArcType *arc);
96 void (*draw_pcb_text) (hidGC gc, TextType *, Coord);
97 void (*draw_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
99 void (*fill_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
100 void (*thindraw_pcb_polygon) (hidGC gc, PolygonType *poly, const BoxType *clip_box);
101 void (*fill_pcb_pad) (hidGC gc, PadType *pad, bool clip, bool mask);
102 void (*thindraw_pcb_pad) (hidGC gc, PadType *pad, bool clip, bool mask);
103 void (*fill_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);
104 void (*thindraw_pcb_pv) (hidGC fg_gc, hidGC bg_gc, PinType *pv, bool drawHole, bool mask);