1## Copyright (C) 2007, 2008, 2009 David Bateman
3## This file is part of Octave.
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
7## the Free Software Foundation; either version 3 of the License, or (at
8## your option) any later version.
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.
15## You should have received a copy of the GNU General Public License
16## along with Octave; see the file COPYING. If not, see
17## <http://www.gnu.org/licenses/>.
20## @deftypefn {Function File} {} fill (@var{x}, @var{y}, @var{c})
21## @deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
22## @deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
23## @deftypefnx {Function File} {} fill (@var{h}, @dots{})
24## @deftypefnx {Function File} {@var{h} =} fill (@dots{})
25## Create one or more filled patch objects, returning a patch object for each.
28function retval = fill (varargin)
30 [h, varargin] = __plt_get_axis_arg__ ("fill", varargin{:});
33 iargs = __find_patches__ (varargin{:});
39 for i = 1 : length (iargs)
40 if (i == length (iargs))
41 args = varargin (iargs(i):end);
43 args = varargin (iargs(i):iargs(i+1)-1);
46 [tmp, fail] = __patch__ (h, args{:});
52 unwind_protect_cleanup
62function iargs = __find_patches__ (varargin)
67 if (ischar (varargin{i})
68 && (strcmpi (varargin{i}, "faces")
69 || strcmpi (varargin{i}, "vertices")))
71 elseif (isnumeric (varargin{i}))
77 if (ischar (varargin{i}) &&
78 (strcmpi (varargin{i}, "faces")
79 || strcmpi (varargin{i}, "vertices")))
81 elseif (isnumeric (varargin{i}))
82 ## Assume its the colorspec
85 elseif (ischar (varargin{i}))
86 colspec = tolower (varargin{i});
87 collen = length (colspec);
89 if (strncmp (colspec, "blue", collen)
90 || strncmp (colspec, "black", collen)
91 || strncmp (colspec, "k", collen)
92 || strncmp (colspec, "black", collen)
93 || strncmp (colspec, "red", collen)
94 || strncmp (colspec, "green", collen)
95 || strncmp (colspec, "yellow", collen)
96 || strncmp (colspec, "magenta", collen)
97 || strncmp (colspec, "cyan", collen)
98 || strncmp (colspec, "white", collen))
112%! t1 = (1/16:1/8:1)'*2*pi;
113%! t2 = ((1/16:1/8:1)' + 1/32)*2*pi;
114%! x1 = sin(t1) - 0.8;
116%! x2 = sin(t2) + 0.8;
118%! h = fill(x1,y1,'r',x2,y2,'g');