changeset 15764:0a27a0e157a6

Temporary fix for display of indexed images of integer class. True fix will be done later in C++ code. * image.m: Convert integer indexed images to class single and switch to 1-based indexing.
author Rik <rik@octave.org>
date Mon, 10 Dec 2012 15:38:38 -0800
parents 56239ff815a3
children 70bf9b6d47af
files scripts/image/image.m
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/image.m	Mon Dec 10 13:15:08 2012 -0800
+++ b/scripts/image/image.m	Mon Dec 10 15:38:38 2012 -0800
@@ -105,6 +105,13 @@
     error ("__img__: matrix is empty");
   endif
 
+  ## FIXME: Hack for integer formats which use zero-based indexing
+  ##        Hack favors correctness of display over size of image in memory.
+  ##        True fix will be done in C++ code. 
+  if (ndims (img) == 2 && (isinteger (img) || islogical (img)))
+    img = single (img) + 1;
+  endif
+
   if (isempty (x))
     x = [1, columns(img)];
   endif