annotate scripts/image/__img__.m @ 7276:1e8e64d71e34

[project @ 2007-12-10 20:09:59 by jwe]
author jwe
date Mon, 10 Dec 2007 20:09:59 +0000
parents a1dbe9d80eee
children 86ba621332ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
2 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
4 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
8 ## your option) any later version.
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
9 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
14 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
18
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6420
diff changeset
19 ## Undocumented internal function.
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6420
diff changeset
20
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
21 ## -*- texinfo -*-
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefn {Function File} {} __img__ (@var{img})
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
23 ## @deftypefnx {Function File} {} __img__ (@var{x}, @var{y}, @var{img})
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
24 ## Generic image creation.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
25 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
26 ## The axis values corresponding to the matrix elements are specified in
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
27 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
28 ## variables are ignored.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
29 ## @end deftypefn
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
30
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
31 ## Author: Tony Richardson <arichard@stark.cc.oh.us>
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
32 ## Created: July 1994
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
33 ## Adapted-By: jwe
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
34
7276
1e8e64d71e34 [project @ 2007-12-10 20:09:59 by jwe]
jwe
parents: 7017
diff changeset
35 function h = __img__ (x, y, img, varargin)
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
36
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
37 newplot ();
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
38
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
39 if (isempty (img))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
40 error ("__img__: matrix is empty");
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
41 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
42
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
43 if (isempty (x))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
44 x = [1, columns(img)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
45 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
46
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
47 if (isempty (y))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
48 y = [1, rows(img)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
49 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
50
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
51 xlim = [x(1), x(end)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
52 ylim = [y(1), y(end)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
53
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
54 ca = gca ();
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
55
7276
1e8e64d71e34 [project @ 2007-12-10 20:09:59 by jwe]
jwe
parents: 7017
diff changeset
56 tmp = __go_image__ (ca, "cdata", img, "xdata", xlim, "ydata", ylim,
1e8e64d71e34 [project @ 2007-12-10 20:09:59 by jwe]
jwe
parents: 7017
diff changeset
57 varargin {:});
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
58
6376
0eac3484e8df [project @ 2007-03-02 02:18:37 by jwe]
jwe
parents: 6312
diff changeset
59 set (ca, "view", [0, 90]);
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
60
6420
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
61 if (strcmp (get (ca, "nextplot"), "replace"))
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
62 set (ca, "ydir", "reverse");
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
63 endif
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
64
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
65 if (nargout > 0)
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
66 h = tmp;
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
67 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
68
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
69 endfunction