TkGS Specification - Internals: Drawables

Introduction

From a user's point of view, drawables are defined as TkGS_Drawables, which are opaque tokens. Internally, drawables are defined by the TkGS_Drawable_ structure (notice the trailing underscore). This structure is a "subclass" (using OOP terminology) of the more generic TkGS_Obj structure.

Structures


TkGS_Drawable_
Description
This structure is a "subclass" of the TkGS_Obj generic structure. Thus, its first member, header, contains a TkGS_Obj in order for a TkGS_Drawable_ to be used by generic object code.
It first store information about the device to which the drawable belongs so as for TkGS to reroute calls properly. The gc field is used to store drawing state information.
Status
Internal use only. Not much likely to change.
Structure
typedef struct TkGS_Drawable_ {
    TkGS_Obj    header;		/* Must be first */

    TkGS_Device	device;		/* Device to which the drawable belongs */
    TkGS_GC	gc;		/* Current drawing state as a GC */
} TkGS_Drawable_;

Accessors


TkGSDrawable_Device
TkGSDrawable_GC
Description
Gives read/write access to the device and gc field of the TkGS_Drawable_ structure.
Status
Internal use only. Unlikely to change.
Declaration
#define TkGSDrawable_Device(objPtr) \
    (((TkGS_Drawable_*)objPtr)->device)
#define TkGSDrawable_GC(objPtr) \
    (((TkGS_Drawable_*)objPtr)->gc)
Arguments
The object to access.

Functions


TkGSNewDrawable
Description
Allocate a new TkGS_Drawable_ on the given device.
Status
Internal use only. Unlikely to change.
Declaration
TkGS_Drawable_ * TkGSNewDrawable(
    TkGS_Device device
);
Arguments
device: the device on which to allocate the drawable. This device will be returned by subsequent calls to TkGS_GetDrawableDev ice
Returned value
A pointer to a newly allocated TkGS_Drawable_.
Side effects
A new object is allocated.

TkGS_GetDrawableBaseType
Description
Return a pointer to the drawable object base type. This is intended to be used by device drivers for creating new device-specific drawable types.
Status
Complete.
Declaration
TkGS_BaseType* TkGS_GetDrawableBaseType();
Arguments
None.
Returned value
A pointer to the drawable base type.
Side effects
None.

TODO