tsc_Color

tsc_Color is a simple struct used to define a color value in terms of transparency (alpha) and the red/green/blue components.

By default the alpha channel is set to opaque (255).  Note that some Survey Core functions currently do not use transparency and will ignore the alpha channel.

Constructors

        tsc_Color();
    tsc_Color(unsigned int red, unsigned int green, unsigned int blue);
    tsc_Color(unsigned int alpha, unsigned int red, unsigned int green, unsigned int blue);
    tsc_Color(unsigned int OxAARRGGBB);
    tsc_Color(const tsc_Color& source);

Public methods

tsc_Color GrayScale() const;
Return the gray scale equivalent color.  Transparency is left unchanged.

tsc_Color Invert() const;
Invert the color.  Transparency is left as is.

unsigned int Alpha () const;
unsigned int Red   () const;
unsigned int Green () const;
unsigned int Blue  () const;
Extracts color components.

tsc_Color    BestContrast() const;
tsc_Color    BestContrast(const tsc_Color& color1, const tsc_Color& color2) const;
Chooses a color, either between black and white or between the two colours provided, that gives best contrast to the class color.  Grayscale comparison is used.

tsc_Color ClosestColorByLuminence(const tsc_Color& color1, const tsc_Color& color2) const;
Chooses a color from the two supplied colors that is closest by luminence to the instance color.

bool  IsEmpty();
Determine if the the colour is the empty value.

unsigned int ColorRef();
Get the Survey Core color value.  Note that this is suitable for use by Survey Core but is not a true Windows COLORREF.  Mask (&) with 0x00FFFFFF to convert it into a true COLORREF value.

tsc_Color FromColorRef(unsigned int Ox00BBGGRR);
Creates a tsc_Color from a Windows COLORREF value:

Methods for Known colors

static tsc_Color GetDefaultControlForeground();
static tsc_Color GetDefaultControlBackground();
static tsc_Color GetDefaultFormBackground();
static tsc_Color Empty();

Official Trimble Colors

This class also exposes the official Trimble colors.  We encourage you to use these colors where possible.