Debian Codegraph @

pencil/include/draw/draw_feature_label.h

raw
1 /* File: draw_feature_label.h; Copyright and License: see below */
2
3 #ifndef DRAW_FEATURE_LABEL_H
4 #define DRAW_FEATURE_LABEL_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Draws keys and values of features
10 */
11
12 #include "draw/draw_line_breaker.h"
13 #include "draw/draw_stereotype_icon.h"
14 #include "pencil_size.h"
15 #include "geometry/geometry_h_align.h"
16 #include "geometry/geometry_v_align.h"
17 #include "geometry/geometry_rectangle.h"
18 #include "geometry/geometry_dimensions.h"
19 #include "entity/data_feature.h"
20 #include "set/data_profile_part.h"
21 #include "utf8stream/utf8stream_writemem.h"
22 #include <cairo.h>
23 #include <stdint.h>
24
25 /*!
26 * \brief attributes of the draw label functions
27 *
28 * \note This class is stateless.
29 * It may either be instantiated once and used many times or be instantiated per use.
30 */
31 struct draw_feature_label_struct {
32 char text_buffer[ ( DATA_FEATURE_MAX_KEY_SIZE + DATA_FEATURE_MAX_VALUE_SIZE + 2 ) * 4 ]; /*!< +2 for colon and space, x4 because any character may be followed by a 3-byte space */
33 utf8stream_writemem_t text_builder; /*!< a pair of utf8stream_writer_t and universal_memory_output_stream_t to build an output text */
34 draw_line_breaker_t linebr; /*!< An object to insert zero-width spaces (a 3 byte utf8 sequence) wherever a linebreak is allowed */
35 draw_stereotype_icon_t image_renderer; /*!< own instance of stereotype image renderer */
36 };
37
38 typedef struct draw_feature_label_struct draw_feature_label_t;
39
40 /*!
41 * \brief initializes the draw_feature_label_t
42 *
43 * \param this_ pointer to own object attributes
44 */
45 void draw_feature_label_init( draw_feature_label_t *this_ );
46
47 /*!
48 * \brief destroys the draw_feature_label_t
49 *
50 * \param this_ pointer to own object attributes
51 */
52 void draw_feature_label_destroy( draw_feature_label_t *this_ );
53
54 /*!
55 * \brief determines the dimensions of the key and value of the feature.
56 *
57 * \param this_ pointer to own object attributes
58 * \param feature the feature data to draw
59 * \param profile profile-part that provides the stereotype definition of the element to be drawn
60 * \param proposed_bounds proposed bounds for the text width and height
61 * \param pencil_size set of sizes and colors for drawing lines and text
62 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
63 * \param out_label_dim width and height of the type and name is returned. NULL is not permitted.
64 */
65 void draw_feature_label_get_key_and_value_dimensions ( draw_feature_label_t *this_,
66 const data_feature_t *feature,
67 const data_profile_part_t *profile,
68 const geometry_dimensions_t *proposed_bounds,
69 const pencil_size_t *pencil_size,
70 PangoLayout *font_layout,
71 geometry_dimensions_t *out_label_dim
72 );
73
74 /*!
75 * \brief renders key and value of the feature
76 *
77 * \param this_ pointer to own object attributes
78 * \param feature the feature data to draw
79 * \param profile profile-part that provides the stereotype definition of the element to be drawn
80 * \param color color to draw text and to use as default for stereotype-image strokes
81 * \param label_box the rectangle where to draw to
82 * \param pencil_size set of sizes and colors for drawing lines and text
83 * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context
84 * \param cr the cairo drawing context.
85 */
86 void draw_feature_label_draw_key_and_value ( draw_feature_label_t *this_,
87 const data_feature_t *feature,
88 const data_profile_part_t *profile,
89 const GdkRGBA *color,
90 const geometry_rectangle_t *label_box,
91 const pencil_size_t *pencil_size,
92 PangoLayout *font_layout,
93 cairo_t *cr
94 );
95
96 #endif /* DRAW_FEATURE_LABEL_H */
97
98
99 /*
100 Copyright 2019-2026 Andreas Warnke
101
102 Licensed under the Apache License, Version 2.0 (the "License");
103 you may not use this file except in compliance with the License.
104 You may obtain a copy of the License at
105
106 http://www.apache.org/licenses/LICENSE-2.0
107
108 Unless required by applicable law or agreed to in writing, software
109 distributed under the License is distributed on an "AS IS" BASIS,
110 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111 See the License for the specific language governing permissions and
112 limitations under the License.
113 */