Debian Codegraph @

pencil/include/pencil_feature_painter.h

raw
1 /* File: pencil_feature_painter.h; Copyright and License: see below */
2
3 #ifndef PENCIL_FEATURE_PAINTER_H
4 #define PENCIL_FEATURE_PAINTER_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Renders a feature into a cairo drawing context
10 */
11
12 #include "pencil_marker.h"
13 #include "pencil_size.h"
14 #include "layout/layout_feature.h"
15 #include "layout/layout_relationship_iter.h"
16 #include "draw/draw_feature_label.h"
17 #include "draw/draw_feature_symbol.h"
18 #include "geometry/geometry_rectangle.h"
19 #include "geometry/geometry_dimensions.h"
20 #include "set/data_small_set.h"
21 #include "set/data_visible_set.h"
22 #include "entity/data_diagram.h"
23 #include "entity/data_id.h"
24 #include <cairo.h>
25 #include <stdint.h>
26
27 /*!
28 * \brief attributes of the feature painter
29 *
30 * \note This class is stateless.
31 * It may either be instantiated once and used many times or be instantiated per use.
32 */
33 struct pencil_feature_painter_struct {
34 pencil_marker_t marker; /*!< own instance of a marker */
35 draw_feature_label_t draw_feature_label; /*!< collection of draw label functions */
36 draw_feature_symbol_t draw_feature_symbol; /*!< collection of draw symbol functions */
37 };
38
39 typedef struct pencil_feature_painter_struct pencil_feature_painter_t;
40
41 /*!
42 * \brief initializes the painter
43 *
44 * \param this_ pointer to own object attributes
45 */
46 void pencil_feature_painter_init( pencil_feature_painter_t *this_ );
47
48 /*!
49 * \brief destroys the painter
50 *
51 * \param this_ pointer to own object attributes
52 */
53 void pencil_feature_painter_destroy( pencil_feature_painter_t *this_ );
54
55 /*!
56 * \brief draws the feature to the cairo drawing context
57 *
58 * \param this_ pointer to own object attributes
59 * \param layouted_feature pointer to the layout-information and data to be drawn
60 * \param mark_focused true if the object is to be marked as "focused"
61 * \param mark_highlighted true if the object is to be marked as "highlighted"
62 * \param mark_selected true if the object is to be marked as "selected"
63 * \param gray_out true if the object is to be marked as grayed out. Is ignored in case mark_highlighted is true.
64 * \param relationships an iterator over relationships in backwards order, to adapt the feature layout to associations or messages
65 * \param profile pointer to the profile-part that provides the stereotypes of the elements to be drawn
66 * \param pencil_size set of sizes and colors for drawing lines and text
67 * \param layout structure to layout fonts
68 * \param cr a cairo drawing context
69 */
70 void pencil_feature_painter_draw ( pencil_feature_painter_t *this_,
71 const layout_feature_t *layouted_feature,
72 bool mark_focused,
73 bool mark_highlighted,
74 bool mark_selected,
75 bool gray_out,
76 layout_relationship_iter_t *relationships,
77 const data_profile_part_t *profile,
78 const pencil_size_t *pencil_size,
79 PangoLayout *layout,
80 cairo_t *cr
81 );
82
83 /*!
84 * \brief draws the icon of the lifeline feature
85 *
86 * \param this_ pointer to own object attributes
87 * \param layouted_feature pointer to the layout-information and data to be drawn
88 * \param marked true if mark_highlighted
89 * \param relationships an iterator over relationships in backwards order, to adapt the feature layout to associations or messages
90 * \param pencil_size set of sizes and colors for drawing lines and text
91 * \param cr a cairo drawing context
92 */
93 void pencil_feature_painter_private_draw_lifeline_icon ( pencil_feature_painter_t *this_,
94 const layout_feature_t *layouted_feature,
95 bool marked,
96 layout_relationship_iter_t *relationships,
97 const pencil_size_t *pencil_size,
98 cairo_t *cr
99 );
100
101 /*!
102 * \brief draws the icon of the pin/port feature
103 *
104 * \param this_ pointer to own object attributes
105 * \param layouted_feature pointer to the layout-information and data to be drawn
106 * \param pencil_size set of sizes and colors for drawing lines and text
107 * \param foreground_color color to restore after having drawn the white background
108 * \param cr a cairo drawing context
109 */
110 void pencil_feature_painter_private_draw_port_pin_icon ( pencil_feature_painter_t *this_,
111 const layout_feature_t *layouted_feature,
112 const pencil_size_t *pencil_size,
113 GdkRGBA foreground_color,
114 cairo_t *cr
115 );
116
117 /*!
118 * \brief draws the icon of the entry/exit feature
119 *
120 * \param this_ pointer to own object attributes
121 * \param layouted_feature pointer to the layout-information and data to be drawn
122 * \param pencil_size set of sizes and colors for drawing lines and text
123 * \param foreground_color color to restore after having drawn the white background
124 * \param cr a cairo drawing context
125 */
126 void pencil_feature_painter_private_draw_entry_exit_icon ( pencil_feature_painter_t *this_,
127 const layout_feature_t *layouted_feature,
128 const pencil_size_t *pencil_size,
129 GdkRGBA foreground_color,
130 cairo_t *cr
131 );
132
133 /*!
134 * \brief draws the icon of the interface feature
135 *
136 * \param this_ pointer to own object attributes
137 * \param layouted_feature pointer to the layout-information and data to be drawn
138 * \param pencil_size set of sizes and colors for drawing lines and text
139 * \param cr a cairo drawing context
140 */
141 void pencil_feature_painter_private_draw_interface_icon ( pencil_feature_painter_t *this_,
142 const layout_feature_t *layouted_feature,
143 const pencil_size_t *pencil_size,
144 cairo_t *cr
145 );
146
147 /*!
148 * \brief determines the minumum feature bounds
149 *
150 * \param this_ pointer to own object attributes
151 * \param the_feature pointer to the data to be layouted
152 * \param profile pointer to the profile-part that provides the stereotypes of the elements to be drawn
153 * \param pencil_size set of sizes and colors for drawing lines and text
154 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
155 * \param out_feature_bounds memory location where the result shall be stored. Must not be NULL.
156 */
157 void pencil_feature_painter_get_minimum_bounds ( pencil_feature_painter_t *this_,
158 const data_feature_t *the_feature,
159 const data_profile_part_t *profile,
160 const pencil_size_t *pencil_size,
161 PangoLayout *font_layout,
162 geometry_dimensions_t *out_feature_bounds
163 );
164
165 #endif /* PENCIL_FEATURE_PAINTER_H */
166
167
168 /*
169 Copyright 2017-2026 Andreas Warnke
170
171 Licensed under the Apache License, Version 2.0 (the "License");
172 you may not use this file except in compliance with the License.
173 You may obtain a copy of the License at
174
175 http://www.apache.org/licenses/LICENSE-2.0
176
177 Unless required by applicable law or agreed to in writing, software
178 distributed under the License is distributed on an "AS IS" BASIS,
179 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180 See the License for the specific language governing permissions and
181 limitations under the License.
182 */