void drawto(drawing d); /* set drawing destination */ drawing currentdrawing(void); /* return current drawing */ void setrgb(rgb c); /* change drawing colour */ void setcolor(rgb c); void setcolour(rgb c); rgb currentrgb(void); /* find drawing colour */ rgb currentcolor(void); rgb currentcolour(void); void setlinewidth(int width); /* change line widths */ int currentlinewidth(void); /* find line width */ void setdrawmode(int mode); /* change drawing mode */ int currentmode(void); /* find drawing mode */
enum DrawingModes {
Zeros, DnorS, DandnotS, notS,
notDandS, notD, DxorS, DnandS,
DandS, DxnorS, D, DornotS,
S, notDorS, DorS, Ones
};
The drawto function is used to set which bitmap, window or control is to be the target of all drawing operations. Usually it is not necessary to use drawto, since the event mechanism guarantees that when a call-back is called, the associated window or control is made the current drawing. To find the current destination drawing, use currentdrawing.
The setrgb function sets the colour to be used by most drawing operations. The setcolor and setcolour macros are synonyms for setrgb and can be used interchangeably. The current drawing colour can be found by using the currentrgb function (or currentcolor or currentcolour).
The drawing colour is initially set to Black.
A mode of notS would copy the logical bit-wise negation of the source pixels. A mode of notD would ignore the colour of the source pixels and simply invert the colour of the destination wherever drawing occurs. Other bit-wise combinations of the source and destination are possible.
The drawing mode can be set with the setdrawmode function, and found by calling currentmode. This mode is initially set to S. This will affect all subsequent drawing by the library, including drawing text, lines and filled areas.
Note that in the above discussion, the term source can refer to either the colour used when drawing lines or actual source pixels in an off-screen bitmap or in an on-screen window or control.
The current line width determines the width of lines drawn using functions such as drawline, drawrect, drawarc etc. The setlinewidth function can change this value from its default value of one pixel. Use currentlinewidth to determine what this width currently is.