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
instroke (Point p) typedict.Path
instroke (Number x, Number y)  
 
Returns non-zero if p or the point (x, y) would be painted if this path were stroked using CTM, linecap, linejoin, linewidth, and miterlimit that are defined in this path. The default values assigned to these fields in a Path match the defaults assigned to the same fields in a Graphics.
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    Graphics graphics = {
        double linewidth = 20.0;
        int    linecap = CAP_ROUND;
    };

    paint() {
        graphics {
            if (currentpoint() == NULL) {
                translate(72, 144);
                rotate(-45);
                scale(.5, .5);
                shear(0, .5);
                arc(144, 144, 144, 0, 180);
            }
            gsave();
            stroke();
            grestore();
         }
    }

    mousePressed(MouseEvent e) {
        graphics.path.linewidth = graphics.linewidth;
        graphics.path.linecap = graphics.linecap;
        graphics.path.linejoin = graphics.linejoin;
        graphics.path.miterlimit = graphics.miterlimit;
        printf("hit=%d\n", graphics.path.instroke(e.coordinates));
    }
};

frame.visible = TRUE;
defines a paint function in a frame that strokes an arc in a transformed coordinate system and then uses the instroke built-in defined in graphics.path to decide if a button was pressed when the cursor was inside the stroked path. Obviously mousePressed would have been simpler if we used the instroke built-in defined in frame.graphics, but in this case we wanted to illustrate the instroke built-in defined in a Path. Notice that we used e.coordinates rather than e.location in the event handler. Both values are defined and can be identical, but e.location always represents the location of the event in the Yoix default coordinate system, while e.coordinates are the user space coordinates of the event in the frame, which depend on the values stored in CTM when the event arrives.
 
 Return:   int
 
 See Also:   eointersects, ineofill, infill, intersects

 

Yoix is a registered trademark of AT&T Inc.