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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
Graphics typedict
 
A Graphics object defines properties and a large collection of built-ins (about 100) that provide access to Java2D through a fairly simple model that resembles PostScript. In fact, the correspondence is close enough that if you know PostScript you should have no trouble understanding the Yoix model. Every Graphics is associated with a drawable object, like a Canvas, Frame, Image, or JFrame, and rendering operations, like fill or stroke, that paint pixels always apply to that drawable. The fields in a Graphics are:
antialiasing An int that determines whether antialiasing is used to smooth shapes (but not text strings) that are drawn on drawable. A value of 1 enables antialiasing, 0 disables it, and any other value, including -1 which is the default, lets Java's rendering engine pick the behavior.
appendpath A Builtin that appends a copy of another path to path.
arc A Builtin that adds an arc to path.
arcn A Builtin that adds an arc to path.
ashow A Builtin that draws the characters in a string on drawable.
awidthshow A Builtin that draws the characters in a string on drawable.
background A Color that is used in combination with foreground when an operation draws on drawable in XOR mode, which is controlled by the value assigned to xormode. In XOR mode drawing pixels that have a color of background are changed to foreground, provided it is a Color, and visa versa.
charpath A Builtin that appends the outline of the characters in a string to path.
clip A Builtin that establishes a new clipping path by intersecting path and the current clipping path.
clippath A Builtin that replaces path with the current clipping path.
closepath A Builtin that closes the current subpath in path.
compositerule An int that determines how pixels in drawable are combined with the pixels generated by rendering built-ins, like like fill, show, or stroke, to yield the final result. The value should be one of COMPOSITE_CLEAR, COMPOSITE_DST_IN, COMPOSITE_DST_OUT, COMPOSITE_DST_OVER, COMPOSITE_SRC, COMPOSITE_SRC_IN, COMPOSITE_SRC_OUT, or COMPOSITE_SRC_OVER (the default), which are all defined in yoix.graphics.
concat A Builtin that multiplies CTM by another matrix and replaces CTM by the result.
concatmatrix A Builtin that multiplies CTM by another matrix and returns the result.
CTM A Matrix that is automatically used to transform points that a Yoix program works with into points that describe a physical location in drawable. We often refer to this as a transformation from "user space" to "device space". By default CTM transforms user space coordinates into a device space coordinate system that has its origin at the upper left corner of drawable, positive x to the right, positive y down, and a resolution of 72 dots per inch.
currentmatrix A Builtin that returns a writable copy of CTM.
currentpoint A Builtin that returns the current point in path or NULL if path is empty.
curveto A Builtin that adds a Bezier cubic curve to path.
dasharray An Array of non-negative numbers that together with dashphase determine how dashes are distributed when built-ins, like stroke or strokepath, draw the current path. The numbers in dasharray are interpreted as distances in user space and used cyclically to control the distribution of dashes and gaps: the first number is the length of the first dash, the second number is the length of the first gap, and so on. Dashing is disabled when dasharray is empty or NULL.
dashphase A non-negative Number that together with dasharray determine how dashes are distributed when built-ins, like stroke or strokepath, draw the current path. The value of dashphase is interpreted as a distance in user space that determines the dasharray starting point.
dividematrix A Builtin that divides CTM by another matrix and returns the result.
drawable An Object, that represents the drawing surface that is affected when rendering built-ins like fill, show, or stroke, are called. The value assigned to drawable must be an Image, Canvas, Dialog, Frame, Panel, Window, JCanvas, JDialog, JFrame, JPanel, or JWindow.
dtransform A Builtin that transforms a displacement using CTM.
eoclip A Builtin that establishes a new clipping path by intersecting path and the current clipping path.
eoerase A Builtin that clears the interior of path on drawable.
eofill A Builtin that paints the interior of path on drawable.
erase A Builtin that clears the interior of path on drawable.
erasedrawable A Builtin that clears drawable.
fill A Builtin that paints the interior of path on drawable.
flattenpath A Builtin that changes path to one in which all curved components are replaced by sequences of line segments that approximate the curves.
font The Font, or font name if it is a String, that is used when a built-in draws a text string on drawable using this graphics object.
foreground A Color, Image, or special Array that is used to select pixel colors when an operation, like fill or stroke draws on drawable in overwrite mode. Although foreground can be set directly, most applications use built-ins, like setgray, setrgbcolor, setgradient, or settexture, to make changes.
fractionalmetrics An int that is 1 when floating point numbers are used to position the individual characters in a text string, and 0 (the default) when integers are be used.
grestore A Builtin that restores the last saved graphics state.
grestoreall A Builtin that restores the first saved graphics state.
gsave A Builtin that saves the current graphics state.
identmatrix A Builtin that replaces CTM with the identity matrix.
idtransform A Builtin that transforms a displacement using the inverse of CTM.
imagepath A Builtin that appends the outline of an image to path.
ineofill A Builtin that tests if a point lies inside path.
infill A Builtin that tests if a point lies inside path.
initclip A Builtin that clears the current clipping path.
initgraphics A Builtin that assigns default values to graphics state fields.
initmatrix A Builtin that changes CTM so it represents the default Yoix coordinate system.
instroke A Builtin that tests if a point would be painted if path were stroked.
invertmatrix A Builtin that returns the inverse of CTM.
itransform A Builtin that transforms a point using the inverse of CTM.
kshow A Builtin that draws the characters in a string on drawable.
linecap An int that determines what happens at the ends of open subpaths when built-ins, like stroke or strokepath, draw the current path. The value should be one of CAP_BUTT (the default), CAP_ROUND, or CAP_SQUARE, which are all defined in yoix.graphics.
linejoin An int that determines what happens at the joints where curves and lines join when built-ins, like stroke or strokepath, draw the current path. The value should be one of JOIN_MITER (the default), JOIN_ROUND, or JOIN_BEVEL, which are all defined in yoix.graphics.
lineto A Builtin that adds a line segment to path.
linewidth A Number that represents the thickness of lines and curves produced when built-ins, like stroke or strokepath, draw the current path. The value is always interpreted as a distance perpendicular to path in user space, which means results depend on the values stored in CTM when the built-in that uses linewidth (e.g., stroke) is called. Pixels on either side of path that lie within half a linewidth of path are painted.
miterlimit A Number that should be greater than or equal to 1 that controls the appearance of the joints produced when linejoin is set to JOIN_MITER. In particular, miter joints are truncated when the width of the joint (i.e., the distance between the inner and outer corners) divided by linewidth exceeds miterlimit.
moveto A Builtin that starts a new subpath in path.
newpath A Builtin that clears path.
path A Path that is automatically used by the built-ins defined in this graphics object that operate a path.
pathbbox A Builtin that returns a rectangle that represents the bounding box of path.
pathforall A Builtin that examines every element in path and calls functions based on the type of each element that is encountered.
quadto A Builtin that adds a quadratic curve to path.
rcurveto A Builtin that adds a Bezier cubic curve to path.
rectclip A Builtin that establishes a new clipping path by intersecting a rectangle with the current clipping path.
recterase A Builtin that clears a rectangle on drawable.
rectfill A Builtin that paints the interior of a rectangle on drawable.
rectstroke A Builtin that draws the outline of a rectangle on drawable.
rendering An int that sometimes provides limited device-dependent control over the rendering algorithm used by the Java Virtual Machine. A value of 0 means we prefer speed, a value of 1 means we prefer quality, and any other value, including -1 which is the default, means we have no preference. Nothing is guaranteed, so you should not write programs that depend on a particular setting.
rlineto A Builtin that adds a line segment to path.
rmoveto A Builtin that starts a new subpath in path.
rotate A Builtin that changes CTM so it applies a rotation about the origin to transformed points.
rotatefont A Builtin that creates a new font by rotating the characters in font.
rotatepath A Builtin that changes path by applying a rotation to every point currently stored in path.
rquadto A Builtin that adds a quadratic curve to path.
scale A Builtin that changes CTM so it applies horizontal and vertical scaling to transformed points.
scalefont A Builtin that creates a new font by scaling the characters in font.
scalepath A Builtin that changes path by applying a horizontal and vertical scaling to every point currently stored in path.
setcmykcolor A Builtin that sets foreground to a color specified by cyan, magenta, and yellow components.
setdash A Builtin that controls the appearance of dashed lines and curves by storing values in dasharray and dashphase.
setfont A Builtin that selects the font used to draw text strings on drawable.
setgradient A Builtin that sets foreground to a value that changes smoothly from one color to another along a line that connects two points.
setgray A Builtin that sets foreground to a color that represents a shade of gray.
sethsbcolor A Builtin that sets foreground to a color specified by hue, saturation, and brightness components.
setlinecap A Builtin that affects the appearance of stroked paths by storing a value in linecap.
setlinejoin A Builtin that affects the appearance of stroked paths by storing a value in linejoin.
setlinewidth A Builtin that affects the appearance of stroked paths by storing a value in linewidth.
setmatrix A Builtin that replaces CTM with a copy of another matrix.
setmiterlimit A Builtin that affects the appearance of stroked paths by storing a value in miterlimit.
setpath A Builtin that replaces path with a copy of another path.
setrgbcolor A Builtin that sets foreground to a color specified by red, green, and blue components.
settexture A Builtin that sets foreground to a value that uses an image to select pixel colors.
shear A Builtin that changes CTM so it applies horizontal and vertical shearing to transformed points.
shearfont A Builtin that creates a new font by shearing the characters in font.
shearpath A Builtin that changes path by applying a horizontal and vertical shearing to every point currently stored in path.
show A Builtin that draws the characters in a string on drawable.
showimage A Builtin that draws an image on drawable.
stringadvance A Builtin that calculates how far the current point would move horizontally and vertically after a string is drawn.
stringbounds A Builtin that tries to return a rectangle that covers a string if it were drawn at the origin.
stringwidth A Builtin that calculates how far the current point would move horizontally after a string is drawn.
stroke A Builtin that draws the outline of path on drawable.
strokepath A Builtin that replaces path with an outline that can be filled to reproduce what stroke would draw using the original path.
textantialiasing An int that determines whether antialiasing is used smooth the shapes produced when character outlines are processed by the rendering engine and drawn on drawable. A value of 1 enables antialiasing, 0 disables it, and any other value, including -1 which is the default, lets Java's rendering engine pick the behavior.
transform A Builtin that transforms a point using CTM.
transformfont A Builtin that creates a new font by applying an affine transformation to the characters in font.
transformpath A Builtin that changes path by applying an affine transformation to every point currently stored in path.
translate A Builtin that changes CTM so it applies horizontal and vertical translation to transformed points.
translatefont A Builtin that creates a new font by translating the characters in font.
translatepath A Builtin that changes path by applying a horizontal and vertical translation to every point currently stored in path.
widthshow A Builtin that draws the characters in a string on drawable.
xormode An int that forces all subsequent drawing operations to be done in XOR mode when it is non-zero and in overwrite mode (the default) otherwise. When XOR mode is enabled, pixels that have a color of background are changed to foreground, provided it is a Color, and visa versa; all other color changes are unpredictable, but drawing the same figure twice restores pixels to their original values.
Any permanent fields that have not been documented should not be referenced in Yoix applications. We also strongly recommend that new applications draw using Graphics objects, rather than relying on the yoix.graphics built-ins that were provided in older releases.
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    Color background = Color.gray;

    paint(Rectangle r) {
        graphics {        // "named block"
            gsave();
            rectclip(r);
            translate(72, 72);
            scale(1.5, 2.25);
            rotate(-30);

            moveto(0, 0);
            curveto(100, 0, 100, 100, 0, 100);
            lineto(0, 100);
            closepath();
            moveto(20, 80);
            curveto(70, 80, 70, 20, 20, 20);
            closepath();

            setgray(.9);
            fill();
            grestore();
        }
    }
};

f.visible = TRUE;
defines a paint function in frame that builds and then fills a simple path.
 
 See Also:   Canvas, clearRect, copyArea, Dialog, drawArc, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, Frame, Image, JCanvas, JDialog, JFrame, JPanel, JWindow, Matrix, Panel, Path, stringWidth, Window

 

Yoix is a registered trademark of AT&T Intellectual Property.