LCOV - code coverage report
Current view: top level - pencil/source - pencil_feature_painter.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.57.0_covts Lines: 0 265 0.0 %
Date: 2024-04-07 11:14:42 Functions: 0 8 0.0 %

          Line data    Source code
       1             : /* File: pencil_feature_painter.c; Copyright and License: see below */
       2             : 
       3             : #include "pencil_feature_painter.h"
       4             : #include "pencil_layout_data.h"
       5             : #include "u8/u8_trace.h"
       6             : #include <pango/pangocairo.h>
       7             : #include <stdio.h>
       8             : #include <stdlib.h>
       9             : #include <assert.h>
      10             : 
      11             : /*! where to place the control points of a bezier curve to get a good approximation for a 90 degree curve */
      12             : const static double BEZIER_CTRL_POINT_FOR_90_DEGREE_CIRCLE = 0.552284749831;
      13             : const static double SINE_OF_45_DEGREE = 0.707106781187;
      14             : 
      15           0 : void pencil_feature_painter_init( pencil_feature_painter_t *this_ )
      16             : {
      17           0 :     U8_TRACE_BEGIN();
      18             : 
      19           0 :     pencil_marker_init( &((*this_).marker) );
      20           0 :     draw_feature_label_init( &((*this_).draw_feature_label) );
      21             : 
      22           0 :     U8_TRACE_END();
      23           0 : }
      24             : 
      25           0 : void pencil_feature_painter_destroy( pencil_feature_painter_t *this_ )
      26             : {
      27           0 :     U8_TRACE_BEGIN();
      28             : 
      29           0 :     draw_feature_label_destroy( &((*this_).draw_feature_label) );
      30           0 :     pencil_marker_destroy( &((*this_).marker) );
      31             : 
      32           0 :     U8_TRACE_END();
      33           0 : }
      34             : 
      35           0 : void pencil_feature_painter_draw( pencil_feature_painter_t *this_,
      36             :                                   const layout_feature_t *layouted_feature,
      37             :                                   bool mark_focused,
      38             :                                   bool mark_highlighted,
      39             :                                   bool mark_selected,
      40             :                                   bool gray_out,
      41             :                                   const data_profile_part_t *profile,
      42             :                                   const pencil_size_t *pencil_size,
      43             :                                   PangoLayout *layout,
      44             :                                   cairo_t *cr )
      45             : {
      46           0 :     U8_TRACE_BEGIN();
      47           0 :     assert( NULL != profile );
      48           0 :     assert( NULL != pencil_size );
      49           0 :     assert( NULL != layouted_feature );
      50           0 :     assert( NULL != layout );
      51           0 :     assert( NULL != cr );
      52             : 
      53           0 :     const data_feature_t *the_feature = layout_feature_get_data_const( layouted_feature );
      54           0 :     const geometry_rectangle_t *const feature_symbol_box = layout_feature_get_symbol_box_const( layouted_feature );
      55             : 
      56           0 :     if ( data_feature_is_valid( the_feature ) )
      57             :     {
      58           0 :         U8_TRACE_INFO_INT("drawing feature id", data_feature_get_row_id( the_feature ) );
      59             : 
      60             :         /* select color */
      61             :         GdkRGBA foreground_color;
      62             :         {
      63           0 :             if ( mark_highlighted )
      64             :             {
      65           0 :                 foreground_color = pencil_size_get_highlight_color( pencil_size );
      66             :             }
      67           0 :             else if ( gray_out )
      68             :             {
      69           0 :                 foreground_color = pencil_size_get_gray_out_color( pencil_size );
      70             :             }
      71             :             else
      72             :             {
      73           0 :                 foreground_color = pencil_size_get_standard_color( pencil_size );
      74             :             }
      75           0 :             cairo_set_source_rgba( cr, foreground_color.red, foreground_color.green, foreground_color.blue, foreground_color.alpha );
      76             :         }
      77             : 
      78           0 :         switch ( data_feature_get_main_type (the_feature) )
      79             :         {
      80           0 :             case DATA_FEATURE_TYPE_PORT:  /* or */
      81             :             case DATA_FEATURE_TYPE_IN_PORT_PIN:  /* or */
      82             :             case DATA_FEATURE_TYPE_OUT_PORT_PIN:
      83             :             {
      84           0 :                 pencil_feature_painter_private_draw_port_pin_icon( this_, layouted_feature, pencil_size, foreground_color, cr );
      85             :             }
      86           0 :             break;
      87             : 
      88           0 :             case DATA_FEATURE_TYPE_ENTRY:  /* or */
      89             :             case DATA_FEATURE_TYPE_EXIT:
      90             :             {
      91           0 :                 pencil_feature_painter_private_draw_entry_exit_icon( this_, layouted_feature, pencil_size, foreground_color, cr );
      92             :             }
      93           0 :             break;
      94             : 
      95           0 :             case DATA_FEATURE_TYPE_PROVIDED_INTERFACE:  /* or */
      96             :             case DATA_FEATURE_TYPE_REQUIRED_INTERFACE:
      97             :             {
      98           0 :                 pencil_feature_painter_private_draw_interface_icon( this_, layouted_feature, pencil_size, cr );
      99             :             }
     100           0 :             break;
     101             : 
     102           0 :             case DATA_FEATURE_TYPE_LIFELINE:
     103             :             {
     104           0 :                 pencil_feature_painter_private_draw_lifeline_icon( this_, layouted_feature, mark_highlighted, pencil_size, cr );
     105             :             }
     106           0 :             break;
     107             : 
     108           0 :             case DATA_FEATURE_TYPE_PROPERTY: /* or */
     109             :             case DATA_FEATURE_TYPE_OPERATION: /* or */
     110             :             case DATA_FEATURE_TYPE_TAGGED_VALUE:
     111             :             {
     112             :                 /* no icon */
     113             :             }
     114           0 :             break;
     115             : 
     116           0 :             default:
     117             :             {
     118           0 :                 U8_LOG_ANOMALY("unknown feature type in pencil_feature_painter_draw");
     119             :                 /* this may happen if a new database file has been read by an old program version */
     120             :                 /* no icon */
     121             :             }
     122           0 :             break;
     123             :         }
     124             : 
     125             :         /* draw the label */
     126           0 :         draw_feature_label_draw_key_and_value( &((*this_).draw_feature_label),
     127             :                                                layout_feature_get_data_const( layouted_feature ),
     128             :                                                profile,
     129             :                                                &foreground_color,
     130             :                                                layout_feature_get_label_box_const( layouted_feature ),
     131             :                                                pencil_size,
     132             :                                                layout,
     133             :                                                cr
     134             :                                              );
     135             : 
     136             : #ifdef PENCIL_LAYOUT_DATA_DRAW_FOR_DEBUG
     137             :         /* draw the rectangles */
     138             :         {
     139             :             const geometry_rectangle_t *const feature_label_box
     140           0 :                 = layout_feature_get_label_box_const ( layouted_feature );
     141             : 
     142           0 :             cairo_set_source_rgba( cr, 0.5, 0.7, 1.0, 0.5 );
     143           0 :             cairo_rectangle( cr,
     144             :                              geometry_rectangle_get_left ( feature_symbol_box ),
     145             :                              geometry_rectangle_get_top ( feature_symbol_box ),
     146             :                              geometry_rectangle_get_width ( feature_symbol_box ),
     147             :                              geometry_rectangle_get_height ( feature_symbol_box )
     148             :                            );
     149           0 :             cairo_rectangle( cr,
     150             :                              geometry_rectangle_get_left ( feature_label_box ),
     151             :                              geometry_rectangle_get_top ( feature_label_box ),
     152             :                              geometry_rectangle_get_width ( feature_label_box ),
     153             :                              geometry_rectangle_get_height ( feature_label_box )
     154             :                            );
     155           0 :             cairo_stroke( cr );
     156             :         }
     157             : #endif
     158             : 
     159           0 :         if ( mark_selected )
     160             :         {
     161           0 :             pencil_marker_mark_selected_rectangle( &((*this_).marker), *feature_symbol_box, cr );
     162             :         }
     163             : 
     164           0 :         if ( mark_focused )
     165             :         {
     166           0 :             pencil_marker_mark_focused_rectangle( &((*this_).marker), *feature_symbol_box, cr );
     167             :         }
     168             :     }
     169             :     else
     170             :     {
     171           0 :         U8_LOG_ERROR("invalid visible feature in array!");
     172             :     }
     173             : 
     174           0 :     U8_TRACE_END();
     175           0 : }
     176             : 
     177           0 : void pencil_feature_painter_private_draw_lifeline_icon ( pencil_feature_painter_t *this_,
     178             :                                                          const layout_feature_t *layouted_feature,
     179             :                                                          bool marked,
     180             :                                                          const pencil_size_t *pencil_size,
     181             :                                                          cairo_t *cr )
     182             : {
     183           0 :     U8_TRACE_BEGIN();
     184           0 :     assert( NULL != pencil_size );
     185           0 :     assert( NULL != layouted_feature );
     186           0 :     assert( NULL != cr );
     187             : 
     188           0 :     const geometry_rectangle_t *const feature_symbol_box = layout_feature_get_symbol_box_const( layouted_feature );
     189             : 
     190           0 :     const double left = geometry_rectangle_get_left ( feature_symbol_box );
     191           0 :     const double top = geometry_rectangle_get_top ( feature_symbol_box );
     192           0 :     const double width = geometry_rectangle_get_width ( feature_symbol_box );
     193           0 :     const double height = geometry_rectangle_get_height ( feature_symbol_box );
     194             : 
     195             :     double dashes[2];
     196           0 :     dashes[0] = 2.0 * pencil_size_get_line_dash_length( pencil_size );
     197           0 :     dashes[1] = 1.0 * pencil_size_get_line_dash_length( pencil_size );
     198           0 :     cairo_set_dash ( cr, dashes, 2, 0.0 );
     199             : 
     200           0 :     if ( GEOMETRY_DIRECTION_RIGHT == layout_feature_get_icon_direction( layouted_feature ) )
     201             :     {
     202             :         /* lineline in timing diagrams */
     203           0 :         const double center_y = geometry_rectangle_get_center_y ( feature_symbol_box );
     204             : 
     205           0 :         cairo_move_to ( cr, left, center_y );
     206           0 :         cairo_line_to ( cr, left + width, center_y );
     207           0 :         cairo_stroke (cr);
     208             :     }
     209           0 :     else if ( GEOMETRY_DIRECTION_DOWN == layout_feature_get_icon_direction( layouted_feature ) )
     210             :     {
     211             :         /* lifeline in sequence diagrams */
     212           0 :         const double center_x = geometry_rectangle_get_center_x ( feature_symbol_box );
     213             : 
     214           0 :         cairo_move_to ( cr, center_x, top );
     215           0 :         cairo_line_to ( cr, center_x, top + height );
     216           0 :         cairo_stroke (cr);
     217             :     }
     218             :     else
     219             :     {
     220             :         /* lifeline in communication diagrams, only drawn if highlighted: */
     221           0 :         if ( marked )
     222             :         {
     223           0 :             cairo_move_to ( cr, left, top );
     224           0 :             cairo_line_to ( cr, left, top + height );
     225           0 :             cairo_line_to ( cr, left + width, top + height );
     226           0 :             cairo_line_to ( cr, left + width, top );
     227           0 :             cairo_line_to ( cr, left, top );
     228           0 :             cairo_stroke (cr);
     229             :         }
     230             :     }
     231             : 
     232           0 :     cairo_set_dash ( cr, NULL, 0, 0.0 );
     233             : 
     234           0 :     U8_TRACE_END();
     235           0 : }
     236             : 
     237           0 : void pencil_feature_painter_private_draw_port_pin_icon ( pencil_feature_painter_t *this_,
     238             :                                                          const layout_feature_t *layouted_feature,
     239             :                                                          const pencil_size_t *pencil_size,
     240             :                                                          GdkRGBA foreground_color,
     241             :                                                          cairo_t *cr )
     242             : {
     243           0 :     U8_TRACE_BEGIN();
     244           0 :     assert( NULL != pencil_size );
     245           0 :     assert( NULL != layouted_feature );
     246           0 :     assert( NULL != cr );
     247             : 
     248           0 :     const geometry_rectangle_t *const symbol_box_bounds = layout_feature_get_symbol_box_const( layouted_feature );
     249             : 
     250           0 :     const double left = geometry_rectangle_get_left ( symbol_box_bounds );
     251           0 :     const double top = geometry_rectangle_get_top ( symbol_box_bounds );
     252           0 :     const double width = geometry_rectangle_get_width ( symbol_box_bounds );
     253           0 :     const double height = geometry_rectangle_get_height ( symbol_box_bounds );
     254             : 
     255           0 :     cairo_rectangle ( cr, left, top, width, height );
     256             : 
     257             :     /* Note: It is possible to read out the current color and set it again */
     258             :     /* but the interface for that looks like this might result in 1 additional memory allocation */
     259             :     /* which shall be avoided */
     260             :     /* cairo_pattern_t *const defined_color = cairo_get_source( cr ); */
     261             :     /* cairo_pattern_reference( defined_color );                      */
     262             :     /* ...                                                            */
     263             :     /* cairo_set_source( cr, defined_color );                         */
     264             :     /* cairo_pattern_destroy( defined_color );                        */
     265             : 
     266           0 :     cairo_set_source_rgba( cr, 1.0, 1.0, 1.0, 1.0 );  /* white background */
     267           0 :     cairo_fill_preserve (cr);
     268           0 :     cairo_set_source_rgba( cr, foreground_color.red, foreground_color.green, foreground_color.blue, foreground_color.alpha );
     269           0 :     cairo_stroke (cr);
     270             : 
     271             :     /* draw the arrow */
     272           0 :     const double center_x = geometry_rectangle_get_center_x ( symbol_box_bounds );
     273           0 :     const double center_y = geometry_rectangle_get_center_y ( symbol_box_bounds );
     274           0 :     const double h_arrow_left = left + 0.25*width;
     275           0 :     const double h_arrow_right = left + 0.75*width;
     276           0 :     const double h_arrow_top = top + 0.25*height;
     277           0 :     const double h_arrow_bottom = top + 0.75*height;
     278           0 :     const double v_arrow_left = left + 0.25*width;
     279           0 :     const double v_arrow_right = left + 0.75*width;
     280           0 :     const double v_arrow_top = top + 0.25*height;
     281           0 :     const double v_arrow_bottom = top + 0.75*height;
     282           0 :     switch ( layout_feature_get_icon_direction( layouted_feature ) )
     283             :     {
     284           0 :         case GEOMETRY_DIRECTION_LEFT:
     285             :         {
     286           0 :             cairo_move_to ( cr, h_arrow_left, center_y );
     287           0 :             cairo_line_to ( cr, h_arrow_right, center_y );
     288           0 :             cairo_move_to ( cr, h_arrow_right, h_arrow_top );
     289           0 :             cairo_line_to ( cr, h_arrow_left, center_y );
     290           0 :             cairo_line_to ( cr, h_arrow_right, h_arrow_bottom );
     291             : 
     292           0 :             cairo_stroke (cr);
     293             :         }
     294           0 :         break;
     295             : 
     296           0 :         case GEOMETRY_DIRECTION_UP:
     297             :         {
     298           0 :             cairo_move_to ( cr, center_x, v_arrow_top );
     299           0 :             cairo_line_to ( cr, center_x, v_arrow_bottom );
     300           0 :             cairo_move_to ( cr, v_arrow_left, v_arrow_bottom );
     301           0 :             cairo_line_to ( cr, center_x, v_arrow_top );
     302           0 :             cairo_line_to ( cr, v_arrow_right, v_arrow_bottom );
     303             : 
     304           0 :             cairo_stroke (cr);
     305             :         }
     306           0 :         break;
     307             : 
     308           0 :         case GEOMETRY_DIRECTION_RIGHT:
     309             :         {
     310           0 :             cairo_move_to ( cr, h_arrow_right, center_y );
     311           0 :             cairo_line_to ( cr, h_arrow_left, center_y );
     312           0 :             cairo_move_to ( cr, h_arrow_left, h_arrow_top );
     313           0 :             cairo_line_to ( cr, h_arrow_right, center_y );
     314           0 :             cairo_line_to ( cr, h_arrow_left, h_arrow_bottom );
     315             : 
     316           0 :             cairo_stroke (cr);
     317             :         }
     318           0 :         break;
     319             : 
     320           0 :         case GEOMETRY_DIRECTION_DOWN:
     321             :         {
     322           0 :             cairo_move_to ( cr, center_x, v_arrow_bottom );
     323           0 :             cairo_line_to ( cr, center_x, v_arrow_top );
     324           0 :             cairo_move_to ( cr, v_arrow_left, v_arrow_top );
     325           0 :             cairo_line_to ( cr, center_x, v_arrow_bottom );
     326           0 :             cairo_line_to ( cr, v_arrow_right, v_arrow_top );
     327             : 
     328           0 :             cairo_stroke (cr);
     329             :         }
     330           0 :         break;
     331             : 
     332           0 :         case GEOMETRY_DIRECTION_CENTER:
     333             :         {
     334             :             /* no arrow */
     335             :         }
     336           0 :         break;
     337             : 
     338           0 :         default:
     339             :         {
     340           0 :             U8_LOG_ERROR( "unexpected value in geometry_direction_t." );
     341             :         }
     342           0 :         break;
     343             :     }
     344             : 
     345           0 :     U8_TRACE_END();
     346           0 : }
     347             : 
     348           0 : void pencil_feature_painter_private_draw_entry_exit_icon ( pencil_feature_painter_t *this_,
     349             :                                                            const layout_feature_t *layouted_feature,
     350             :                                                            const pencil_size_t *pencil_size,
     351             :                                                            GdkRGBA foreground_color,
     352             :                                                            cairo_t *cr )
     353             : {
     354           0 :     U8_TRACE_BEGIN();
     355           0 :     assert( NULL != pencil_size );
     356           0 :     assert( NULL != layouted_feature );
     357           0 :     assert( NULL != cr );
     358             : 
     359           0 :     const data_feature_t *the_feature = layout_feature_get_data_const( layouted_feature );
     360           0 :     const geometry_rectangle_t *const symbol_box_bounds = layout_feature_get_symbol_box_const( layouted_feature );
     361             : 
     362           0 :     const double left = geometry_rectangle_get_left ( symbol_box_bounds );
     363           0 :     const double top = geometry_rectangle_get_top ( symbol_box_bounds );
     364           0 :     const double center_x = geometry_rectangle_get_center_x( symbol_box_bounds );
     365           0 :     const double center_y = geometry_rectangle_get_center_y( symbol_box_bounds );
     366           0 :     const double circle_x_radius = center_x - left;
     367           0 :     const double circle_y_radius = center_y - top;
     368           0 :     const double bottom = geometry_rectangle_get_bottom( symbol_box_bounds );
     369           0 :     const double right = geometry_rectangle_get_right( symbol_box_bounds );
     370           0 :     const double ctrl_x_offset = circle_x_radius * (1.0-BEZIER_CTRL_POINT_FOR_90_DEGREE_CIRCLE);
     371           0 :     const double ctrl_y_offset = circle_y_radius * (1.0-BEZIER_CTRL_POINT_FOR_90_DEGREE_CIRCLE);
     372             : 
     373           0 :     cairo_move_to ( cr, center_x, bottom );
     374           0 :     cairo_curve_to ( cr, left + ctrl_x_offset, bottom, left, bottom - ctrl_y_offset, left /* end point x */, center_y /* end point y */ );
     375           0 :     cairo_curve_to ( cr, left, top + ctrl_y_offset, left + ctrl_x_offset, top, center_x /* end point x */, top /* end point y */ );
     376           0 :     cairo_curve_to ( cr, right - ctrl_x_offset, top, right, top + ctrl_y_offset, right /* end point x */, center_y /* end point y */ );
     377           0 :     cairo_curve_to ( cr, right, bottom - ctrl_y_offset, right - ctrl_x_offset, bottom, center_x /* end point x */, bottom /* end point y */ );
     378             : 
     379           0 :     cairo_set_source_rgba( cr, 1.0, 1.0, 1.0, 1.0 );  /* white background */
     380           0 :     cairo_fill_preserve (cr);
     381           0 :     cairo_set_source_rgba( cr, foreground_color.red, foreground_color.green, foreground_color.blue, foreground_color.alpha );
     382           0 :     cairo_stroke (cr);
     383             : 
     384             :     /* draw X of exit icon */
     385           0 :     if ( data_feature_get_main_type( the_feature ) == DATA_FEATURE_TYPE_EXIT )
     386             :     {
     387           0 :         const double half_width = geometry_rectangle_get_width ( symbol_box_bounds )/2.0;
     388           0 :         const double half_height = geometry_rectangle_get_height ( symbol_box_bounds )/2.0;
     389           0 :         const double cross_end_dx = half_width * SINE_OF_45_DEGREE;
     390           0 :         const double cross_end_dy = half_height * SINE_OF_45_DEGREE;
     391             : 
     392           0 :         cairo_move_to ( cr, center_x + cross_end_dx, center_y - cross_end_dy );
     393           0 :         cairo_line_to ( cr, center_x - cross_end_dx, center_y + cross_end_dy );
     394           0 :         cairo_move_to ( cr, center_x - cross_end_dx, center_y - cross_end_dy );
     395           0 :         cairo_line_to ( cr, center_x + cross_end_dx, center_y + cross_end_dy );
     396             : 
     397           0 :         cairo_stroke (cr);
     398             :     }
     399             : 
     400           0 :     U8_TRACE_END();
     401           0 : }
     402             : 
     403           0 : void pencil_feature_painter_private_draw_interface_icon ( pencil_feature_painter_t *this_,
     404             :                                                           const layout_feature_t *layouted_feature,
     405             :                                                           const pencil_size_t *pencil_size,
     406             :                                                           cairo_t *cr )
     407             : {
     408           0 :     U8_TRACE_BEGIN();
     409           0 :     assert( NULL != pencil_size );
     410           0 :     assert( NULL != layouted_feature );
     411           0 :     assert( NULL != cr );
     412             : 
     413           0 :     const geometry_rectangle_t *const symbol_box_bounds = layout_feature_get_symbol_box_const( layouted_feature );
     414             : 
     415           0 :     const double left = geometry_rectangle_get_left ( symbol_box_bounds );
     416           0 :     const double top = geometry_rectangle_get_top ( symbol_box_bounds );
     417           0 :     const double width = geometry_rectangle_get_width ( symbol_box_bounds );
     418           0 :     const double height = geometry_rectangle_get_height ( symbol_box_bounds );
     419             : 
     420           0 :     double bottom = top + height;
     421           0 :     double right = left + width;
     422           0 :     double half_width = 0.5 * width;
     423           0 :     double half_height = 0.5 * height;
     424           0 :     double center_x = left + half_width;
     425           0 :     double center_y = top + half_height;
     426           0 :     double ctrl_xoffset = half_width * (1.0-BEZIER_CTRL_POINT_FOR_90_DEGREE_CIRCLE);
     427           0 :     double ctrl_yoffset = half_height * (1.0-BEZIER_CTRL_POINT_FOR_90_DEGREE_CIRCLE);
     428             : 
     429           0 :     switch ( layout_feature_get_icon_direction( layouted_feature ) )
     430             :     {
     431           0 :         case GEOMETRY_DIRECTION_LEFT:
     432             :         {
     433           0 :             cairo_move_to ( cr, center_x, top );
     434           0 :             cairo_curve_to ( cr, right - ctrl_xoffset, top, right, top + ctrl_yoffset, right /* end point x */, center_y /* end point y */ );
     435           0 :             cairo_curve_to ( cr, right, bottom - ctrl_yoffset, right - ctrl_xoffset, bottom, center_x /* end point x */, bottom /* end point y */ );
     436           0 :             cairo_stroke (cr);
     437             :         }
     438           0 :         break;
     439             : 
     440           0 :         case GEOMETRY_DIRECTION_UP:
     441             :         {
     442           0 :             cairo_move_to ( cr, right, center_y );
     443           0 :             cairo_curve_to ( cr, right, bottom - ctrl_yoffset, right - ctrl_xoffset, bottom, center_x /* end point x */, bottom /* end point y */ );
     444           0 :             cairo_curve_to ( cr, left + ctrl_xoffset, bottom, left, bottom - ctrl_yoffset, left /* end point x */, center_y /* end point y */ );
     445           0 :             cairo_stroke (cr);
     446             :         }
     447           0 :         break;
     448             : 
     449           0 :         case GEOMETRY_DIRECTION_RIGHT:
     450             :         {
     451           0 :             cairo_move_to ( cr, center_x, bottom );
     452           0 :             cairo_curve_to ( cr, left + ctrl_xoffset, bottom, left, bottom - ctrl_yoffset, left /* end point x */, center_y /* end point y */ );
     453           0 :             cairo_curve_to ( cr, left, top + ctrl_yoffset, left + ctrl_xoffset, top, center_x /* end point x */, top /* end point y */ );
     454           0 :             cairo_stroke (cr);
     455             :         }
     456           0 :         break;
     457             : 
     458           0 :         case GEOMETRY_DIRECTION_DOWN:
     459             :         {
     460           0 :             cairo_move_to ( cr, left, center_y );
     461           0 :             cairo_curve_to ( cr, left, top + ctrl_yoffset, left + ctrl_xoffset, top, center_x /* end point x */, top /* end point y */ );
     462           0 :             cairo_curve_to ( cr, right - ctrl_xoffset, top, right, top + ctrl_yoffset, right /* end point x */, center_y /* end point y */ );
     463           0 :             cairo_stroke (cr);
     464             :         }
     465           0 :         break;
     466             : 
     467           0 :         case GEOMETRY_DIRECTION_CENTER:
     468             :         {
     469           0 :             cairo_move_to ( cr, center_x, bottom );
     470           0 :             cairo_curve_to ( cr, left + ctrl_xoffset, bottom, left, bottom - ctrl_yoffset, left /* end point x */, center_y /* end point y */ );
     471           0 :             cairo_curve_to ( cr, left, top + ctrl_yoffset, left + ctrl_xoffset, top, center_x /* end point x */, top /* end point y */ );
     472           0 :             cairo_curve_to ( cr, right - ctrl_xoffset, top, right, top + ctrl_yoffset, right /* end point x */, center_y /* end point y */ );
     473           0 :             cairo_curve_to ( cr, right, bottom - ctrl_yoffset, right - ctrl_xoffset, bottom, center_x /* end point x */, bottom /* end point y */ );
     474           0 :             cairo_stroke (cr);
     475             :         }
     476           0 :         break;
     477             : 
     478           0 :         default:
     479             :         {
     480           0 :             U8_LOG_ERROR( "unexpected value in geometry_direction_t." );
     481             :         }
     482           0 :         break;
     483             :     }
     484             : 
     485           0 :     U8_TRACE_END();
     486           0 : }
     487             : 
     488           0 : void pencil_feature_painter_get_minimum_bounds ( pencil_feature_painter_t *this_,
     489             :                                                  const data_feature_t *the_feature,
     490             :                                                  const data_profile_part_t *profile,
     491             :                                                  const pencil_size_t *pencil_size,
     492             :                                                  PangoLayout *font_layout,
     493             :                                                  geometry_dimensions_t *out_feature_bounds )
     494             : {
     495           0 :     U8_TRACE_BEGIN();
     496           0 :     assert( NULL != the_feature );
     497           0 :     assert( NULL != profile );
     498           0 :     assert( NULL != pencil_size );
     499           0 :     assert( NULL != font_layout );
     500           0 :     assert( NULL != out_feature_bounds );
     501             : 
     502           0 :     const geometry_dimensions_t label_dim_proposal = {
     503           0 :         .width = 25.0 * pencil_size_get_standard_font_size( pencil_size ),
     504           0 :         .height = pencil_size_get_standard_font_size( pencil_size )
     505             :     };
     506           0 :     draw_feature_label_get_key_and_value_dimensions( &((*this_).draw_feature_label),
     507             :                                                      the_feature,
     508             :                                                      profile,
     509             :                                                      &label_dim_proposal,
     510             :                                                      pencil_size,
     511             :                                                      font_layout,
     512             :                                                      out_feature_bounds
     513             :                                                    );
     514             : 
     515           0 :     U8_TRACE_END();
     516           0 : }
     517             : 
     518             : 
     519             : /*
     520             : Copyright 2017-2024 Andreas Warnke
     521             : 
     522             : Licensed under the Apache License, Version 2.0 (the "License");
     523             : you may not use this file except in compliance with the License.
     524             : You may obtain a copy of the License at
     525             : 
     526             :     http://www.apache.org/licenses/LICENSE-2.0
     527             : 
     528             : Unless required by applicable law or agreed to in writing, software
     529             : distributed under the License is distributed on an "AS IS" BASIS,
     530             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     531             : See the License for the specific language governing permissions and
     532             : limitations under the License.
     533             : */

Generated by: LCOV version 1.16