annotate scripts/image/__img__.m @ 8812:7d48766c21a5

use consistent format for doc strings of internal functions
author John W. Eaton <jwe@octave.org>
date Thu, 19 Feb 2009 02:16:34 -0500
parents f6ca8ff51818
children eb63fbe60fab
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 -*-
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8208
diff changeset
22 ## @deftypefnx {Function File} {} __img__ (@var{x}, @var{y}, @var{img}, @dots{})
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8208
diff changeset
23 ## Undocumented internal function.
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8208
diff changeset
24 ## @end deftypefn
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8208
diff changeset
25
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
26 ## Generic image creation.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
27 ##
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
28 ## 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
29 ## @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
30 ## variables are ignored.
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
31
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
32 ## Author: Tony Richardson <arichard@stark.cc.oh.us>
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
33 ## Created: July 1994
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
34 ## Adapted-By: jwe
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
35
7276
1e8e64d71e34 [project @ 2007-12-10 20:09:59 by jwe]
jwe
parents: 7017
diff changeset
36 function h = __img__ (x, y, img, varargin)
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
37
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
38 newplot ();
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
39
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
40 if (isempty (img))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
41 error ("__img__: matrix is empty");
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
42 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
43
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
44 if (isempty (x))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
45 x = [1, columns(img)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
46 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
47
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
48 if (isempty (y))
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
49 y = [1, rows(img)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
50 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
51
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
52 xlim = [x(1), x(end)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
53 ylim = [y(1), y(end)];
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
54
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
55 ca = gca ();
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
56
7276
1e8e64d71e34 [project @ 2007-12-10 20:09:59 by jwe]
jwe
parents: 7017
diff changeset
57 tmp = __go_image__ (ca, "cdata", img, "xdata", xlim, "ydata", ylim,
7471
86ba621332ff Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents: 7276
diff changeset
58 "cdatamapping", "direct", varargin {:});
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
59
7930
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
60 if (ndims (img) == 3)
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
61 if (isinteger (img))
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
62 c = class (img);
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
63 mn = intmin (c);
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
64 mx = intmax (c);
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
65 set (ca, "clim", double ([mn, mx]));
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
66 endif
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
67 endif
1f6eb3de1c4e __img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
68
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
69 set (ca, "view", [0, 90], "xlimmode", "manual", "ylimmode", "manual",
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
70 "xlim", xlim, "ylim", ylim);
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
71
6420
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
72 if (strcmp (get (ca, "nextplot"), "replace"))
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
73 set (ca, "ydir", "reverse");
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
74 endif
e35658098bbc [project @ 2007-03-20 17:22:31 by jwe]
jwe
parents: 6405
diff changeset
75
6312
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
76 if (nargout > 0)
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
77 h = tmp;
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
78 endif
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
79
725709ab0445 [project @ 2007-02-15 21:34:46 by jwe]
jwe
parents:
diff changeset
80 endfunction