manpagez: man pages & more
info asymptote
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 fill

void fill(picture pic=currentpicture, path g, pen p=currentpen);

Fill the interior region bounded by the cyclic path g on the picture pic, using the pen p.

There is also a convenient filldraw command, which fills the path and then draws in the boundary. One can specify separate pens for each operation:

void filldraw(picture pic=currentpicture, path g, pen fillpen=currentpen,
              pen drawpen=currentpen);

This fixed-size version of fill allows one to fill an object described in PostScript coordinates about the user coordinate origin:

void fill(pair origin, picture pic=currentpicture, path g, pen p=currentpen);

This is just a convenient abbreviation for the commands:

picture opic;
fill(opic,g,p);
add(pic,opic,origin);

The routine

void filloutside(picture pic=currentpicture, path g, pen p=currentpen);

fills the region exterior to the path g, out to the current boundary of picture pic.

Lattice gradient shading varying smoothly over a two-dimensional array of pens p, using fill rule fillrule, can be produced with

void latticeshade(picture pic=currentpicture, path g, bool stroke=false,
                  pen fillrule=currentpen, pen[][] p)

If stroke=true, the region filled is the same as the region that would be drawn by draw(pic,g,fillrule+zerowinding); in this case the path g need not be cyclic. The pens in p must belong to the same color space. One can use the functions rgb(pen) or cmyk(pen) to promote pens to a higher color space, as illustrated in the example file latticeshading.asy.

Axial gradient shading varying smoothly from pena to penb in the direction of the line segment a--b can be achieved with

void axialshade(picture pic=currentpicture, path g, bool stroke=false,
                pen pena, pair a,
                pen penb, pair b);

Radial gradient shading varying smoothly from pena on the circle with center a and radius ra to penb on the circle with center b and radius rb is similar:

void radialshade(picture pic=currentpicture, path g, bool stroke=false,
                 pen pena, pair a, real ra,
                 pen penb, pair b, real rb);

Illustrations of radial shading are provided in the example files shade.asy, ring.asy, and shadestroke.asy.

Gouraud shading using fill rule fillrule and the vertex colors in the pen array p on a triangular lattice defined by the vertices z and edge flags edges is implemented with

void gouraudshade(picture pic=currentpicture, path g, bool stroke=false,
                  pen fillrule=currentpen, pen[] p, pair[] z,
                  int[] edges);
void gouraudshade(picture pic=currentpicture, path g, bool stroke=false,
                  pen fillrule=currentpen, pen[] p, int[] edges);

In the second form, the elements of z are taken to be successive nodes of path g. The pens in p must belong to the same color space. Illustrations of Gouraud shading are provided in the example file Gouraud.asy and in the solid geometry module solids.asy. The edge flags used in Gouraud shading are documented here:

http://partners.adobe.com/public/developer/en/ps/sdk/TN5600.SmoothShading.pdf.

Tensor product shading using fill rule fillrule on patches bounded by the n cyclic paths of length 4 in path array b, using the vertex colors specified in the n \times 4 pen array p and internal control points in the n \times 4 array z, is implemented with

void tensorshade(picture pic=currentpicture, path g, bool stroke=false,
                 pen fillrule=currentpen, pen[][] p, path[] b=g,
                 pair[][] z=new pair[][]);

If the array z is empty, Coons shading, in which the color control points are calculated automatically, is used. The pens in p must belong to the same color space. A simpler interface for the case of a single patch (n=1) is also available:

void tensorshade(picture pic=currentpicture, path g, bool stroke=false,
                 pen fillrule=currentpen, pen[] p, path b=g,
                 pair[] z=new pair[]);

One can also smoothly shade the regions between consecutive paths of a sequence using a given array of pens:

void draw(picture pic=currentpicture, path[] g, pen[] p);

Illustrations of tensor product and Coons shading are provided in the example files tensor.asy, Coons.asy, BezierSurface.asy, and rainbow.asy.

The following routine uses evenodd clipping together with the ^^ operator to unfill a region:

void unfill(picture pic=currentpicture, path g);

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.