Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gvcjob.h
Go to the documentation of this file.
1
3/*************************************************************************
4 * Copyright (c) 2011 AT&T Intellectual Property
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * https://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: Details at https://graphviz.org
11 *************************************************************************/
12
13/* Common header used by both clients and plugins */
14
15#pragma once
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include "gvcommon.h"
22#include "color.h"
23#include <stdbool.h>
24#include <stddef.h>
25
26#define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
27
29 typedef struct gvformatter_engine_s gvformatter_engine_t;
34
39
40#define PENWIDTH_NORMAL 1.
41#define PENWIDTH_BOLD 2.
42
43/* The -T output formats listed below are examples only, they are not definitive or inclusive,
44 other outputs may use the flags now, or in the future
45
46 Default emit order is breadth first graph walk order
47 EMIT_SORTED emits nodes before edges
48 EMIT_COLORS emits colors before nodes or edge -Tfig
49 EMIT_CLUSTERS_LAST emits cluster after nodes and edges
50 EMIT_PREORDER emit in preorder traversal ???
51 EMIT_EDGE_SORTED emits edges before nodes
52
53 GVDEVICE_DOES_PAGES provides pagination support -Tps
54 GVDEVICE_DOES_LAYERS provides support for layers -Tps
55 GVDEVICE_EVENTS supports mouse events -Txlib
56 GVDEVICE_DOES_TRUECOLOR supports alpha channel -Tpng, -Txlib
57 GVDEVICE_BINARY_FORMAT Suppresses \r\n substitution for linends
58 GVDEVICE_COMPRESSED_FORMAT controls libz compression
59 GVDEVICE_NO_WRITER used when gvdevice is not used because device uses its own writer, devil outputs (FIXME seems to overlap OUTPUT_NOT_REQUIRED)
60
61 GVRENDER_Y_GOES_DOWN device origin top left, y goes down, otherwise
62 device origin lower left, y goes up
63 GVRENDER_DOES_TRANSFORM device uses scale, translate, rotate to do its own
64 coordinate transformations, otherwise coordinates
65 are pre-transformed
66 GVRENDER_DOES_LABELS basically, maps don't need labels
67 GVRENDER_DOES_MAPS renderer encodes mapping information for mouse events -Tcmapx -Tsvg
68 GVRENDER_DOES_MAP_RECTANGLE supports a 2 coord rectngle optimization
69 GVRENDER_DOES_MAP_CIRCLE supports a 1 coord + radius circle optimization
70 GVRENDER_DOES_MAP_POLYGON supports polygons (basically, -Tsvg uses anchors, so doesn't need to support any map shapes)
71 GVRENDER_DOES_MAP_ELLIPSE supports a 2 coord ellipse optimization
72 GVRENDER_DOES_MAP_BSPLINE supports mapping of splines
73 GVRENDER_DOES_TOOLTIPS can represent tooltip info -Tcmapx, -Tsvg
74 GVRENDER_DOES_TARGETS can represent target info (open link in a new tab or window)
75 GVRENDER_DOES_Z render support 2.5D representation -Tvrml
76 GVRENDER_NO_WHITE_BG don't paint white background, assumes white paper -Tps
77 LAYOUT_NOT_REQUIRED don't perform layout -Tcanon
78 OUTPUT_NOT_REQUIRED don't use gvdevice for output (basically when agwrite() used instead) -Tcanon, -Txdot
79 */
80
81
82#define EMIT_SORTED (1<<0)
83#define EMIT_COLORS (1<<1)
84#define EMIT_CLUSTERS_LAST (1<<2)
85#define EMIT_PREORDER (1<<3)
86#define EMIT_EDGE_SORTED (1<<4)
87#define GVDEVICE_DOES_PAGES (1<<5)
88#define GVDEVICE_DOES_LAYERS (1<<6)
89#define GVDEVICE_EVENTS (1<<7)
90#define GVDEVICE_DOES_TRUECOLOR (1<<8)
91#define GVDEVICE_BINARY_FORMAT (1<<9)
92#define GVDEVICE_COMPRESSED_FORMAT (1<<10)
93#define GVDEVICE_NO_WRITER (1<<11)
94#define GVRENDER_Y_GOES_DOWN (1<<12)
95#define GVRENDER_DOES_TRANSFORM (1<<13)
96#define GVRENDER_DOES_LABELS (1<<15)
97#define GVRENDER_DOES_MAPS (1<<16)
98#define GVRENDER_DOES_MAP_RECTANGLE (1<<17)
99#define GVRENDER_DOES_MAP_CIRCLE (1<<18)
100#define GVRENDER_DOES_MAP_POLYGON (1<<19)
101#define GVRENDER_DOES_MAP_ELLIPSE (1<<20)
102#define GVRENDER_DOES_MAP_BSPLINE (1<<21)
103#define GVRENDER_DOES_TOOLTIPS (1<<22)
104#define GVRENDER_DOES_TARGETS (1<<23)
105#define GVRENDER_DOES_Z (1<<24)
106#define GVRENDER_NO_WHITE_BG (1<<25)
107#define LAYOUT_NOT_REQUIRED (1<<26)
108#define OUTPUT_NOT_REQUIRED (1<<27)
109
110 typedef struct {
111 int flags;
112 double default_pad; /* graph units */
117
118 typedef struct {
119 int flags;
120 pointf default_margin; /* left/right, top/bottom - points */
121 pointf default_pagesize;/* default page width, height - points */
124
125#define LAYOUT_USES_RANKDIR (1<<0)
126
133
140
146
147 typedef struct gvdevice_callbacks_s {
148 void (*refresh) (GVJ_t * job);
149 void (*button_press) (GVJ_t * job, int button, pointf pointer);
150 void (*button_release) (GVJ_t * job, int button, pointf pointer);
151 void (*motion) (GVJ_t * job, pointf pointer);
152 void (*modify) (GVJ_t * job, const char *name, const char *value);
153 void (*del) (GVJ_t * job); /* can't use "delete" 'cos C++ stole it */
154 void (*read) (GVJ_t * job, const char *filename, const char *layout);
155 void (*layout) (GVJ_t * job, const char *layout);
156 void (*render) (GVJ_t * job, const char *format, const char *filename);
158
159 typedef int (*gvevent_key_callback_t) (GVJ_t * job);
160
165
167
169
170 /* If this enum is changed, the implementation of xbuf and xbufs in
171 * gvrender_core_dot.c will probably need to be changed.
172 */
178
179 typedef struct obj_state_s obj_state_t;
180
181 struct obj_state_s {
183
185 union {
190 } u;
191
193
199 double penwidth;
200 char **rawstyle;
201
202 double z, tail_z, head_z; /* z depths for 2.5D renderers such as vrml */
203
204 /* fully substituted text strings */
205 char *label;
206 char *xlabel;
208 char *headlabel;
209
210 char *url; /* if GVRENDER_DOES_MAPS */
211 char *id;
212 char *labelurl;
213 char *tailurl;
214 char *headurl;
215
216 char *tooltip; /* if GVRENDER_DOES_TOOLTIPS */
220
221 char *target; /* if GVRENDER_DOES_TARGETS */
225
236
237 /* primary mapped region - node shape, edge labels */
239 size_t url_map_n; // number of points for url map if GVRENDER_DOES_MAPS
241
242 /* additional mapped regions for edges */
243 size_t url_bsplinemap_poly_n; /* number of polygons in url bspline map
244 if GVRENDER_DOES_MAPS && GVRENDER_DOES_MAP_BSPLINES */
245 size_t *url_bsplinemap_n; /* array of url_bsplinemap_poly_n ints
246 of number of points in each polygon */
247 pointf *url_bsplinemap_p; /* all the polygon points */
248
249 int tailendurl_map_n; /* tail end intersection with node */
251
252 int headendurl_map_n; /* head end intersection with node */
254 };
255
256/* Note on units:
257 * points - a physical distance (1/72 inch) unaffected by zoom or dpi.
258 * graph units - related to physical distance by zoom. Equals points at zoom=1
259 * device units - related to physical distance in points by dpi/72
260 */
261
262 struct GVJ_s {
263 GVC_t *gvc; /* parent gvc */
264 GVJ_t *next; /* linked list of jobs */
265 GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
266
268
269 obj_state_t *obj; /* objects can be nested (at least clusters can)
270 so keep object state on a stack */
273
274 const char *layout_type;
275
276 const char *output_filename;
281
282 const char *output_langname;
284
291
292 void *display;
294
295 void *context; /* gd or cairo surface */
296 bool external_context; /* context belongs to caller */
297 unsigned char *imagedata;
298
299 int flags; /* emit_graph flags */
300
301 int numLayers; /* number of layers */
302 int layerNum; /* current layer - 1 based*/
303
304 point pagesArraySize; /* 2D size of page array */
305 point pagesArrayFirst;/* 2D starting corner in */
306 point pagesArrayMajor;/* 2D major increment */
307 point pagesArrayMinor;/* 2D minor increment */
308 point pagesArrayElem; /* 2D coord of current page - 0,0 based */
309 int numPages; /* number of pages */
310
311 boxf bb; /* graph bb with padding - graph units */
312 pointf pad; /* padding around bb - graph units */
313 boxf clip; /* clip region in graph units */
314 boxf pageBox; /* current page in graph units */
315 pointf pageSize; /* page size in graph units */
316 pointf focus; /* viewport focus - graph units */
317
318 double zoom; /* viewport zoom factor (points per graph unit) */
319 int rotation; /* viewport rotation (degrees) 0=portrait, 90=landscape */
320
321 pointf view; /* viewport size - points */
322 boxf canvasBox; /* viewport area - points */
323 pointf margin; /* job-specific margin - points */
324
325 pointf dpi; /* device resolution device-units-per-inch */
326
327 unsigned int width; /* device width - device units */
328 unsigned int height; /* device height - device units */
329 box pageBoundingBox;/* rotated boundingBox - device units */
330 box boundingBox; /* cumulative boundingBox over all pages - device units */
331
332 pointf scale; /* composite device to graph units (zoom and dpi) */
333 pointf translation; /* composite translation */
334 pointf devscale; /* composite device to points: dpi, y_goes_down */
335
341
342 unsigned char button; /* active button */
343 pointf pointer; /* pointer position in device units */
344 pointf oldpointer; /* old pointer position in device units */
345
346 void *current_obj; /* graph object that pointer is in currently */
347
348 void *selected_obj; /* graph object that has been selected */
349 /* (e.g. button 1 clicked on current obj) */
350 char *active_tooltip; /* tooltip of active object - or NULL */
351 char *selected_href; /* href of selected object - or NULL */
352
353 void *window; /* display-specific data for gvrender plugin */
354
355 /* keybindings for keyboard events */
357 size_t numkeys;
358 void *keycodes;
359 };
360
361#ifdef __cplusplus
362}
363#endif
color_type_t
Definition color.h:26
font_type
Definition gvcjob.h:37
@ FONT_REGULAR
Definition gvcjob.h:37
@ FONT_BOLD
Definition gvcjob.h:37
@ FONT_ITALIC
Definition gvcjob.h:37
pen_type
Definition gvcjob.h:35
@ PEN_NONE
Definition gvcjob.h:35
@ PEN_SOLID
Definition gvcjob.h:35
@ PEN_DOTTED
Definition gvcjob.h:35
@ PEN_DASHED
Definition gvcjob.h:35
struct gvdevice_callbacks_s gvdevice_callbacks_t
label_type
Definition gvcjob.h:38
@ LABEL_HTML
Definition gvcjob.h:38
@ LABEL_PLAIN
Definition gvcjob.h:38
int(* gvevent_key_callback_t)(GVJ_t *job)
Definition gvcjob.h:159
map_shape_t
Definition gvcjob.h:166
@ MAP_CIRCLE
Definition gvcjob.h:166
@ MAP_POLYGON
Definition gvcjob.h:166
@ MAP_RECTANGLE
Definition gvcjob.h:166
struct gvplugin_active_device_s gvplugin_active_device_t
struct gvevent_key_binding_s gvevent_key_binding_t
struct gvplugin_active_render_s gvplugin_active_render_t
fill_type
Definition gvcjob.h:36
@ FILL_RADIAL
Definition gvcjob.h:36
@ FILL_LINEAR
Definition gvcjob.h:36
@ FILL_NONE
Definition gvcjob.h:36
@ FILL_SOLID
Definition gvcjob.h:36
emit_state_t
Definition gvcjob.h:173
@ EMIT_CDRAW
Definition gvcjob.h:174
@ EMIT_NDRAW
Definition gvcjob.h:176
@ EMIT_TDRAW
Definition gvcjob.h:174
@ EMIT_HDRAW
Definition gvcjob.h:174
@ EMIT_HLABEL
Definition gvcjob.h:175
@ EMIT_GDRAW
Definition gvcjob.h:174
@ EMIT_NLABEL
Definition gvcjob.h:176
@ EMIT_GLABEL
Definition gvcjob.h:175
@ EMIT_ELABEL
Definition gvcjob.h:176
@ EMIT_EDRAW
Definition gvcjob.h:176
@ EMIT_CLABEL
Definition gvcjob.h:175
@ EMIT_TLABEL
Definition gvcjob.h:175
struct gvformatter_engine_s gvformatter_engine_t
Definition gvcjob.h:29
obj_type
Definition gvcjob.h:168
@ CLUSTER_OBJTYPE
Definition gvcjob.h:168
@ EDGE_OBJTYPE
Definition gvcjob.h:168
@ ROOTGRAPH_OBJTYPE
Definition gvcjob.h:168
@ NODE_OBJTYPE
Definition gvcjob.h:168
GVIO_API const char * format
Definition gvio.h:51
graph or subgraph
Definition cgraph.h:425
Definition gvcint.h:80
size_t output_data_allocated
Definition gvcjob.h:279
int rotation
Definition gvcjob.h:319
bool click
Definition gvcjob.h:338
GVJ_t * next
Definition gvcjob.h:264
void * current_obj
Definition gvcjob.h:346
size_t output_data_position
Definition gvcjob.h:280
int flags
Definition gvcjob.h:299
int screen
Definition gvcjob.h:293
boxf clip
Definition gvcjob.h:313
bool fit_mode
Definition gvcjob.h:336
const char * output_filename
Definition gvcjob.h:276
pointf margin
Definition gvcjob.h:323
pointf pageSize
Definition gvcjob.h:315
point pagesArraySize
Definition gvcjob.h:304
unsigned char button
Definition gvcjob.h:342
gvplugin_active_loadimage_t loadimage
Definition gvcjob.h:287
pointf dpi
Definition gvcjob.h:325
gvdevice_callbacks_t * callbacks
Definition gvcjob.h:288
int output_lang
Definition gvcjob.h:283
obj_state_t * obj
Definition gvcjob.h:269
boxf bb
Definition gvcjob.h:311
char * active_tooltip
Definition gvcjob.h:350
char * selected_href
Definition gvcjob.h:351
gvplugin_active_device_t device
Definition gvcjob.h:286
bool needs_refresh
Definition gvcjob.h:337
char * output_data
Definition gvcjob.h:278
gvevent_key_binding_t * keybindings
Definition gvcjob.h:356
void * context
Definition gvcjob.h:295
void * keycodes
Definition gvcjob.h:358
bool external_context
Definition gvcjob.h:296
bool has_been_rendered
Definition gvcjob.h:340
point pagesArrayElem
Definition gvcjob.h:308
void * display
Definition gvcjob.h:292
gvplugin_active_render_t render
Definition gvcjob.h:285
point pagesArrayMinor
Definition gvcjob.h:307
pointf pointer
Definition gvcjob.h:343
pointf view
Definition gvcjob.h:321
pointf devscale
Definition gvcjob.h:334
point pagesArrayMajor
Definition gvcjob.h:306
void * selected_obj
Definition gvcjob.h:348
pointf focus
Definition gvcjob.h:316
unsigned char * imagedata
location of imagedata
Definition gvcjob.h:297
GVCOMMON_t * common
Definition gvcjob.h:267
point pagesArrayFirst
Definition gvcjob.h:305
FILE * output_file
Definition gvcjob.h:277
pointf device_dpi
Definition gvcjob.h:289
box pageBoundingBox
Definition gvcjob.h:329
double zoom
Definition gvcjob.h:318
box boundingBox
Definition gvcjob.h:330
pointf scale
Definition gvcjob.h:332
const char * layout_type
Definition gvcjob.h:274
boxf canvasBox
Definition gvcjob.h:322
GVC_t * gvc
Definition gvcjob.h:263
int layerNum
Definition gvcjob.h:302
unsigned int width
Definition gvcjob.h:327
int numLayers
Definition gvcjob.h:301
void * window
Definition gvcjob.h:353
bool has_grown
Definition gvcjob.h:339
int numPages
Definition gvcjob.h:309
boxf pageBox
Definition gvcjob.h:314
bool device_sets_dpi
Definition gvcjob.h:290
char * input_filename
Definition gvcjob.h:271
const char * output_langname
Definition gvcjob.h:282
int graph_index
Definition gvcjob.h:272
pointf pad
Definition gvcjob.h:312
size_t numkeys
Definition gvcjob.h:357
pointf oldpointer
Definition gvcjob.h:344
pointf translation
Definition gvcjob.h:333
GVJ_t * next_active
Definition gvcjob.h:265
unsigned int height
Definition gvcjob.h:328
Definition geom.h:39
Definition geom.h:41
void(* render)(GVJ_t *job, const char *format, const char *filename)
Definition gvcjob.h:156
void(* layout)(GVJ_t *job, const char *layout)
Definition gvcjob.h:155
void(* button_release)(GVJ_t *job, int button, pointf pointer)
Definition gvcjob.h:150
void(* refresh)(GVJ_t *job)
Definition gvcjob.h:148
void(* button_press)(GVJ_t *job, int button, pointf pointer)
Definition gvcjob.h:149
void(* motion)(GVJ_t *job, pointf pointer)
Definition gvcjob.h:151
void(* del)(GVJ_t *job)
Definition gvcjob.h:153
void(* modify)(GVJ_t *job, const char *name, const char *value)
Definition gvcjob.h:152
void(* read)(GVJ_t *job, const char *filename, const char *layout)
Definition gvcjob.h:154
pointf default_margin
Definition gvcjob.h:120
pointf default_pagesize
Definition gvcjob.h:121
gvevent_key_callback_t callback
Definition gvcjob.h:163
gvdevice_features_t * features
Definition gvcjob.h:130
gvdevice_engine_t * engine
Definition gvcjob.h:128
const char * type
Definition gvcjob.h:131
gvloadimage_engine_t * engine
Definition gvcjob.h:142
gvrender_engine_t * engine
Definition gvcjob.h:135
const char * type
Definition gvcjob.h:138
gvrender_features_t * features
Definition gvcjob.h:137
char ** knowncolors
Definition gvcjob.h:113
color_type_t color_type
Definition gvcjob.h:115
int tailendurl_map_n
Definition gvcjob.h:249
char * headlabel
Definition gvcjob.h:208
graph_t * g
Definition gvcjob.h:186
unsigned explicit_tailtarget
Definition gvcjob.h:230
edge_t * e
Definition gvcjob.h:189
pointf * url_map_p
Definition gvcjob.h:240
pointf * tailendurl_map_p
Definition gvcjob.h:250
gvcolor_t fillcolor
Definition gvcjob.h:194
char * tooltip
Definition gvcjob.h:216
unsigned explicit_edgetarget
Definition gvcjob.h:232
double gradient_frac
Definition gvcjob.h:196
char * taillabel
Definition gvcjob.h:207
size_t url_bsplinemap_poly_n
Definition gvcjob.h:243
double z
Definition gvcjob.h:202
union obj_state_s::@89 u
char * url
Definition gvcjob.h:210
pointf * headendurl_map_p
Definition gvcjob.h:253
unsigned explicit_tooltip
Definition gvcjob.h:226
char * labelurl
Definition gvcjob.h:212
char * tailurl
Definition gvcjob.h:213
char * xlabel
Definition gvcjob.h:206
char * labeltooltip
Definition gvcjob.h:217
char * headtarget
Definition gvcjob.h:224
char * target
Definition gvcjob.h:221
obj_type type
Definition gvcjob.h:184
size_t * url_bsplinemap_n
Definition gvcjob.h:245
char * tailtooltip
Definition gvcjob.h:218
gvcolor_t stopcolor
Definition gvcjob.h:194
pen_type pen
Definition gvcjob.h:197
char * headtooltip
Definition gvcjob.h:219
unsigned explicit_labeltooltip
Definition gvcjob.h:229
map_shape_t url_map_shape
Definition gvcjob.h:238
unsigned explicit_tailurl
Definition gvcjob.h:233
pointf * url_bsplinemap_p
Definition gvcjob.h:247
unsigned explicit_tailtooltip
Definition gvcjob.h:227
node_t * n
Definition gvcjob.h:188
unsigned explicit_headurl
Definition gvcjob.h:234
unsigned explicit_headtarget
Definition gvcjob.h:231
graph_t * sg
Definition gvcjob.h:187
char * headurl
Definition gvcjob.h:214
gvcolor_t pencolor
Definition gvcjob.h:194
char ** rawstyle
Definition gvcjob.h:200
char * id
Definition gvcjob.h:211
int gradient_angle
Definition gvcjob.h:195
emit_state_t emit_state
Definition gvcjob.h:192
char * labeltarget
Definition gvcjob.h:222
int headendurl_map_n
Definition gvcjob.h:252
obj_state_t * parent
Definition gvcjob.h:182
double tail_z
Definition gvcjob.h:202
char * tailtarget
Definition gvcjob.h:223
double head_z
Definition gvcjob.h:202
unsigned explicit_headtooltip
Definition gvcjob.h:228
unsigned labeledgealigned
Definition gvcjob.h:235
char * label
Definition gvcjob.h:205
size_t url_map_n
Definition gvcjob.h:239
fill_type fill
Definition gvcjob.h:198
double penwidth
Definition gvcjob.h:199
Definition geom.h:27