… | |
… | |
36 | struct display_list; |
36 | struct display_list; |
37 | struct mapset; |
37 | struct mapset; |
38 | |
38 | |
39 | enum draw_mode_num |
39 | enum draw_mode_num |
40 | { |
40 | { |
41 | draw_mode_begin, |
41 | draw_mode_begin, // 0 |
42 | draw_mode_begin_clear, |
42 | draw_mode_begin_clear, // 1 |
43 | draw_mode_end, |
43 | draw_mode_end, // 2 |
44 | draw_mode_cursor, |
44 | draw_mode_cursor, // 3 |
45 | draw_mode_end_lazy |
45 | draw_mode_end_lazy |
|
|
46 | // 4 |
46 | }; |
47 | }; |
47 | |
48 | |
48 | #include "item.h" |
49 | #include "item.h" |
49 | |
50 | |
50 | struct display_context |
51 | struct display_context |
… | |
… | |
61 | int maxlen; |
62 | int maxlen; |
62 | }; |
63 | }; |
63 | |
64 | |
64 | //#define HASH_SIZE_GRAPHICS_ 1024 |
65 | //#define HASH_SIZE_GRAPHICS_ 1024 |
65 | #define HASH_SIZE_GRAPHICS_ 2048 // inc. hash size for layer items |
66 | #define HASH_SIZE_GRAPHICS_ 2048 // inc. hash size for layer items |
66 | |
|
|
67 | struct hash_entry |
67 | struct hash_entry |
68 | { |
68 | { |
69 | enum item_type type; |
69 | enum item_type type; |
70 | struct displayitem *di; |
70 | struct displayitem *di; |
71 | }; |
71 | }; |
… | |
… | |
100 | |
100 | |
101 | struct graphics_methods |
101 | struct graphics_methods |
102 | { |
102 | { |
103 | void (*graphics_destroy)(struct graphics_priv *gr); |
103 | void (*graphics_destroy)(struct graphics_priv *gr); |
104 | void (*draw_mode)(struct graphics_priv *gr, enum draw_mode_num mode); |
104 | void (*draw_mode)(struct graphics_priv *gr, enum draw_mode_num mode); |
105 | void (*draw_lines)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
105 | void (*draw_lines)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count); |
106 | struct point *p, int count); |
106 | void (*draw_lines2)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int order, int oneway); |
107 | void (*draw_lines2)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
107 | void (*draw_lines3)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int order, int width, int dashes, struct color *c); |
108 | struct point *p, int count, int order, int oneway); |
108 | void (*draw_lines4)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int order, int width, int type, int dashes, struct color *c); |
109 | void (*draw_lines3)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
109 | void (*draw_lines_dashed)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int order, int oneway); |
110 | struct point *p, int count, int order, int width); |
|
|
111 | void (*draw_lines4)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
|
|
112 | struct point *p, int count, int order, int width, int type); |
|
|
113 | void (*draw_lines_dashed)(struct graphics_priv *gr, |
|
|
114 | struct graphics_gc_priv *gc, struct point *p, int count, int order, |
|
|
115 | int oneway); |
|
|
116 | void (*draw_polygon)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
110 | void (*draw_polygon)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count); |
117 | struct point *p, int count); |
111 | void (*draw_polygon2)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int order, int oneway); |
118 | void (*draw_polygon2)(struct graphics_priv *gr, |
112 | void (*draw_rectangle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h); |
119 | struct graphics_gc_priv *gc, struct point *p, int count, int order, |
|
|
120 | int oneway); |
|
|
121 | void (*draw_rectangle)(struct graphics_priv *gr, |
|
|
122 | struct graphics_gc_priv *gc, struct point *p, int w, int h); |
|
|
123 | void (*draw_circle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, |
113 | void (*draw_circle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r); |
124 | struct point *p, int r); |
114 | void (*draw_text)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy); |
125 | void (*draw_text)(struct graphics_priv *gr, struct graphics_gc_priv *fg, |
115 | void (*draw_image)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img); |
126 | struct graphics_gc_priv *bg, struct graphics_font_priv *font, |
116 | void (*draw_bigmap)(struct graphics_priv *gr, struct graphics_gc_priv *fg, int yaw, int order, float clat, float clng, int x, int y, int scx, int scy, int px, int py, int valid); |
127 | char *text, struct point *p, int dx, int dy); |
|
|
128 | void (*draw_image)(struct graphics_priv *gr, struct graphics_gc_priv *fg, |
|
|
129 | struct point *p, struct graphics_image_priv *img); |
|
|
130 | void (*draw_bigmap)(struct graphics_priv *gr, struct graphics_gc_priv *fg, |
|
|
131 | int yaw, int order, float clat, float clng, int x, int y, int scx, |
|
|
132 | int scy, int px, int py, int valid); |
|
|
133 | void (*send_osd_values)(struct graphics_priv *gr, |
|
|
134 | struct graphics_gc_priv *fg, char *id, char *text1, char *text2, |
|
|
135 | char *text3, int i1, int i2, int i3, int i4, float f1, float f2, |
|
|
136 | float f3); |
|
|
137 | void |
117 | void |
138 | (*draw_image_warp)(struct graphics_priv *gr, |
118 | (*draw_image_warp)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data); |
139 | struct graphics_gc_priv *fg, struct point *p, int count, |
|
|
140 | char *data); |
|
|
141 | void (*draw_restore)(struct graphics_priv *gr, struct point *p, int w, |
119 | void (*draw_restore)(struct graphics_priv *gr, struct point *p, int w, int h); |
142 | int h); |
|
|
143 | void (*draw_drag)(struct graphics_priv *gr, struct point *p); |
120 | void (*draw_drag)(struct graphics_priv *gr, struct point *p); |
144 | struct graphics_font_priv |
121 | struct graphics_font_priv |
145 | *(*font_new)(struct graphics_priv *gr, |
122 | *(*font_new)(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags); |
146 | struct graphics_font_methods *meth, char *font, int size, |
|
|
147 | int flags); |
|
|
148 | struct graphics_gc_priv *(*gc_new)(struct graphics_priv *gr, |
123 | struct graphics_gc_priv *(*gc_new)(struct graphics_priv *gr, struct graphics_gc_methods *meth); |
149 | struct graphics_gc_methods *meth); |
|
|
150 | void |
124 | void |
151 | (*background_gc)(struct graphics_priv *gr, |
125 | (*background_gc)(struct graphics_priv *gr, struct graphics_gc_priv *gc); |
152 | struct graphics_gc_priv *gc); |
126 | struct graphics_priv *(*overlay_new)(const char* name, struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound); |
153 | struct graphics_priv *(*overlay_new)(struct graphics_priv *gr, |
127 | struct graphics_image_priv *(*image_new)(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation); |
154 | struct graphics_methods *meth, struct point *p, int w, int h, |
|
|
155 | int alpha, int wraparound); |
|
|
156 | struct graphics_image_priv *(*image_new)(struct graphics_priv *gr, |
|
|
157 | struct graphics_image_methods *meth, char *path, int *w, int *h, |
|
|
158 | struct point *hot, int rotation); |
|
|
159 | void *(*get_data)(struct graphics_priv *gr, const char *type); |
128 | void *(*get_data)(struct graphics_priv *gr, const char *type); |
160 | void (*image_free)(struct graphics_priv *gr, |
129 | void (*image_free)(struct graphics_priv *gr, struct graphics_image_priv *priv); |
161 | struct graphics_image_priv *priv); |
130 | void (*get_text_bbox)(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate); |
162 | void (*get_text_bbox)(struct graphics_priv *gr, |
|
|
163 | struct graphics_font_priv *font, char *text, int dx, int dy, |
|
|
164 | struct point *ret, int estimate); |
|
|
165 | void (*overlay_disable)(struct graphics_priv *gr, int disable); |
131 | void (*overlay_disable)(struct graphics_priv *gr, int disable); |
166 | void (*overlay_resize)(struct graphics_priv *gr, struct point *p, int w, |
132 | void (*overlay_resize)(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound); |
167 | int h, int alpha, int wraparound); |
|
|
168 | int (*set_attr)(struct graphics_priv *gr, struct attr *attr); |
133 | int (*set_attr)(struct graphics_priv *gr, struct attr *attr); |
169 | }; |
134 | }; |
170 | |
135 | |
171 | struct graphics_font_methods |
136 | struct graphics_font_methods |
172 | { |
137 | { |
… | |
… | |
181 | |
146 | |
182 | struct graphics_gc_methods |
147 | struct graphics_gc_methods |
183 | { |
148 | { |
184 | void (*gc_destroy)(struct graphics_gc_priv *gc); |
149 | void (*gc_destroy)(struct graphics_gc_priv *gc); |
185 | void (*gc_set_linewidth)(struct graphics_gc_priv *gc, int width); |
150 | void (*gc_set_linewidth)(struct graphics_gc_priv *gc, int width); |
186 | void (*gc_set_dashes)(struct graphics *gra, struct graphics_gc_priv *gc, int width, int offset, |
151 | void (*gc_set_dashes)(struct graphics *gra, struct graphics_gc_priv *gc, int width, int offset, int dash_list[], int order); |
187 | int dash_list[], int order); |
|
|
188 | void (*gc_set_foreground)(struct graphics_gc_priv *gc, struct color *c); |
152 | void (*gc_set_foreground)(struct graphics_gc_priv *gc, struct color *c); |
189 | void (*gc_set_background)(struct graphics_gc_priv *gc, struct color *c); |
153 | void (*gc_set_background)(struct graphics_gc_priv *gc, struct color *c); |
190 | void (*gc_set_stipple)(struct graphics_gc_priv *gc, |
154 | void (*gc_set_stipple)(struct graphics_gc_priv *gc, struct graphics_image_priv *img); |
191 | struct graphics_image_priv *img); |
|
|
192 | }; |
155 | }; |
193 | |
156 | |
194 | struct graphics_gc |
157 | struct graphics_gc |
195 | { |
158 | { |
196 | struct graphics_gc_priv *priv; |
159 | struct graphics_gc_priv *priv; |
… | |
… | |
241 | struct point_rect; |
204 | struct point_rect; |
242 | struct transformation; |
205 | struct transformation; |
243 | int graphics_set_attr(struct graphics *gra, struct attr *attr); |
206 | int graphics_set_attr(struct graphics *gra, struct attr *attr); |
244 | void graphics_set_rect(struct graphics *gra, struct point_rect *pr); |
207 | void graphics_set_rect(struct graphics *gra, struct point_rect *pr); |
245 | struct graphics *graphics_new(struct attr *parent, struct attr **attrs); |
208 | struct graphics *graphics_new(struct attr *parent, struct attr **attrs); |
246 | int graphics_get_attr(struct graphics *this_, enum attr_type type, |
209 | int graphics_get_attr(struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter); |
247 | struct attr *attr, struct attr_iter *iter); |
210 | struct graphics *graphics_overlay_new(const char* name, struct graphics *parent, struct point *p, int w, int h, int alpha, int wraparound); |
248 | struct graphics *graphics_overlay_new(struct graphics *parent, struct point *p, |
|
|
249 | int w, int h, int alpha, int wraparound); |
|
|
250 | void graphics_overlay_resize(struct graphics *this_, struct point *p, int w, |
211 | void graphics_overlay_resize(struct graphics *this_, struct point *p, int w, int h, int alpha, int wraparound); |
251 | int h, int alpha, int wraparound); |
|
|
252 | void graphics_init(struct graphics *this_); |
212 | void graphics_init(struct graphics *this_); |
253 | void *graphics_get_data(struct graphics *this_, const char *type); |
213 | void *graphics_get_data(struct graphics *this_, const char *type); |
254 | void graphics_add_callback(struct graphics *this_, struct callback *cb); |
214 | void graphics_add_callback(struct graphics *this_, struct callback *cb); |
255 | void graphics_remove_callback(struct graphics *this_, struct callback *cb); |
215 | void graphics_remove_callback(struct graphics *this_, struct callback *cb); |
256 | struct graphics_font *graphics_font_new(struct graphics *gra, int size, |
216 | struct graphics_font *graphics_font_new(struct graphics *gra, int size, int flags); |
257 | int flags); |
|
|
258 | struct graphics_font *graphics_named_font_new(struct graphics *gra, char *font, |
217 | struct graphics_font *graphics_named_font_new(struct graphics *gra, char *font, int size, int flags); |
259 | int size, int flags); |
|
|
260 | void graphics_free(struct graphics *gra); |
218 | void graphics_free(struct graphics *gra); |
261 | void graphics_font_destroy_all(struct graphics *gra); |
219 | void graphics_font_destroy_all(struct graphics *gra); |
262 | struct graphics_gc *graphics_gc_new(struct graphics *gra); |
220 | struct graphics_gc *graphics_gc_new(struct graphics *gra); |
263 | void graphics_gc_destroy(struct graphics_gc *gc); |
221 | void graphics_gc_destroy(struct graphics_gc *gc); |
264 | void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c); |
222 | void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c); |
265 | void graphics_gc_set_background(struct graphics_gc *gc, struct color *c); |
223 | void graphics_gc_set_background(struct graphics_gc *gc, struct color *c); |
266 | void |
224 | void |
267 | graphics_gc_set_stipple(struct graphics_gc *gc, |
225 | graphics_gc_set_stipple(struct graphics_gc *gc, struct graphics_image *img); |
268 | struct graphics_image *img); |
|
|
269 | void graphics_gc_set_linewidth(struct graphics_gc *gc, int width); |
226 | void graphics_gc_set_linewidth(struct graphics_gc *gc, int width); |
270 | void graphics_gc_set_dashes(struct graphics *gra, struct graphics_gc *gc, int width, int offset, |
227 | void graphics_gc_set_dashes(struct graphics *gra, struct graphics_gc *gc, int width, int offset, int dash_list[], int n, int order); |
271 | int dash_list[], int n, int order); |
|
|
272 | struct graphics_image *graphics_image_new_scaled(struct graphics *gra, |
228 | struct graphics_image *graphics_image_new_scaled(struct graphics *gra, char *path, int w, int h); |
273 | char *path, int w, int h); |
|
|
274 | struct graphics_image *graphics_image_new_scaled_rotated(struct graphics *gra, |
229 | struct graphics_image *graphics_image_new_scaled_rotated(struct graphics *gra, char *path, int w, int h, int rotate); |
275 | char *path, int w, int h, int rotate); |
|
|
276 | struct graphics_image *graphics_image_new(struct graphics *gra, char *path); |
230 | struct graphics_image *graphics_image_new(struct graphics *gra, char *path); |
277 | void graphics_image_free(struct graphics *gra, struct graphics_image *img); |
231 | void graphics_image_free(struct graphics *gra, struct graphics_image *img); |
278 | void graphics_draw_restore(struct graphics *this_, struct point *p, int w, |
232 | void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h); |
279 | int h); |
|
|
280 | void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode); |
233 | void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode); |
281 | void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, |
234 | void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count); |
282 | struct point *p, int count); |
|
|
283 | void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, |
235 | void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r); |
284 | struct point *p, int r); |
|
|
285 | void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, |
236 | void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h); |
286 | struct point *p, int w, int h); |
237 | void graphics_draw_rectangle_rounded(struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill); |
287 | void graphics_draw_rectangle_rounded(struct graphics *this_, |
238 | void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy); |
288 | struct graphics_gc *gc, struct point *plu, int w, int h, int r, |
239 | void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret, int estimate); |
289 | int fill); |
|
|
290 | void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, |
|
|
291 | struct graphics_gc *gc2, struct graphics_font *font, char *text, |
|
|
292 | struct point *p, int dx, int dy); |
|
|
293 | void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, |
|
|
294 | char *text, int dx, int dy, struct point *ret, int estimate); |
|
|
295 | void graphics_overlay_disable(struct graphics *this_, int disable); |
240 | void graphics_overlay_disable(struct graphics *this_, int disable); |
296 | void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, |
241 | void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img); |
297 | struct point *p, struct graphics_image *img); |
|
|
298 | int graphics_draw_drag(struct graphics *this_, struct point *p); |
242 | int graphics_draw_drag(struct graphics *this_, struct point *p); |
299 | void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc); |
243 | void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc); |
300 | void graphics_draw_text_std(struct graphics *this_, int text_size, char *text, |
244 | void graphics_draw_text_std(struct graphics *this_, int text_size, char *text, struct point *p); |
301 | struct point *p); |
|
|
302 | char *graphics_icon_path(char *icon); |
245 | char *graphics_icon_path(char *icon); |
303 | void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, |
246 | void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label); |
304 | struct transformation *t, char *label); |
247 | void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags); |
305 | void graphics_displaylist_draw(struct graphics *gra, |
248 | void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags); |
306 | struct displaylist *displaylist, struct transformation *trans, |
|
|
307 | struct layout *l, int flags); |
|
|
308 | void graphics_draw(struct graphics *gra, struct displaylist *displaylist, |
|
|
309 | struct mapset *mapset, struct transformation *trans, struct layout *l, |
|
|
310 | int async, struct callback *cb, int flags); |
|
|
311 | int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist); |
249 | int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist); |
312 | struct displaylist_handle *graphics_displaylist_open( |
250 | struct displaylist_handle *graphics_displaylist_open(struct displaylist *displaylist); |
313 | struct displaylist *displaylist); |
|
|
314 | struct displayitem *graphics_displaylist_next(struct displaylist_handle *dlh); |
251 | struct displayitem *graphics_displaylist_next(struct displaylist_handle *dlh); |
315 | void graphics_displaylist_close(struct displaylist_handle *dlh); |
252 | void graphics_displaylist_close(struct displaylist_handle *dlh); |
316 | struct displaylist *graphics_displaylist_new(void); |
253 | struct displaylist *graphics_displaylist_new(void); |
317 | struct item *graphics_displayitem_get_item(struct displayitem *di); |
254 | struct item *graphics_displayitem_get_item(struct displayitem *di); |
318 | int graphics_displayitem_get_coord_count(struct displayitem *di); |
255 | int graphics_displayitem_get_coord_count(struct displayitem *di); |
319 | char *graphics_displayitem_get_label(struct displayitem *di); |
256 | char *graphics_displayitem_get_label(struct displayitem *di); |
320 | int graphics_displayitem_get_displayed(struct displayitem *di); |
257 | int graphics_displayitem_get_displayed(struct displayitem *di); |
321 | int graphics_displayitem_within_dist(struct displaylist *displaylist, |
258 | int graphics_displayitem_within_dist(struct displaylist *displaylist, struct displayitem *di, struct point *p, int dist); |
322 | struct displayitem *di, struct point *p, int dist); |
259 | void graphics_add_selection(struct graphics *gra, struct item *item, enum item_type type, struct displaylist *dl); |
323 | void graphics_add_selection(struct graphics *gra, struct item *item, |
|
|
324 | enum item_type type, struct displaylist *dl); |
|
|
325 | void graphics_remove_selection(struct graphics *gra, struct item *item, |
260 | void graphics_remove_selection(struct graphics *gra, struct item *item, enum item_type type, struct displaylist *dl); |
326 | enum item_type type, struct displaylist *dl); |
|
|
327 | void graphics_clear_selection(struct graphics *gra, struct displaylist *dl); |
261 | void graphics_clear_selection(struct graphics *gra, struct displaylist *dl); |
328 | /* end of prototypes */ |
262 | /* end of prototypes */ |
329 | #ifdef __cplusplus |
263 | #ifdef __cplusplus |
330 | } |
264 | } |
331 | #endif |
265 | #endif |