Line data Source code
1 : /* File: draw_classifier_contour.inl; Copyright and License: see below */
2 :
3 : #include "u8/u8_log.h"
4 : #include <assert.h>
5 :
6 8 : static inline void draw_classifier_contour_init( draw_classifier_contour_t *this_ )
7 : {
8 8 : (*this_).dummy = 0; /* prevent warnings on uninitialized usage */
9 8 : }
10 :
11 8 : static inline void draw_classifier_contour_destroy( draw_classifier_contour_t *this_ )
12 : {
13 :
14 8 : }
15 :
16 576 : static inline bool draw_classifier_contour_has_contour ( const draw_classifier_contour_t *this_, data_classifier_type_t classifier_type )
17 : {
18 : bool no_contour;
19 576 : no_contour = (( DATA_CLASSIFIER_TYPE_ACTOR == classifier_type )
20 558 : || ( DATA_CLASSIFIER_TYPE_DYN_INITIAL_NODE == classifier_type )
21 540 : || ( DATA_CLASSIFIER_TYPE_DYN_FINAL_NODE == classifier_type )
22 522 : || ( DATA_CLASSIFIER_TYPE_DYN_FORK_NODE == classifier_type )
23 504 : || ( DATA_CLASSIFIER_TYPE_DYN_JOIN_NODE == classifier_type )
24 486 : || ( DATA_CLASSIFIER_TYPE_DYN_SHALLOW_HISTORY == classifier_type )
25 468 : || ( DATA_CLASSIFIER_TYPE_DYN_DEEP_HISTORY == classifier_type )
26 450 : || ( DATA_CLASSIFIER_TYPE_DYN_ACCEPT_TIME_EVENT == classifier_type )
27 1134 : || ( DATA_CLASSIFIER_TYPE_IMAGE == classifier_type ));
28 :
29 576 : return ( ! no_contour );
30 : }
31 :
32 0 : static inline void draw_classifier_contour_draw_rect ( const draw_classifier_contour_t *this_,
33 : const geometry_rectangle_t *outer_bounds,
34 : const pencil_size_t *pencil_size,
35 : cairo_t *cr )
36 : {
37 0 : assert ( NULL != outer_bounds );
38 0 : assert ( NULL != pencil_size );
39 0 : assert ( NULL != cr );
40 0 : const double left = geometry_rectangle_get_left ( outer_bounds );
41 0 : const double top = geometry_rectangle_get_top ( outer_bounds );
42 0 : const double width = geometry_rectangle_get_width ( outer_bounds );
43 0 : const double height = geometry_rectangle_get_height ( outer_bounds );
44 0 : const double gap = pencil_size_get_standard_object_border( pencil_size );
45 0 : cairo_rectangle ( cr, left+gap, top+gap, width-gap-gap, height-gap-gap );
46 0 : cairo_stroke (cr);
47 0 : }
48 :
49 0 : static inline void draw_classifier_contour_draw_cornerless ( const draw_classifier_contour_t *this_,
50 : const geometry_rectangle_t *outer_bounds,
51 : const pencil_size_t *pencil_size,
52 : cairo_t *cr
53 : )
54 : {
55 0 : assert ( NULL != outer_bounds );
56 0 : assert ( NULL != pencil_size );
57 0 : assert ( NULL != cr );
58 0 : const double left = geometry_rectangle_get_left ( outer_bounds );
59 0 : const double top = geometry_rectangle_get_top ( outer_bounds );
60 0 : const double bottom = geometry_rectangle_get_bottom ( outer_bounds );
61 0 : const double right = geometry_rectangle_get_right ( outer_bounds );
62 0 : const double gap = pencil_size_get_standard_object_border( pencil_size );
63 0 : cairo_move_to ( cr, left + 3.0 * gap, top + gap );
64 0 : cairo_line_to ( cr, right - 3.0 * gap, top + gap );
65 0 : cairo_move_to ( cr, right - gap, top + 3.0 * gap );
66 0 : cairo_line_to ( cr, right - gap, bottom - 3.0 * gap );
67 0 : cairo_move_to ( cr, right - 3.0 * gap, bottom - gap );
68 0 : cairo_line_to ( cr, left + 3.0 * gap, bottom - gap );
69 0 : cairo_move_to ( cr, left + gap, bottom - 3.0 * gap );
70 0 : cairo_line_to ( cr, left + gap, top + 3.0 * gap );
71 0 : cairo_stroke (cr);
72 0 : }
73 :
74 :
75 : /*
76 : Copyright 2019-2025 Andreas Warnke
77 :
78 : Licensed under the Apache License, Version 2.0 (the "License");
79 : you may not use this file except in compliance with the License.
80 : You may obtain a copy of the License at
81 :
82 : http://www.apache.org/licenses/LICENSE-2.0
83 :
84 : Unless required by applicable law or agreed to in writing, software
85 : distributed under the License is distributed on an "AS IS" BASIS,
86 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
87 : See the License for the specific language governing permissions and
88 : limitations under the License.
89 : */
|