1 /* gEDA - GPL Electronic Design Automation
2 * libgedacairo - Rendering gEDA schematics with Cairo
3 * Copyright (C) 2010-2019 gEDA Contributors (see ChangeLog for details)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __EDA_RENDERER_H__
21 #define __EDA_RENDERER_H__
25 #define EDA_TYPE_RENDERER (eda_renderer_get_type ())
26 #define EDA_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDA_TYPE_RENDERER, EdaRenderer))
27 #define EDA_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDA_TYPE_RENDERER, EdaRendererClass))
28 #define EDA_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDA_TYPE_RENDERER))
29 #define EDA_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EDA_TYPE_RENDERER))
30 #define EDA_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDA_TYPE_RENDERER, EdaRendererClass))
32 typedef struct _EdaRendererClass EdaRendererClass
;
33 typedef struct _EdaRenderer EdaRenderer
;
34 typedef struct _EdaRendererPrivate EdaRendererPrivate
;
36 struct _EdaRendererClass
38 GObjectClass parent_class
;
40 /* Virtual public methods */
41 void (*draw
)(EdaRenderer
*renderer
, OBJECT
*object
);
42 void (*draw_grips
)(EdaRenderer
*renderer
, OBJECT
*object
);
43 void (*draw_cues
)(EdaRenderer
*renderer
, OBJECT
*object
);
44 int (*user_bounds
)(EdaRenderer
*renderer
, OBJECT
*object
,
45 double *left
, double *top
,
46 double *right
, double *bottom
);
51 GObject parent_instance
;
54 EdaRendererPrivate
*priv
;
57 #define EDA_TYPE_RENDERER_FLAGS (eda_renderer_flags_get_type ())
59 typedef enum _EdaRendererFlags EdaRendererFlags
;
61 enum _EdaRendererFlags
63 /* Should hinting be enabled? */
64 EDA_RENDERER_FLAG_HINTING
= 1 << 0,
65 /* Should picture outlines be drawn instead of raster? */
66 EDA_RENDERER_FLAG_PICTURE_OUTLINE
= 1 << 1,
67 /* Should hidden text be drawn? */
68 EDA_RENDERER_FLAG_TEXT_HIDDEN
= 1 << 2,
69 /* Should text outlines be drawn instead of glyphs? */
70 EDA_RENDERER_FLAG_TEXT_OUTLINE
= 1 << 3,
71 /* Should text origin markers be drawn? */
72 EDA_RENDERER_FLAG_TEXT_ORIGIN
= 1 << 4,
75 GType
eda_renderer_get_type (void) G_GNUC_CONST
;
76 GType
eda_renderer_flags_get_type (void) G_GNUC_CONST
;
78 EdaRenderer
*eda_renderer_new (cairo_t
*cr
, PangoContext
*pc
) G_GNUC_WARN_UNUSED_RESULT
;
79 void eda_renderer_destroy (EdaRenderer
*renderer
);
81 void eda_renderer_draw (EdaRenderer
*renderer
, OBJECT
*object
);
82 void eda_renderer_draw_grips (EdaRenderer
*renderer
, OBJECT
*object
);
83 void eda_renderer_draw_cues (EdaRenderer
*renderer
, OBJECT
*object
);
85 GArray
*eda_renderer_get_color_map (EdaRenderer
*renderer
);
86 void eda_renderer_set_color_map (EdaRenderer
*renderer
, GArray
*map
);
88 cairo_t
*eda_renderer_get_cairo_context (EdaRenderer
*renderer
);
89 int eda_renderer_get_cairo_flags (EdaRenderer
*renderer
);
91 int eda_renderer_get_user_bounds (EdaRenderer
*renderer
, OBJECT
*object
,
92 double *left
, double *top
,
93 double *right
, double *bottom
);
97 #endif /* !__EDA_RENDERER_H__ */