home *** CD-ROM | disk | FTP | other *** search
-
- #import "Line.h"
-
- @implementation Line
-
- - setStart:(NXPoint *)s end:(NXPoint *)e
- {
- start.x = s->x;
- start.y = s->y;
- end.x = e->x;
- end.y = e->y;
- return self;
- }
-
- - render
- {
- PSmoveto(start.x, start.y);
- PSlineto(end.x, end.y);
- PSstroke();
- return self;
- }
-
- - renderIfInRect:(const NXRect *)aRect
- {
- NXRect tempRect = { { MIN(start.x, end.x), MIN(start.y, end.y) },
- { ABS(start.x-end.x), ABS(start.y-end.y) } };
- if (NXIntersectsRect(aRect, &tempRect)) {
- [self render];
- }
- return self;
- }
-
- @end
-