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.Graphics
instroke (Number x, Number y)  
 
Returns non-zero if p or the point (x, y) would be painted if the current path were stroked using the values currently assigned to linewidth, linecap, linejoin, miterlimit, dasharray, dashphase, and CTM.
 
 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) {
        printf("hit=%d\n", graphics.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 instroke in to decide if a button was pressed when the cursor was inside the stroked 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:   clip, clippath, drawablebbox, eoclip, eoerase, eofill, erase, erasedrawable, fill, ineofill, infill, rectbutton, rectclip, rectcopy, recterase, rectfill, rectmove, rectstroke, stroke, strokepath

 

Yoix is a registered trademark of AT&T Inc.