7017
|
1 ## Copyright (C) 2005, 2007 John W. Eaton |
6807
|
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. |
6807
|
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/>. |
6807
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {} patch () |
|
21 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c}) |
|
22 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c}, @var{opts}) |
6988
|
23 ## @deftypefnx {Function File} {} patch (@var{h}, @dots{}) |
6895
|
24 ## Create patch object from @var{x} and @var{y} with color @var{c} and |
|
25 ## insert in the current axes object. Return handle to patch object. |
|
26 ## |
|
27 ## For a uniform colored patch, @var{c} can be given as an RGB vector, |
|
28 ## scalar value referring to the current colormap, or string value (for |
|
29 ## example, "r" or "red"). |
6807
|
30 ## @end deftypefn |
|
31 |
|
32 ## Author: jwe |
|
33 |
|
34 function h = patch (varargin) |
|
35 |
6988
|
36 if (isscalar (varargin{1}) && ishandle (varargin{1})) |
|
37 h = varargin {1}; |
|
38 if (! strcmp (get (h, "type"), "axes")) |
|
39 error ("patch: expecting first argument to be an axes object"); |
|
40 endif |
|
41 oldh = gca (); |
|
42 unwind_protect |
|
43 axes (h); |
|
44 tmp = __patch__ (h, varargin{:}); |
|
45 unwind_protect_cleanup |
|
46 axes (oldh); |
|
47 end_unwind_protect |
|
48 else |
|
49 tmp = __patch__ (gca (), varargin{:}); |
|
50 endif |
6807
|
51 |
|
52 if (nargout > 0) |
|
53 h = tmp; |
|
54 endif |
|
55 |
|
56 endfunction |