Mercurial > octave-nkf
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 |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton |
6312 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6312 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6312 | 18 |
6945 | 19 ## Undocumented internal function. |
20 | |
6312 | 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 | 26 ## Generic image creation. |
27 ## | |
28 ## The axis values corresponding to the matrix elements are specified in | |
29 ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these | |
30 ## variables are ignored. | |
31 | |
32 ## Author: Tony Richardson <arichard@stark.cc.oh.us> | |
33 ## Created: July 1994 | |
34 ## Adapted-By: jwe | |
35 | |
7276 | 36 function h = __img__ (x, y, img, varargin) |
6312 | 37 |
38 newplot (); | |
39 | |
40 if (isempty (img)) | |
41 error ("__img__: matrix is empty"); | |
42 endif | |
43 | |
44 if (isempty (x)) | |
45 x = [1, columns(img)]; | |
46 endif | |
47 | |
48 if (isempty (y)) | |
49 y = [1, rows(img)]; | |
50 endif | |
51 | |
52 xlim = [x(1), x(end)]; | |
53 ylim = [y(1), y(end)]; | |
54 | |
55 ca = gca (); | |
56 | |
7276 | 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 | 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 | 69 set (ca, "view", [0, 90], "xlimmode", "manual", "ylimmode", "manual", |
70 "xlim", xlim, "ylim", ylim); | |
6312 | 71 |
6420 | 72 if (strcmp (get (ca, "nextplot"), "replace")) |
73 set (ca, "ydir", "reverse"); | |
74 endif | |
75 | |
6312 | 76 if (nargout > 0) |
77 h = tmp; | |
78 endif | |
79 | |
80 endfunction |