| 1 |
/* File: pencil_diagram_painter.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef PENCIL_DIAGRAM_PAINTER_H |
| 4 |
#define PENCIL_DIAGRAM_PAINTER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Renders a diagram into a cairo drawing context |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "pencil_marker.h" |
| 13 |
#include "pencil_size.h" |
| 14 |
#include "layout/layout_diagram.h" |
| 15 |
#include "geometry/geometry_rectangle.h" |
| 16 |
#include "draw/draw_diagram_label.h" |
| 17 |
#include "draw/draw_diagram_ornaments.h" |
| 18 |
#include "set/data_profile_part.h" |
| 19 |
#include "set/data_small_set.h" |
| 20 |
#include "set/data_visible_set.h" |
| 21 |
#include "entity/data_diagram.h" |
| 22 |
#include "entity/data_id.h" |
| 23 |
#include <cairo.h> |
| 24 |
#include <stdint.h> |
| 25 |
|
| 26 |
/*! |
| 27 |
* \brief attributes of the diagram painter |
| 28 |
* |
| 29 |
* \note This class is stateless. |
| 30 |
* It may either be instantiated once and used many times or be instantiated per use. |
| 31 |
*/ |
| 32 |
struct pencil_diagram_painter_struct { |
| 33 |
pencil_marker_t marker; /*!< own instance of a marker */ |
| 34 |
draw_diagram_label_t draw_diagram_label; /*!< collection of draw label functions */ |
| 35 |
draw_diagram_ornaments_t draw_diagram_ornaments; /*!< collection of draw ornaments functions like e.g. x-axis scale */ |
| 36 |
}; |
| 37 |
|
| 38 |
typedef struct pencil_diagram_painter_struct pencil_diagram_painter_t; |
| 39 |
|
| 40 |
/*! |
| 41 |
* \brief initializes the painter |
| 42 |
* |
| 43 |
* \param this_ pointer to own object attributes |
| 44 |
*/ |
| 45 |
void pencil_diagram_painter_init( pencil_diagram_painter_t *this_ ); |
| 46 |
|
| 47 |
/*! |
| 48 |
* \brief destroys the painter |
| 49 |
* |
| 50 |
* \param this_ pointer to own object attributes |
| 51 |
*/ |
| 52 |
void pencil_diagram_painter_destroy( pencil_diagram_painter_t *this_ ); |
| 53 |
|
| 54 |
/*! |
| 55 |
* \brief draws the chosen classifier contents into the diagram_bounds area of the cairo drawing context |
| 56 |
* |
| 57 |
* \param this_ pointer to own object attributes |
| 58 |
* \param layouted_diagram pointer to the the layout-information and data to be drawn |
| 59 |
* \param mark_focused true if the object is to be marked as "focused" |
| 60 |
* \param mark_highlighted true if the object is to be marked as "highlighted" |
| 61 |
* \param mark_selected true if the object is to be marked as "selected" |
| 62 |
* \param profile pointer to the profile-part that provides the stereotypes of the elements to be drawn |
| 63 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 64 |
* \param font_layout structure to layout fonts |
| 65 |
* \param cr a cairo drawing context |
| 66 |
*/ |
| 67 |
void pencil_diagram_painter_draw ( pencil_diagram_painter_t *this_, |
| 68 |
const layout_diagram_t *layouted_diagram, |
| 69 |
bool mark_focused, |
| 70 |
bool mark_highlighted, |
| 71 |
bool mark_selected, |
| 72 |
const data_profile_part_t *profile, |
| 73 |
const pencil_size_t *pencil_size, |
| 74 |
PangoLayout *font_layout, |
| 75 |
cairo_t *cr |
| 76 |
); |
| 77 |
|
| 78 |
/*! |
| 79 |
* \brief determines the label box and inner drawing space for contained classifiers |
| 80 |
* |
| 81 |
* \param this_ pointer to own object attributes |
| 82 |
* \param the_diagram pointer to the data to be drawn |
| 83 |
* \param diagram_bounds the destination rectangle where to draw the diagram |
| 84 |
* \param profile pointer to the profile-part that provides the stereotypes of the elements to be drawn |
| 85 |
* \param pencil_size set of sizes and colors for drawing lines and text |
| 86 |
* \param font_layout structure to layout fonts |
| 87 |
* \param io_layout_diagram bounds, draw_area and label_box are updated. The pointer must not be NULL. |
| 88 |
*/ |
| 89 |
void pencil_diagram_painter_do_layout ( pencil_diagram_painter_t *this_, |
| 90 |
const data_diagram_t *the_diagram, |
| 91 |
const geometry_rectangle_t *diagram_bounds, |
| 92 |
const data_profile_part_t *profile, |
| 93 |
const pencil_size_t *pencil_size, |
| 94 |
PangoLayout *font_layout, |
| 95 |
layout_diagram_t *io_layout_diagram |
| 96 |
); |
| 97 |
|
| 98 |
#endif /* PENCIL_DIAGRAM_PAINTER_H */ |
| 99 |
|
| 100 |
|
| 101 |
/* |
| 102 |
Copyright 2017-2026 Andreas Warnke |
| 103 |
|
| 104 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 105 |
you may not use this file except in compliance with the License. |
| 106 |
You may obtain a copy of the License at |
| 107 |
|
| 108 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 109 |
|
| 110 |
Unless required by applicable law or agreed to in writing, software |
| 111 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 112 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 113 |
See the License for the specific language governing permissions and |
| 114 |
limitations under the License. |
| 115 |
*/ |