changeset 22447:25122f114a24

Fix gnuplot 4.4 error with translucent lines (bug #49017). * __gnuplot_draw_axes__.m: Check __gnuplot_has_feature ("alphablend_linecolor") before using RGBA syntax for line color. * __gnuplot_has_feature__.m: Add new feature "alphablend_linecolor" which only exists in gnuplot 4.6 and above.
author Rik <rik@octave.org>
date Wed, 07 Sep 2016 20:15:02 -0700
parents ec9dca76189c
children 809989ceb5d3
files scripts/plot/util/private/__gnuplot_draw_axes__.m scripts/plot/util/private/__gnuplot_has_feature__.m
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m	Wed Sep 07 08:55:22 2016 -0700
+++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m	Wed Sep 07 20:15:02 2016 -0700
@@ -1011,7 +1011,7 @@
               endif
             else
               colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
-                                   round (255*color));
+                                   uint8 (255*color));
             endif
 
             sidx = 1;
@@ -1946,7 +1946,8 @@
   found_style = false;
   if (isnumeric (linecolor))
     color = linecolor;
-    if (isfield (obj, "alpha"))
+    if (isfield (obj, "alpha")
+        &&  __gnuplot_has_feature__ ("alphablend_linecolor"))
       alphastr = sprintf ("%02x", round (255*(1-obj.alpha)));
     else
       alphastr = "";
--- a/scripts/plot/util/private/__gnuplot_has_feature__.m	Wed Sep 07 08:55:22 2016 -0700
+++ b/scripts/plot/util/private/__gnuplot_has_feature__.m	Wed Sep 07 20:15:02 2016 -0700
@@ -39,7 +39,8 @@
                          "has_termoption_dashed",
                          "needs_color_with_postscript",
                          "linetype",
-                         "dashtype"};
+                         "dashtype",
+                         "alphablend_linecolor"};
   persistent has_features;
 
   if (isempty (has_features))
@@ -49,8 +50,8 @@
       ## Don't throw an error if gnuplot isn't installed
       gnuplot_version = "0.0.0";
     end_try_catch
-    versions = {"4.2.5", "4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3", "4.6", "4.6", "5.0"};
-    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
+    versions =  {"4.2.5", "4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3", "4.6", "4.6", "5.0", "4.6"};
+    operators = {   ">=",    ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">=",  ">="};
     have_features = false (size (features));
     for n = 1 : numel (have_features)
       has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});