changeset 30958:8a8f82c0235e

print.m: Add options "-image"/"-vector" for Matlab compatibility. These options duplicate the "-opengl" and "-painters" arguments and set the Renderer used by Octave for printing. The names more clearly show the intent and are Matlab compatible. * NEWS.8.md: Announce additional options. * print.m: Add new options to docstring. * __print_parse_opts__.m: Decode additional arguments and set "renderer" field appropriately.
author Rik <rik@octave.org>
date Thu, 21 Apr 2022 14:52:35 -0700
parents abca9eac1ec9
children 98bff9749345
files etc/NEWS.8.md scripts/plot/util/print.m scripts/plot/util/private/__print_parse_opts__.m
diffstat 3 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.8.md	Thu Apr 21 13:53:27 2022 -0700
+++ b/etc/NEWS.8.md	Thu Apr 21 14:52:35 2022 -0700
@@ -27,6 +27,9 @@
 - `clock` now has an optional second output `ISDST` which indicates if
   Daylight Savings Time is in effect for the system's time zone.
 
+- `print` now accepts option `-image` to specify the "opengl" renderer
+  and `-vector` to specify the "painters" renderer.
+
 ### Alphabetical list of new functions added in Octave 8
 
 
--- a/scripts/plot/util/print.m	Thu Apr 21 13:53:27 2022 -0700
+++ b/scripts/plot/util/print.m	Thu Apr 21 14:52:35 2022 -0700
@@ -116,15 +116,15 @@
 ## @end group
 ## @end example
 ##
-## @item  -opengl
-## @itemx -painters
-##   Specifies whether the opengl (pixel-based) or painters (vector-based)
-## renderer is used.  This is equivalent to changing the figure's
-## @qcode{"Renderer"} property.  When the figure
-## @nospell{@qcode{"RendererMode"}} property is @qcode{"auto"} (the default)
-## Octave will use the @qcode{"opengl"} renderer for raster formats (e.g.,
-## JPEG) and @qcode{"painters"} for vector formats (e.g., PDF).  Those options
-## are only supported for the "qt" graphics toolkit.
+## @item  -image | -opengl
+## @itemx -vector | -painters
+##   Specifies whether the pixel-based renderer (@env{-image} or @env{-opengl})
+## or vector-based renderer (@env{-vector} or @env{-painters}) is used.  This
+## is equivalent to changing the figure's @qcode{"Renderer"} property.  When
+## the figure @nospell{@qcode{"RendererMode"}} property is @qcode{"auto"} (the
+## default) Octave will use the @qcode{"opengl"} renderer for raster formats
+## (e.g., JPEG) and @qcode{"painters"} for vector formats (e.g., PDF)@.  These
+## options are only supported for the "qt" graphics toolkit.
 ##
 ## @item -svgconvert
 ##   When using the @option{-painters} renderer, this enables a different
--- a/scripts/plot/util/private/__print_parse_opts__.m	Thu Apr 21 13:53:27 2022 -0700
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Thu Apr 21 14:52:35 2022 -0700
@@ -108,6 +108,10 @@
         arg_st.force_solid = -1;
       elseif (any (strcmp (arg, {"-opengl", "-painters"})))
         arg_st.renderer = arg(2:end);
+      elseif (strcmp (arg, "-image"))
+        arg_st.renderer = "opengl";
+      elseif (strcmp (arg, "-vector"))
+        arg_st.renderer = "painters";
       elseif (strcmp (arg, "-RGBImage"))
         arg_st.rgb_output = true;
         arg_st.renderer = "opengl";