/* File: draw_diagram_label.h; Copyright and License: see below */ #ifndef DRAW_DIAGRAM_LABEL_H #define DRAW_DIAGRAM_LABEL_H /* public file for the doxygen documentation: */ /*! * \file * \brief Draws types or stereotypes and titles of diagrams */ #include "draw/draw_stereotype_icon.h" #include "pencil_size.h" #include "geometry/geometry_h_align.h" #include "geometry/geometry_v_align.h" #include "geometry/geometry_rectangle.h" #include "geometry/geometry_dimensions.h" #include "entity/data_diagram.h" #include "set/data_profile_part.h" #include "utf8stream/utf8stream_writemem.h" #include #include /*! * \brief attributes of the draw label functions * * \note This class is stateless. * It may either be instantiated once and used many times or be instantiated per use. */ struct draw_diagram_label_struct { char text_buffer[ DATA_DIAGRAM_MAX_STEREOTYPE_SIZE + 4 ]; /*!< +4 for a left and a right guillemets */ utf8stream_writemem_t text_builder; /*!< a pair of utf8stream_writer_t and universal_memory_output_stream_t to build an output text */ draw_stereotype_icon_t image_renderer; /*!< own instance of stereotype image renderer */ }; typedef struct draw_diagram_label_struct draw_diagram_label_t; /*! * \brief initializes the draw_diagram_label_t * * \param this_ pointer to own object attributes */ void draw_diagram_label_init( draw_diagram_label_t *this_ ); /*! * \brief destroys the draw_diagram_label_t * * \param this_ pointer to own object attributes */ void draw_diagram_label_destroy( draw_diagram_label_t *this_ ); /*! * \brief determines the dimensions of the stereotype and name of the diagram. * * \param this_ pointer to own object attributes * \param diagram the diagram to draw * \param profile profile-part that provides the stereotype definition of the element to be drawn * \param proposed_bounds proposed bounds for the text width and height * \param pencil_size set of sizes and colors for drawing lines and text * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context * \param out_label_dim width and height of the type and name is returned. NULL is not permitted. */ void draw_diagram_label_get_type_and_name_dimensions( draw_diagram_label_t *this_, const data_diagram_t *diagram, const data_profile_part_t *profile, const geometry_dimensions_t *proposed_bounds, const pencil_size_t *pencil_size, PangoLayout *font_layout, geometry_dimensions_t *out_label_dim ); /*! * \brief renders stereotype and name of the diagram. * * \param this_ pointer to own object attributes * \param diagram the diagram to draw * \param profile profile-part that provides the stereotype definition of the element to be drawn * \param color color to draw text and to use as default for stereotype-image strokes * \param label_box the rectangle where to draw to * \param pencil_size set of sizes and colors for drawing lines and text * \param font_layout pango layout object to determine the font metrics in the current cairo drawing context * \param cr the cairo drawing context. */ void draw_diagram_label_draw_type_and_name( draw_diagram_label_t *this_, const data_diagram_t *diagram, const data_profile_part_t *profile, const GdkRGBA *color, const geometry_rectangle_t *label_box, const pencil_size_t *pencil_size, PangoLayout *font_layout, cairo_t *cr ); #endif /* DRAW_DIAGRAM_LABEL_H */ /* Copyright 2019-2026 Andreas Warnke Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */