Style Schemes of Graphic Objects
Style Scheme
A style scheme is a data structure which determines how an object will be rendered on the screen. Style schemes contain all the colors, images, fonts, and text used in displaying an object. Style schemes are defined independently of objects. Upon the object’s creation, a user defined Style scheme is assigned to the object. A single style scheme may be assigned to many different objects.

Structure of a Style Scheme

The structure GFX_GOL_OBJ_SCHEME is used to hold instances of style schemes. GFX_GOL_OBJ_SCHEME is defined in GFX_GOL_SCHEME.h.

Styles schemes contain at least 16 items. Additional items will be added if Alpha Blending Defined in GFX_CONFIG.h or Gradient Color Filling Defined in GFX_CONFIG.his enabled.

When an object is displayed, elements from the style scheme are applied to object based upon the state bits of the object.

Structure
Member
Function
EmbossDkColor Dark color used for the 3-D effect of the object.
EmbossLtColor Light color used for the 3-D effect of the object.
TextColor0 Generic text colors used by the objects. Usage may vary from one object type to another
TextColor1 Generic text colors used by the objects. Usage may vary from one object type to another
TextColorDisabled Text color used when the object state bit is set to "disabled"
Color0 Generic color used to render objects. Usage may vary from one object type to another
Color1 Generic color used to render objects. Usage may vary from one object type to another
ColorDisabled Color used to render objects that are disabled
pFont Pointer to the font table used by the object
fillStyle Determines gradient type. Only used when Color Gradients are enabled
ComonBkColor Used to hide objects from view without deleting them.
ComonBkLeft Horizontal starting point of the background
ComonBkTop Vertical starting point of the background
ComonBkType Specifies the type of background to use.
*ComonBkImage pointer to an image used as the background image
EmbossSize Size of the pannel for 3-D effects. Will be set to 0 if 3D is not used.
AlphaValue Alpha value used for alpha blending, this is only available only when GFX_CONFIG_ALPHABLEND_DISABLE is NOT "commented" out in gfx_config.h
gradientStartColor Starting color for gradient color scheme. Only exists when GFX_CONFIG_GRADIENT_DISABLE is NOT "commented" out in gfx_config.h
gradientEndColor Ending color for gradient color scheme. Only exists when GFX_CONFIG_GRADIENT_DISABLE is NOT "commented" out in gfx_config.h

Default Style Scheme

If the file gfx_gol_scheme_default.c is added to a project, it will create a style scheme called GOLSchemeDefault. The default scheme will be populated with the colors defined in gfx_gol_scheme_default.c. This default scheme maybe used as is, or may be modified to meet the application needs.

Creating and Using Style Schemes

It is quite common for an application to use several different style schemes. To create a style style scheme several steps must be taken:

  1. Create an instance of the style scheme structure and give it a name.
  2. Populate the newly created structure with the desired style scheme elements.
  3. Assign the new style scheme as graphic objects are created.

For instances where only a few elements of new style scheme differ from an existing style scheme, many programmers find it more convenient to copy an existing scheme into a newly defined scheme, then edit the few different elements

Example: Creating and using a Custom Style Scheme

The following steps presume the file gfx_gol_scheme_default has been added to the project resulting in the creation of a default scheme GOLSchemeDefault

scheme-pointer.png

Create a pointer to a style scheme structure.
In this example the pointer is called MyNewScheme

scheme-copy.png

Copy the content of the exisitng default
scheme to the newly create scheme.

scheme-modify.png

Modify the contents of the scheme as needed to
meet the application requirements. For this example
several of the elements of the new scheme have
been modified.

scheme-use.png

Asssign the newly created style scheme to an object.


20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.