Mercurial > octave
changeset 22759:39f39eb4e476
Implement "linejoin" property (bug #48387)
* configure.ac: test whether gl2psLineJoin function is available in gl2ps
* graphics.in.h (line::properties): add "linejoin" property
* gl-render.h (opengl_renderer::set_linejoin): new virtual method, does nothing
by default.
* gl-render.cc (opengl_renderer::draw_line): make use of "linejoin" property
* gl-render.cc (opengl_renderer::draw_patch/suface): force "miter" line join
* gl2ps-print.cc (gl2ps_renderer::set_linejoin): call gl2psLineJoin conditioned
on HAVE_GL2PSLINEJOIN.
* genpropdoc.m: document linejoin property.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Thu, 27 Oct 2016 09:24:58 +0200 |
parents | 6ea9681bb225 |
children | c4d80b9d2898 |
files | configure.ac doc/interpreter/genpropdoc.m libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/gl2ps-print.cc libinterp/corefcn/graphics.in.h |
diffstat | 6 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Sun Nov 13 21:27:41 2016 -0800 +++ b/configure.ac Thu Oct 27 09:24:58 2016 +0200 @@ -1746,6 +1746,11 @@ if test -n "$warn_gl2ps"; then OCTAVE_CONFIGURE_WARNING([warn_gl2ps]) +else + save_LIBS="$LIBS" + LIBS="$GL2PS_LIBS $LIBS" + AC_CHECK_FUNCS([gl2psLineJoin]) + LIBS="$save_LIBS" fi AC_SUBST(GL2PS_LIBS)
--- a/doc/interpreter/genpropdoc.m Sun Nov 13 21:27:41 2016 -0800 +++ b/doc/interpreter/genpropdoc.m Thu Oct 27 09:24:58 2016 +0200 @@ -870,6 +870,10 @@ case "linewidth" s.doc = "Width of the line object measured in points."; + + case "linejoin" + s.doc = "Control the shape of the junction of line segments. \ +This property currently only affects the printed output."; case "marker" s.doc = "Shape of the marker for each data point. \
--- a/libinterp/corefcn/gl-render.cc Sun Nov 13 21:27:41 2016 -0800 +++ b/libinterp/corefcn/gl-render.cc Thu Oct 27 09:24:58 2016 +0200 @@ -2077,6 +2077,7 @@ set_color (props.get_color_rgb ()); set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); set_linewidth (props.get_linewidth ()); + set_linejoin (props.get_linejoin ()); if (has_z) { @@ -2504,6 +2505,7 @@ set_linestyle (props.get_linestyle (), false, props.get_linewidth ()); set_linewidth (props.get_linewidth ()); + set_linejoin ("miter"); // Mesh along Y-axis @@ -3086,6 +3088,7 @@ double linewidth = props.get_linewidth (); set_linestyle (props.get_linestyle (), false, linewidth); set_linewidth (linewidth); + set_linejoin ("miter"); // NOTE: patch contour cannot be offset. Offset must occur with the // filled portion of the patch above. The tesselator uses
--- a/libinterp/corefcn/gl-render.h Sun Nov 13 21:27:41 2016 -0800 +++ b/libinterp/corefcn/gl-render.h Thu Oct 27 09:24:58 2016 +0200 @@ -82,6 +82,7 @@ virtual void set_linewidth (float w); virtual void set_linestyle (const std::string& s, bool stipple = false, double linewidth = 0.5); + virtual void set_linejoin (const std::string& /*s*/) { }; virtual void set_clipbox (double x1, double x2, double y1, double y2, double z1, double z2); virtual void set_clipping (bool on);
--- a/libinterp/corefcn/gl2ps-print.cc Sun Nov 13 21:27:41 2016 -0800 +++ b/libinterp/corefcn/gl2ps-print.cc Thu Oct 27 09:24:58 2016 +0200 @@ -124,6 +124,20 @@ gl2psEnable (GL2PS_LINE_STIPPLE); } + void set_linejoin (const std::string& s) + { + octave::opengl_renderer::set_linejoin (s); + +#if defined (HAVE_GL2PSLINEJOIN) + if (s == "round") + gl2psLineJoin (GL2PS_LINE_JOIN_ROUND); + else if (s == "miter") + gl2psLineJoin (GL2PS_LINE_JOIN_MITER); + else if (s == "chamfer") + gl2psLineJoin (GL2PS_LINE_JOIN_BEVEL); +#endif + } + void set_polygon_offset (bool on, float offset = 0.0f) { if (on)
--- a/libinterp/corefcn/graphics.in.h Sun Nov 13 21:27:41 2016 -0800 +++ b/libinterp/corefcn/graphics.in.h Thu Oct 27 09:24:58 2016 +0200 @@ -4386,6 +4386,7 @@ // FIXME: interpreter is not a property of Matlab line objects. // Octave uses this for legend() with the string displayname. radio_property interpreter , "{tex}|none|latex" + radio_property linejoin , "{round}|miter|chamfer" radio_property linestyle , "{-}|--|:|-.|none" double_property linewidth , 0.5 radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"