Re: imshow.m

Daniel J Sebald <[email protected]> Wed, 22 Feb 2006 03:05:42 -0600
Newsgroups gmane.comp.gnu.octave.graphics,gmane.comp.gnu.octave.maintainers
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------060505060906050007090604
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Daniel J Sebald wrote:

> Are the "zoom" parameters in the image routines necessary anymore?

I ask because I see that the ImageMagick plots can be zoomed manually.  Anyway...

John, attached is a short patch to restore the colormap after using imshow().  If the colormap changes using imshow(R,G,B), then future use of image(A) is messed up.

As you might guess, the imshow() routine builds an RBG image by creating a value in the palette for each pixel.  Not the best of approaches.  I wonder if the image routines could leave things open for the graphics driver to determine how to implement.

Related to that is how to implement selecting the graphics driver to use.  Has anyone thought that out yet?  If so, please let me know.

My thoughts are that there could be __image__.m, __image_rgb__.m, __imshow__.m, __imshow_rgb__.m, etc. used within the generic image.m, imshow.m, etc. files.  Just like as was done with __plot__.m, etc.  Now it would be up to the graphics driver to supply the files __image__.m, __plot__.m, etc and they could be kept in a separate subdirectory, e.g., "gnuplot".  Then, in order to choose the graphics engine, one sets a variable like

GRAPHICS = "gnuplot";

to choose the subdirectory name for where to look for these scripts.

If there is already an existing structure, I'd be happy to know the concept.

Dan

--------------060505060906050007090604
Content-Type: text/x-patch;
 name="imshow_cmap_restore_22feb2006.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="imshow_cmap_restore_22feb2006.patch"

--- imshow_gp.m.old	2006-02-21 21:33:31.000000000 -0600
+++ imshow_gp.m	2006-02-22 02:47:39.070091408 -0600
@@ -172,8 +172,10 @@
     endfor
   endif
 
+  T = colormap();  ## Temporarily save map
   colormap (M);
   image (I, zoom);
+  colormap(T);     ## Restore map
 
 endfunction
 

--------------060505060906050007090604--