Skip to content

Commit

Permalink
fix key sample for "splot with boxes"
Browse files Browse the repository at this point in the history
The actual fill was correct but line properties of the border were not.
  • Loading branch information
Ethan A Merritt committed Aug 26, 2024
1 parent 6889840 commit b36e869
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/gp_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef enum PLOT_STYLE {
YERRORBARS = 6*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
XYERRORBARS = 7*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_POINT | PLOT_STYLE_HAS_ERRORBAR),
BOXXYERROR = 8*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
BOXES = 9*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL | PLOT_STYLE_HAS_PM3DBORDER),
BOXES = 9*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
BOXERROR = 10*PLOT_STYLE_BITS + (PLOT_STYLE_HAS_LINE | PLOT_STYLE_HAS_FILL),
STEPS = 11*PLOT_STYLE_BITS + PLOT_STYLE_HAS_LINE,
FILLSTEPS = 11*PLOT_STYLE_BITS + PLOT_STYLE_HAS_FILL,
Expand Down
58 changes: 40 additions & 18 deletions src/graph3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -3735,34 +3735,56 @@ key_sample_fill(int xl, int yl, struct surface_points *this_plot)
int w = key_sample_right - key_sample_left;
int h = key_entry_height/2;

if (w <= 0)
return;

if (!(term->fillbox))
return;

if (key->invert) {
INVERT_KEY();
y = yl - key_entry_height/4;
}

if (!(term->fillbox))
return;

if (this_plot->plot_style == CIRCLES) {
do_arc(x+w/2, yl, key_entry_height/4, 0., 360., style, FALSE);
/* Retrace the border if the style requests it */
do_arc(x+w/2, yl, h/2, 0., 360., style, FALSE);
if (need_fill_border(fs))
do_arc(x+w/2, yl, key_entry_height/4, 0., 360., 0, FALSE);
do_arc(x+w/2, yl, h/2, 0., 360., 0, FALSE);
return;
}

} else if (w > 0) {
(term->fillbox)(style,x,y,w,h);
/* solid-fill rectangle in current color */
(term->fillbox)(style,x,y,w,h);

if ((this_plot->plot_style & PLOT_STYLE_HAS_PM3DBORDER)) {
if (pm3d.border.l_type != LT_NODRAW && pm3d.border.l_type != LT_DEFAULT)
term_apply_lp_properties(&pm3d.border);
newpath();
draw_clip_line( x, y, x+w, y);
draw_clip_line( x+w, y, x+w, y+h);
draw_clip_line( x+w, y+h, x, y+h);
draw_clip_line( x, y+h, x, y);
closepath();
}
/* Some plot styles never want a border in the key sample */
if (this_plot->plot_style == ZERRORFILL || this_plot->plot_style == FILLEDCURVES)
return;

/* Some fill styles keep border properties in plot->fill_properties */
if (this_plot->plot_style == BOXES) {
t_colorspec *bordercolor = &(this_plot->fill_properties.border_color);
if (bordercolor->type == TC_LT && bordercolor->lt == LT_NODRAW)
return;
apply_pm3dcolor(bordercolor);
}

/* Some plot styles keep border properties in pm3d */
else if ((this_plot->plot_style & PLOT_STYLE_HAS_PM3DBORDER)) {
if (pm3d.border.l_type != LT_NODRAW && pm3d.border.l_type != LT_DEFAULT)
term_apply_lp_properties(&pm3d.border);
} else {

/* Should not happen */
return;
}

/* Draw a border for the key sample */
newpath();
draw_clip_line( x, y, x+w, y);
draw_clip_line( x+w, y, x+w, y+h);
draw_clip_line( x+w, y+h, x, y+h);
draw_clip_line( x, y+h, x, y);
closepath();
}


Expand Down

0 comments on commit b36e869

Please sign in to comment.