TkGS Specification - Drawing primitives: Lines and shapes

Introduction

TkGS defines a set of lines and shapes drawing primitives that can be invoked on any drawable, thus providing device independence. These primitives use the current drawing state held by the TkGS_Drawable on which they are invoked, in a state-based manner (like on Windows and contrary to X-Window where one must pass a valid GC to each drawing primitive).

Functions


TkGS_DrawPoint
Description
This function is used to draw a point on the specified TkGS_Drawable. The size of the point is device-dependent (eg. 1/72in on a screen, one plot on a plotter) and corresponds to the smallest drawable element.
Status
Specification complete. Not yet implemented.
Declaration
void TkGS_DrawPoint(
    TkGS_Drawable d,
    int           x,
    int           y
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
x, y: x and y coordinates of point.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawArc
Description
This function is used to draw an arc on the specified TkGS_Drawable. The arc can be empty or filled.
Status
Specification may change (eg. angles). Not yet implemented.
Declaration
void TkGS_DrawArc(
    TkGS_Drawable d,
    int           filled,
    int           x,
    int           y,
    int           width,
    int           height,
    int           start,
    int           extent
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
x, y: x and y coordinates of top-left corner of bounding box.
width, height: width and height of bounding box.
start, extent: starting angle and extent in trigonometric (counter-clockwise) order, in 1/64th degrees.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawLine
Description
This function is used to draw a line on the specified TkGS_Drawable.
Status
Specification complete. Not yet implemented.
Declaration
void TkGS_DrawLine(
    TkGS_Drawable d,
    int           x1,
    int           y1,
    int           x2,
    int           y2
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
x1, y1: x and y coordinates of start point.
x2, y2: x and y coordinates of end point.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawEllipse
Description
This function is used to draw an ellipse on the specified TkGS_Drawable. The ellipse can be empty or filled.
Status
Specification complete. Currently implemented as a macro that calls device-specific proc.
Declaration
void TkGS_DrawEllipse(
    TkGS_Drawable d,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
x, y: x and y coordinates of top-left corner of bounding box.
width, height: width and height of bounding box.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawEllipses
Description
This function is similar to TkGS_DrawEllipse except that it draws several ellipses at once.
Status
Specification complete. Currently implemented as a macro that calls device-specific proc.
Declaration
void TkGS_DrawEllipses(
    TkGS_Drawable   d,
    int             filled,
    int             nbEllipses,
    TkGS_Rectangle* ellipses
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
nbEllipses: number of ellipses to draw.
ellipses: array of TkGS_Rectangles containing the coordinates of nbEllipses ellipses (actually, the coordinates of their bounding boxes).
Returned value
None.
Side effects
The primitives are drawn on d.

TkGS_DrawPolygon
Description
This function is used to draw a polygon on the specified TkGS_Drawable. The polygon can be empty or filled.
Status
Specification complete. Not yet implemented.
Declaration
void TkGS_DrawPolygon(
    TkGS_Drawable d,
    int           filled,
    TkGS_Point*   points,
    int           nbPoints
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
points: array of TkGS_Points defining the polygon vertices.
nbPoints: number of points in the above array.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawPolyline
Description
This function is used to draw a polyline on the specified TkGS_Drawable.
Status
Specification complete. Not yet implemented.
Declaration
void TkGS_DrawPolyline(
    TkGS_Drawable d,
    TkGS_Point*   points
    int           nbPoints
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
points: array of TkGS_Points defining the polyline vertices.
nbPoints: number of points in the above array.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawRectangle
Description
This function is used to draw a rectangle on the specified TkGS_Drawable. The rectangle can be empty or filled.
Status
Specification complete. Currently implemented as a macro that calls device-specific proc.
Declaration
void TkGS_DrawRectangle(
    TkGS_Drawable d,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
x, y: x and y coordinates of top-left corner of bounding box.
width, height: width and height of bounding box.
Returned value
None.
Side effects
The primitive is drawn on d.

TkGS_DrawRectangles
Description
This function is similar to TkGS_DrawRectangle except that it draws several rectangles at once.
Status
Specification complete. Currently implemented as a macro that calls device-specific proc.
Declaration
void TkGS_DrawRectangles(
    TkGS_Drawable   d,
    int             filled,
    int             nbRectangles,
    TkGS_Rectangle* rectangles
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
nbRectangles: number of rectangles to draw.
rectangles: array of TkGS_Rectangles containing the coordinates of nbRectangles rectangles.
Returned value
None.
Side effects
The primitives are drawn on d.

TkGS_DrawRoundedRectangle
Description
This function is used to draw a rounded rectangle on the specified TkGS_Drawable. The rounded rectangle can be empty or filled.
Status
Specification complete. Not yet implemented.
Declaration
void TkGS_DrawRoundedRectangle(
    TkGS_Drawable d,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height,
    int           rx,
    int           ry
);
Arguments
d: the TkGS_Drawable on which to draw the primitive.
filled: whether the primitive should be filled or not.
x, y: x and y coordinates of top-left corner of bounding box.
width, height: width and height of bounding box.
rx, ry: x and y radii of the ellipse used to draw the rounded corners.
Returned value
None.
Side effects
The primitive is drawn on d.

TODO