608
Appendix A: System Routines — Graphing
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
GrClipLine
(continued)
Example:
This example is the TI
-
BASIC Line command. It draws a line (coordinates:
L1, L2, L3, L4) on the current graph using attribute newAttr. The source for
the helper routine, GetAttr, is listed in the example for
GraphActivate
.
GrClipLine
is used to clip the given floating point coordinates to the current
graph window.
void cmd_line (EStackIndex L1, EStackIndex L2, EStackIndex L3,
EStackIndex L4, EStackIndex newAttr)
{
Access_AMS_Global_Variables;
BYTE OrigAttr;
BCD16 x1, y1, x2, y2;
if (GraphActivate(TRUE)) {
OrigAttr = WinAttr(gr_active->grwinp, GetAttr(newAttr) );
if (GrClipLine( ForceFloat(L1), ForceFloat(L2),
ForceFloat(L3), ForceFloat(L4),
&x1, &y1, &x2, &y2, gr_active))
WinLine( gr_active->grwinp, MakeWinRect(
XCvtFtoP(x1,gr_active), YCvtFtoP(y1,gr_active),
XCvtFtoP(x2,gr_active), YCvtFtoP(y2,gr_active)));
WinAttr( gr_active->grwinp, OrigAttr );
}
}