changeset 6312:725709ab0445

[project @ 2007-02-15 21:34:46 by jwe]
author jwe
date Thu, 15 Feb 2007 21:36:00 +0000
parents e2a1aca62551
children 8232ed4a7fc0
files scripts/ChangeLog scripts/image/Makefile.in scripts/image/__img__.m
diffstat 3 files changed, 76 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Feb 15 21:18:35 2007 +0000
+++ b/scripts/ChangeLog	Thu Feb 15 21:36:00 2007 +0000
@@ -5,6 +5,7 @@
 	* plot/__uiobject_image_ctor__.m: Set xdata and ydata properties.
 	* image/__img__.m: New file containing common parts of image.m and
 	imshow.m.
+	* image/Makefile.in (SOURCES): Add __img__.m to the list.
 	* image/image.m, image/imshow.m: Call __img__.
 	* plot/__uiobject_draw_axes__.m:
 	Handle rgb imaged data stored in 3-d arrays.
--- a/scripts/image/Makefile.in	Thu Feb 15 21:18:35 2007 +0000
+++ b/scripts/image/Makefile.in	Thu Feb 15 21:36:00 2007 +0000
@@ -20,10 +20,10 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
-SOURCES = __img_via_file__.m colormap.m gray.m gray2ind.m hsv2rgb.m \
-  image.m image_viewer.m imagesc.m imshow.m ind2gray.m ind2rgb.m \
-  loadimage.m ntsc2rgb.m ocean.m rgb2hsv.m rgb2ind.m rgb2ntsc.m \
-  saveimage.m
+SOURCES = __img__.m __img_via_file__.m colormap.m gray.m gray2ind.m \
+  hsv2rgb.m image.m image_viewer.m imagesc.m imshow.m ind2gray.m \
+  ind2rgb.m loadimage.m ntsc2rgb.m ocean.m rgb2hsv.m rgb2ind.m \
+  rgb2ntsc.m saveimage.m
 
 IMAGES = default.img
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/image/__img__.m	Thu Feb 15 21:36:00 2007 +0000
@@ -0,0 +1,71 @@
+## Copyright (C) 1996, 1997 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+## 02110-1301, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} __img__ (@var{img})
+## @deftypefnx {Function File} {} __img__ (@var{x}, @var{y}, @var{img})
+## Generic image creation.
+##
+## The axis values corresponding to the matrix elements are specified in
+## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these
+## variables are ignored.
+## @end deftypefn
+
+## Author: Tony Richardson <arichard@stark.cc.oh.us>
+## Created: July 1994
+## Adapted-By: jwe
+
+function h = __img__ (x, y, img)
+
+  newplot ();
+
+  if (isempty (img))
+    error ("__img__: matrix is empty");
+  endif
+
+  if (isempty (x))
+    x = [1, columns(img)];
+  endif
+
+  if (isempty (y))
+    y = [1, rows(img)];
+  endif
+
+  xlim = [x(1), x(end)];
+  ylim = [y(1), y(end)];
+
+  ca = gca ();
+
+  s = __uiobject_image_ctor__ (ca);
+
+  s.cdata = img;
+  s.xdata = xlim;
+  s.ydata = ylim;
+
+  tmp = __uiobject_make_handle__ (s);
+
+  __uiobject_adopt__ (ca, tmp);
+
+  set (ca, "view", [0, 90], "xlim", xlim, "ylim", ylim);
+
+  if (nargout > 0)
+    h = tmp;
+  endif
+
+endfunction