6312
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __img__ (@var{img}) |
|
22 ## @deftypefnx {Function File} {} __img__ (@var{x}, @var{y}, @var{img}) |
|
23 ## Generic image creation. |
|
24 ## |
|
25 ## The axis values corresponding to the matrix elements are specified in |
|
26 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these |
|
27 ## variables are ignored. |
|
28 ## @end deftypefn |
|
29 |
|
30 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
|
31 ## Created: July 1994 |
|
32 ## Adapted-By: jwe |
|
33 |
|
34 function h = __img__ (x, y, img) |
|
35 |
|
36 newplot (); |
|
37 |
|
38 if (isempty (img)) |
|
39 error ("__img__: matrix is empty"); |
|
40 endif |
|
41 |
|
42 if (isempty (x)) |
|
43 x = [1, columns(img)]; |
|
44 endif |
|
45 |
|
46 if (isempty (y)) |
|
47 y = [1, rows(img)]; |
|
48 endif |
|
49 |
|
50 xlim = [x(1), x(end)]; |
|
51 ylim = [y(1), y(end)]; |
|
52 |
|
53 ca = gca (); |
|
54 |
|
55 s = __uiobject_image_ctor__ (ca); |
|
56 |
|
57 s.cdata = img; |
|
58 s.xdata = xlim; |
|
59 s.ydata = ylim; |
|
60 |
|
61 tmp = __uiobject_make_handle__ (s); |
|
62 |
|
63 __uiobject_adopt__ (ca, tmp); |
|
64 |
|
65 set (ca, "view", [0, 90], "xlim", xlim, "ylim", ylim); |
|
66 |
|
67 if (nargout > 0) |
|
68 h = tmp; |
|
69 endif |
|
70 |
|
71 endfunction |