Setting brush foreground and background colours

SetBrushColor()

Set brush foreground and background colours


SYNTAX

SetBrushColor(window_id, foreground_rgb_value, background_rgb_value)

Set the foreground and background colour for the brush. The RGB colour definitions are in the standard include file rgb.h.

The colours are both used for all brush types except DB_NULL, DB_BITMAP and DB_SOLID. If DB_BITMAP has been selected, the function is ignored. If DB_SOLID has been selected, only the foreground part of the colour is taken into account. Brush type is set by means of the SetBrushType() function.

DB_NULL

The default brush type. If this is set, figures are not filled in (i.e. the brush is not used).

DB_SOLID

Only the foreground colour is relevant. Figures are filled with this colour.

DB_BITMAP

The SetBrushColor function is is ignored if this brush type is set.

The brush colours remain set until the EndPaint() function is called.

The default foreground colour is black.

NOTES

  • If the Sculptor system variable sys.DrawTextMode is assigned the value TRANSPARENT, line graphics and text are drawn on top of the existing background, ignoring the background colour set by SetBrushColor.

  • The variable sys.DrawGraphicMode can be assigned a number of different values causing a graphic to be combined with the current background and the current brush in a variety of ways.


EXAMPLE

Set the brush to crossed, diagonal blue lines on a background of cornsilk:

SetBrushType(Window3, dB_FDIAGONAL)
SetBrushColor(Window3, RGB_MIDNIGHTBLUE, RGB_CORNSILK)

Previous syntax

This syntax for SetBrushColor was introduced in Sculptor V.5, along with RGB colour clauses. In previous versions the syntax was as follows:

SetBrushColor(window_id, foreground | background)

The only available colours are those defined with FORE_ and BACK_ prefixes in $SCULPTOR/include/draw.h.

The foreground and background colours must be combined into a single expression, the foreground colour appearing first and the two colours being separated by the | character.

This syntax should be regarded as obsolescent.


RELATED TOPICS

Drawing operations

Draw functions

SetBrushType()