changeset 20336:eca5aa3225f4

imshow.m: Add support for 'parent' property (bug #45473). * imshow.m: Add cell variable prop_val_args{:} when calling image or imagesc. Populate prop_val_args with {"parent", hparent} when "parent" argument given to imshow. Remove code commented out in 2015/05/1 which has not caused any problems. Add warning that arguments "border" and "reduce" are not supported.
author Rik <rik@octave.org>
date Sun, 05 Jul 2015 13:55:56 -0700
parents 9de6949ec15f
children 928e2c6f888e
files scripts/image/imshow.m
diffstat 1 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/imshow.m	Fri Jul 03 09:55:35 2015 -0700
+++ b/scripts/image/imshow.m	Sun Jul 05 13:55:56 2015 -0700
@@ -77,6 +77,7 @@
   truecolor = false;
   indexed = false;
   xdata = ydata = [];
+  prop_val_args = {};
 
   ## Get the image.
   if (ischar (im))
@@ -123,6 +124,9 @@
       endif
     elseif (ischar (arg))
       switch (tolower (arg))
+        case "border"
+          warning ("imshow: border argument is not implemented");
+          narg++;
         case "colormap"
           map = varargin{narg++};
           if (iscolormap (map))
@@ -132,10 +136,14 @@
           endif
         case "displayrange"
           display_range = varargin{narg++};
+        case {"initialmagnification"}
+          warning ("image: zoom argument ignored -- use GUI features");
+          narg++;
         case "parent"
-          warning ("imshow: parent argument is not implemented");
-        case {"truesize", "initialmagnification"}
-          warning ("image: zoom argument ignored -- use GUI features");
+          prop_val_args(end+(1:2)) = {"parent", varargin{narg++}}; 
+        case "reduce"
+          warning ("imshow: reduce argument is not implemented");
+          narg++;
         case "xdata"
           xdata = varargin{narg++};
           if (! isvector (xdata))
@@ -187,21 +195,10 @@
     endif
   endif
 
-  ## FIXME: Commented out 2014/05/01.  imagesc and 'clim' will automatically
-  ## take care of displaying out-of-range data clamped to the limits.
-  ## Eventually, this can be deleted if no problems arise.
-  ## Clamp the image to the range boundaries
-  ##if (! (truecolor || indexed || islogical (im)))
-  ##  low = display_range(1);
-  ##  high = display_range(2);
-  ##  im(im < low) = low;
-  ##  im(im > high) = high;
-  ##endif
-
   if (truecolor || indexed)
-    htmp = image (xdata, ydata, im);
+    htmp = image (xdata, ydata, im, prop_val_args{:});
   else
-    htmp = imagesc (xdata, ydata, im, display_range);
+    htmp = imagesc (xdata, ydata, im, display_range, prop_val_args{:});
     set (gca (), "clim", display_range);
   endif
   set (gca (), "visible", "off", "view", [0, 90],