7110
|
1 ## Copyright (C) 2006, 2007 Kai Habel |
7109
|
2 ## |
7164
|
3 ## This file is part of Octave. |
|
4 ## |
7109
|
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 |
7164
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
7109
|
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 |
7164
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
7109
|
18 |
|
19 ## -*- texinfo -*- |
7122
|
20 ## @deftypefn {Function File} {} shading (@var{type}) |
|
21 ## @deftypefnx {Function File} {} shading (@var{ax}, @dots{}) |
|
22 ## Set the shading of surface or patch graphic objects. Valid arguments |
|
23 ## for @var{type} are @code{"flat"}, @code{"interp"}, or |
|
24 ## @code{"faceted"}. If @var{ax} is given the shading is applied to |
|
25 ## axis @var{ax} instead of the current axis. |
7109
|
26 ## @end deftypefn |
|
27 |
7110
|
28 ## Author: Kai Habel <kai.habel@gmx.de> |
|
29 |
7249
|
30 ## PKG_ADD: mark_as_command shading |
7109
|
31 |
7249
|
32 function shading (varargin) |
|
33 |
|
34 [ax, varargin] = __plt_get_axis_arg__ ("shading", varargin{:}); |
7109
|
35 |
7110
|
36 if (nargin != 1 && nargin != 2) |
|
37 print_usage (); |
|
38 endif |
7109
|
39 |
7249
|
40 mode = varargin{1}; |
|
41 |
7110
|
42 h1 = findobj (ax, "type", "patch"); |
|
43 h2 = findobj (ax, "type", "surface"); |
|
44 |
7249
|
45 obj = [h1(:); h2(:)]; |
7110
|
46 |
|
47 for n = 1:numel(obj) |
7109
|
48 h = obj(n); |
7110
|
49 if (strcmp (mode, "flat")) |
|
50 set (h, "facecolor", "flat"); |
|
51 set (h, "edgecolor", "none"); |
|
52 elseif (strcmp (mode, "interp")) |
|
53 set (h, "facecolor", "interp"); |
|
54 set (h, "edgecolor", "none"); |
|
55 elseif (strcmp (mode, "faceted")) |
|
56 set (h, "facecolor", "flat"); |
|
57 set (h, "edgecolor", [0 0 0]); |
7109
|
58 else |
7110
|
59 error ("unknown argument"); |
7109
|
60 endif |
|
61 endfor |
7110
|
62 |
7109
|
63 endfunction |