Mercurial > hg > octave-nkf
changeset 12446:f899f451fe76
Fix for fltk patch markers (#31801)
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 15 Feb 2011 00:42:05 +0100 |
parents | 98772e4e8a2a |
children | 890e89c3dfeb |
files | scripts/ChangeLog scripts/plot/private/__scatter__.m src/ChangeLog src/gl-render.cc |
diffstat | 4 files changed, 68 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2011-02-14 David Bateman <dbateman@free.fr> + + * plot/private/__scatter__.m: Correctly set the facevertexcdata and + faces properties in the patch objects. + 2011-02-14 Marco Caliari <marco.caliari@univr.it> * polynomial/spline.m: Allow length(x) == 2 and unsorted x values.
--- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -168,7 +168,8 @@ "marker", marker, "markersize", s(i), "markeredgecolor", "none", "markerfacecolor", "flat", - "cdata", c(i,:), "linestyle", "none"); + "cdata", c(i,:), "facevertexcdata", c(i,:), + "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), "faces", 1, "vertices", [x(i), y(i), z(i,:)], @@ -176,7 +177,8 @@ "marker", marker, "markersize", s(i), "markeredgecolor", "flat", "markerfacecolor", "none", - "cdata", c(i,:), "linestyle", "none"); + "cdata", c(i,:), "facevertexcdata", c(i,:), + "linestyle", "none"); endif endfor @@ -278,7 +280,7 @@ if (ischar (c) || !isflat) if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, + "faces", 1:numel(x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markeredgecolor", "none", @@ -286,7 +288,7 @@ "markersize", s, "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, + "faces", 1:numel(x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markeredgecolor", c, @@ -296,20 +298,22 @@ else if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, + "faces", 1:numel(x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markersize", s, "markeredgecolor", "none", "markerfacecolor", "flat", - "cdata", c, "linestyle", "none"); + "cdata", c, "facevertexcdata", c(:), + "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, + "faces", 1:numel(x), "vertices", vert, "facecolor", "none", "edgecolor", "none", "marker", marker, "markersize", s, "markeredgecolor", "flat", "markerfacecolor", "none", - "cdata", c, "linestyle", "none"); + "cdata", c, "facevertexcdata", c(:), + "linestyle", "none"); endif endif else @@ -364,12 +368,16 @@ if (isempty (z1)) for i = 1 : length (hlist) set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", - reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i)); + reshape(c1(i,:),[1, size(c1)(2:end)]), + "facevertexcdata", c1(i,:), + "markersize", size1(i)); endfor else for i = 1 : length (hlist) set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", - reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i)); + reshape(c1(i,:),[1, size(c1)(2:end)]), + "facevertexcdata", c1(i,:), + "markersize", size1(i)); endfor endif endif
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-02-14 David Bateman <dbateman@free.fr> + + * gl-render.cc (void opengl_renderer::draw_patch ( + const patch::properties &)): Obtain the marker color directly + from the cdata rather that the facecolor, as the facecolor might + not have been set. + 2011-02-14 Konstantinos Poulios <logari81@googlemail.com> * graphics.cc (axes::properties::sync_positions): Calculation of
--- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -2349,19 +2349,35 @@ Matrix mecolor = props.get_markeredgecolor_rgb (); Matrix mfcolor = props.get_markerfacecolor_rgb (); - Matrix cc (1, 3, 0.0); - - if (mecolor.numel () == 0 && props.markeredgecolor_is ("auto")) + + bool has_markerfacecolor = false; + + if ((mecolor.numel () == 0 && ! props.markeredgecolor_is ("none")) + || (mfcolor.numel () == 0 && ! props.markerfacecolor_is ("none"))) { - mecolor = props.get_edgecolor_rgb (); - do_edge = ! props.edgecolor_is ("none"); + Matrix mc = props.get_color_data ().matrix_value (); + + if (mc.rows () == 1) + { + // Single color specifications, we can simplify a little bit + + if (mfcolor.numel () == 0 + && ! props.markerfacecolor_is ("none")) + mfcolor = mc; + + if (mecolor.numel () == 0 + && ! props.markeredgecolor_is ("none")) + mecolor = mc; + } + else + { + if (c.numel () == 0) + c = props.get_color_data ().matrix_value (); + has_markerfacecolor = ((c.numel () > 0) + && (c.rows () == f.rows ())); + } } - if (mfcolor.numel () == 0 && props.markerfacecolor_is ("auto")) - { - mfcolor = props.get_facecolor_rgb (); - do_face = ! props.facecolor_is ("none"); - } init_marker (props.get_marker (), props.get_markersize (), props.get_linewidth ()); @@ -2374,11 +2390,19 @@ if (clip(idx)) continue; - Matrix lc = (do_edge ? (mecolor.numel () == 0 ? - vdata[i+j*fr].get_rep ()->color : mecolor) + Matrix cc; + if (c.numel () > 0) + { + cc.resize (1, 3); + if (has_markerfacecolor) + cc(0) = c(i,0), cc(1) = c(i,1), cc(2) = c(i,2); + else + cc(0) = c(idx,0), cc(1) = c(idx,1), cc(2) = c(idx,2); + } + + Matrix lc = (do_edge ? (mecolor.numel () == 0 ? cc : mecolor) : Matrix ()); - Matrix fc = (do_face ? (mfcolor.numel () == 0 ? - vdata[i+j*fr].get_rep ()->color : mfcolor) + Matrix fc = (do_face ? (mfcolor.numel () == 0 ? cc : mfcolor) : Matrix ()); draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc);