Mercurial > hg > octave-nkf
annotate scripts/image/brighten.m @ 12575:d0b799dafede
Grammarcheck files for 3.4.1 release.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 04 Apr 2011 15:33:46 -0700 |
parents | c792872f8942 |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1999-2011 Kai Habel |
6788 | 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. | |
6788 | 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/>. | |
6788 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10606
diff
changeset
|
20 ## @deftypefn {Function File} {@var{map_out} =} brighten (@var{map}, @var{beta}) |
6792 | 21 ## @deftypefnx {Function File} {@var{map_out} =} brighten (@var{h}, @var{beta}) |
6788 | 22 ## @deftypefnx {Function File} {@var{map_out} =} brighten (@var{beta}) |
12575
d0b799dafede
Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
23 ## Darken or brighten the given colormap. If the @var{map} argument |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
24 ## is omitted, the function is applied to the current colormap. The first |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
25 ## argument can also be a valid graphics handle @var{h}, in which case |
6788 | 26 ## @code{brighten} is applied to the colormap associated with this handle. |
27 ## | |
28 ## Should the resulting colormap @var{map_out} not be assigned, it will be | |
29 ## written to the current colormap. | |
30 ## | |
31 ## The argument @var{beta} should be a scalar between -1 and 1, | |
32 ## where a negative value darkens and a positive value brightens | |
33 ## the colormap. | |
34 ## @seealso{colormap} | |
35 ## @end deftypefn | |
36 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
37 function rmap = brighten (arg1, beta) |
6788 | 38 h = -1; |
39 if (nargin == 1) | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
40 beta = arg1; |
6788 | 41 m = colormap; |
42 h = gcf (); | |
43 elseif (nargin == 2) | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
44 if (ishandle (arg1)) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
45 h = arg1; |
6788 | 46 m = get (h, "colormap"); |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
47 elseif (ismatrix (arg1) && columns (arg1) == 3) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
48 m = arg1; |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
49 else |
8664 | 50 error ("brighten: first argument must be an Nx3 matrix or a handle"); |
6788 | 51 endif |
52 else | |
53 print_usage (); | |
54 endif | |
55 | |
8507 | 56 if (! isscalar (beta) || beta <= -1 || beta >= 1) |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
11469
diff
changeset
|
57 error ("brighten: BETA must be a scalar in the range (-1,1)"); |
6788 | 58 endif |
59 | |
60 if (beta > 0) | |
61 gamma = 1 - beta; | |
62 else | |
63 gamma = 1 / (1 + beta); | |
64 endif | |
65 | |
66 if (nargout == 0) | |
67 if (ishandle (h)) | |
68 set (h, "colormap", m .^ gamma); | |
69 else | |
70 colormap (m .^ gamma); | |
71 endif | |
72 else | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
73 rmap = m .^ gamma; |
6788 | 74 endif |
75 | |
76 endfunction |