TkGS Specification - Drawing primitives

TkGS Specification - Drawing primitives

Introduction

TkGS defines a set of 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_DrawPixel
Description
This function is used to draw a pixel on the specified TkGS_Drawable. The size of the pixel 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_DrawPixel(
    TkGS_Drawable drawable,
    int           x,
    int           y
);
Arguments
drawable: the TkGS_Drawable on which to draw the primitive.
x, y: x and y coordinates of pixel.
Returned value
None.
Side effects
The primitive is drawn on drawable.

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 drawable,
    int           filled,
    int           x,
    int           y,
    int           width,
    int           height,
    int           start,
    int           extent
);
Arguments
drawable: 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 drawable.

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 drawable,
    int           x1,
    int           y1,
    int           x2,
    int           y2
);
Arguments
drawable: 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 drawable.

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 drawable,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height
);
Arguments
drawable: 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 drawable.

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 drawable,
    int           filled,
    TkGS_Point*   points,
    int           nbPoints
);
Arguments
drawable: 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 drawable.

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 drawable,
    TkGS_Point*   points
    int           nbPoints
);
Arguments
drawable: 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 drawable.

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 drawable,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height
);
Arguments
drawable: 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 drawable.

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 drawable,
    int           filled,
    int           x,
    int           y,
    unsigned int  width,
    unsigned int  height,
    int           rx,
    int           ry
);
Arguments
drawable: 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 drawable.

TODO