Style Scheme

Microchip Graphics Library

Microchip Graphics Library
Style Scheme

All objects uses a style scheme structure that defines the font and colors used. Upon the object’s creation a user defined style scheme can be assigned to the object. In the absence of the user defined scheme, the default scheme is used.

    typedef struct {
        WORD               EmbossDkColor;
        WORD               EmbossLtColor;
        WORD               TextColor0;
        WORD               TextColor1;
        WORD               TextColorDisabled;
        WORD               Color0;
        WORD               Color1;
        WORD               ColorDisabled;
        WORD               CommonBkColor;
        BYTE               *pFont;
        BYTE               AlphaValue;
        GFX_GRADIENT_STYLE gradientScheme;
    } GOL_SCHEME;

 

Field 
Description 
EmbossDkColor 
Dark emboss color used for the 3-D effect of the object. 
EmbossLtColor 
Light emboss color used for the 3-D effect of the object. 
TextColor0
TextColor1 
Generic text colors used by the objects. Usage may vary from one object type to another. 
TextColorDisabled 
Text color used for objects that are disabled. 
Color0
Color1 
Generic colors used to render objects. Usage may vary from one object type to another. 
ColorDisabled 
Color used to render objects that are disabled. 
CommonBkColor 
A common background color of objects. Typically used to hide objects from the screen. 
pFont 
Pointer to the font table used by the object. 
AlphaValue 
Alpha value used for alpha blending, this is only available only when USE_ALPHABLEND is defined in the GraphicsConfig.h. 
gradientScheme 
Gradient Scheme for supported widgets, this is available only when USE_GRADIENT is defined in the GraphicsConfig.h. 

TextColorDisabled and ColorDisabled are used when the object is in the disabled state. Otherwise, TextColor0, TextColor1, Color0 and Color1 are used. When object Draw state is set to HIDE, the CommonBkColor is used to fill area occupied by object. 

Style scheme can be created with GOLCreateScheme() function that returns a pointer to the newly created GOL_SCHEME structure with default values automatically assigned. The default settings of the style scheme for a 16bpp setup are shown below:

Style Parameter 
Default Value 
EmbossDkColor 
EMBOSSDKCOLORDEFAULT 
EmbossLtColor 
EMBOSSLTCOLORDEFAULT 
Textcolor0 
TEXTCOLOR0DEFAULT 
Textcolor1 
TEXTCOLOR1DEFAULT 
TextColorDisabled 
TEXTCOLORDISABLEDDEFAULT 
Color0 
COLOR0DEFAULT 
Color1 
COLOR1DEFAULT 
ColorDisabled 
COLORDISABLEDDEFAULT 
CommonBkColor 
COMMONBACKGROUNDCOLORDEFAULT 
pFont 
AlphaValue 
gradientScheme 
{ GRAD_NONE, RGBConvert(0xA9, 0xDB, 0xEF), RGBConvert(0x26, 0xC7, 0xF2), 50 } 

The default values can be changed in the GOLSchemeDefault.c file. 

 

The application code can define its own default style scheme by defining the macro GFX_SCHEMEDEFAULT in the GraphicsConfig.h. 

Then GOL_SCHEME GOLSchemeDefault must be defined in the application code with each structure member initialized to the desired values. See GOLSchemeDefault.c file for an example on how to initialize the style scheme.

Functions
 
Name 
Description 
 
This function creates a new style scheme object and initializes the parameters to default values. Default values are based on the GOLSchemeDefault defined in GOLSchemeDefault.c file. Application code can override this initialization, See GOLSchemeDefault
Macros
Name 
Description 
This macro sets the GOL scheme to be used for the object. 
This macro gets the GOL scheme used by the given object. 
This macro returns the default GOL scheme pointer. 
This option defines the 3-D effect emboss size for objects. The default value of this is 3 set in GOL.h. If it is not defined in GraphicsConfig.h file then the default value is used. 
This macro converts the color data to the selected COLOR_DEPTH. This macro is only valid when COLOR_DEPTH is 8, 16, or 24.
 
Structures
Name 
Description 
GOL scheme defines the style scheme to be used by an object. 
Topics
Name 
Description 
Lists the default settings for the style scheme. 
Variables
Name 
Description 
This is variable GOLFontDefault. 
This defines a default GOL scheme that gets populated when an application calls the GOLCreateScheme(). The application can override this definition by defining the macro GFX_SCHEMEDEFAULT in the GraphicsConfig.h header file and defining GOLSchemeDefault structure in the application code. It is important to use the same structure name since the library assumes that this object exists and assigns the default style scheme pointer to this object. 
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved