| 1 |
/* File: draw_classifier_contour.inl; Copyright and License: see below */ |
| 2 |
|
| 3 |
#include "u8/u8_log.h" |
| 4 |
#include <assert.h> |
| 5 |
|
| 6 |
static inline void draw_classifier_contour_init( draw_classifier_contour_t *this_ ) |
| 7 |
{ |
| 8 |
(*this_).dummy = 0; /* prevent warnings on uninitialized usage */ |
| 9 |
} |
| 10 |
|
| 11 |
static inline void draw_classifier_contour_destroy( draw_classifier_contour_t *this_ ) |
| 12 |
{ |
| 13 |
|
| 14 |
} |
| 15 |
|
| 16 |
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 |
no_contour = (( DATA_CLASSIFIER_TYPE_ACTOR == classifier_type ) |
| 20 |
|| ( DATA_CLASSIFIER_TYPE_DYN_INITIAL_NODE == classifier_type ) |
| 21 |
|| ( DATA_CLASSIFIER_TYPE_DYN_FINAL_NODE == classifier_type ) |
| 22 |
|| ( DATA_CLASSIFIER_TYPE_DYN_FORK_NODE == classifier_type ) |
| 23 |
|| ( DATA_CLASSIFIER_TYPE_DYN_JOIN_NODE == classifier_type ) |
| 24 |
|| ( DATA_CLASSIFIER_TYPE_DYN_SHALLOW_HISTORY == classifier_type ) |
| 25 |
|| ( DATA_CLASSIFIER_TYPE_DYN_DEEP_HISTORY == classifier_type ) |
| 26 |
|| ( DATA_CLASSIFIER_TYPE_DYN_ACCEPT_TIME_EVENT == classifier_type ) |
| 27 |
|| ( DATA_CLASSIFIER_TYPE_IMAGE == classifier_type )); |
| 28 |
|
| 29 |
return ( ! no_contour ); |
| 30 |
} |
| 31 |
|
| 32 |
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 |
assert ( NULL != outer_bounds ); |
| 38 |
assert ( NULL != pencil_size ); |
| 39 |
assert ( NULL != cr ); |
| 40 |
const double left = geometry_rectangle_get_left ( outer_bounds ); |
| 41 |
const double top = geometry_rectangle_get_top ( outer_bounds ); |
| 42 |
const double width = geometry_rectangle_get_width ( outer_bounds ); |
| 43 |
const double height = geometry_rectangle_get_height ( outer_bounds ); |
| 44 |
const double gap = pencil_size_get_standard_object_border( pencil_size ); |
| 45 |
cairo_rectangle ( cr, left+gap, top+gap, width-gap-gap, height-gap-gap ); |
| 46 |
cairo_stroke (cr); |
| 47 |
} |
| 48 |
|
| 49 |
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 |
assert ( NULL != outer_bounds ); |
| 56 |
assert ( NULL != pencil_size ); |
| 57 |
assert ( NULL != cr ); |
| 58 |
const double left = geometry_rectangle_get_left ( outer_bounds ); |
| 59 |
const double top = geometry_rectangle_get_top ( outer_bounds ); |
| 60 |
const double bottom = geometry_rectangle_get_bottom ( outer_bounds ); |
| 61 |
const double right = geometry_rectangle_get_right ( outer_bounds ); |
| 62 |
const double gap = pencil_size_get_standard_object_border( pencil_size ); |
| 63 |
cairo_move_to ( cr, left + 3.0 * gap, top + gap ); |
| 64 |
cairo_line_to ( cr, right - 3.0 * gap, top + gap ); |
| 65 |
cairo_move_to ( cr, right - gap, top + 3.0 * gap ); |
| 66 |
cairo_line_to ( cr, right - gap, bottom - 3.0 * gap ); |
| 67 |
cairo_move_to ( cr, right - 3.0 * gap, bottom - gap ); |
| 68 |
cairo_line_to ( cr, left + 3.0 * gap, bottom - gap ); |
| 69 |
cairo_move_to ( cr, left + gap, bottom - 3.0 * gap ); |
| 70 |
cairo_line_to ( cr, left + gap, top + 3.0 * gap ); |
| 71 |
cairo_stroke (cr); |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
/* |
| 76 |
Copyright 2019-2026 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 |
*/ |