AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
subtract (Object rhs [, int rule]) typedict.Path
 
Subtracts the area covered by rhs, which must be a Path, Rectangle, or NULL, from the area covered by this path, replaces this path by a new one whose interior represents the result, and returns this path to the caller. By default, interior points in both paths are identified using the non-zero winding rule, but setting the optional rule argument to WIND_EVEN_ODD, which is defined in yoix.graphics, means the even-odd winding rule will be used to identify the interior of rhs.
 
 Example:   The program,
import yoix.*.*;

Path p1;
Path p2;
Path p3;

p2 {         // "named block"
    moveto(72, 72);
    rlineto(72, 0);
    rlineto(0, 72);
    closepath();
};

p3 {         // "named block"
    moveto(144 - 18, 72 + 18);
    rlineto(72, 0);
    rlineto(0, 72);
    closepath();
};

p1.add(p2).subtract(p3);

JFrame f = {
    paint(Rectangle rect) {
        graphics {         // "named block"
            setpath(p1);
            setrgbcolor(0, 0, 1);
            fill();
            setpath(p1);
            setrgbcolor(1, 0, 0);
            stroke();
        }
    }
};

f.visible = TRUE;
uses add and subtract to build a new path from separate triangular paths and displays the result in a frame that defines a paint function that fills and strokes the new path.
 
 Return:   Path
 
 See Also:   add, eoadd, eointersect, eosubtract, eoxor, intersect, xor

 

Yoix is a registered trademark of AT&T Inc.