MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_scheme.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_scheme.h
32 
33  Summary:
34  A scheme is a collection of colors that can be referenced by one or more
35  widgets. Widgets may use schemes in different ways. While the color
36  names strive to be intuitive they aren't always used in the manner in
37  which they describe.
38 *******************************************************************************/
39 
50 #ifndef LEGATO_SCHEME_H
51 #define LEGATO_SCHEME_H
52 
54 
56 
57 #ifdef __cplusplus
58  extern "C" {
59 #endif
60 
61 // *****************************************************************************
62 // *****************************************************************************
63 // Section: Data Types and Constants
64 // *****************************************************************************
65 // *****************************************************************************
66 enum leSchemeColorModes
67 {
68  LE_SCHM_COLOR_MODE_GS_8 = LE_COLOR_MODE_GS_8,
69  LE_SCHM_COLOR_MODE_RGB_332 = LE_COLOR_MODE_RGB_332,
70  LE_SCHM_COLOR_MODE_RGB_565 = LE_COLOR_MODE_RGB_565,
71  LE_SCHM_COLOR_MODE_RGBA_5551 = LE_COLOR_MODE_RGBA_5551,
72  LE_SCHM_COLOR_MODE_RGB_888 = LE_COLOR_MODE_RGB_888,
73  LE_SCHM_COLOR_MODE_RGBA_8888 = LE_COLOR_MODE_RGBA_8888,
74  LE_SCHM_COLOR_MODE_ARGB_8888 = LE_COLOR_MODE_ARGB_8888,
75  LE_SCHM_COLOR_MODE_GLOBALPALETTE = LE_COLOR_MODE_PALETTE,
76  LE_SCHM_COLOR_MODE_MONOCHROME = LE_COLOR_MODE_MONOCHROME,
77 };
78 
79 typedef enum leSchemeColor
80 {
81  LE_SCHM_BASE,
82  LE_SCHM_HIGHLIGHT,
83  LE_SCHM_HIGHLIGHTLIGHT,
84  LE_SCHM_SHADOW,
85  LE_SCHM_SHADOWDARK,
86  LE_SCHM_FOREGROUND,
87  LE_SCHM_FOREGROUND_INACTIVE,
88  LE_SCHM_FOREGROUND_DISABLED,
89  LE_SCHM_BACKGROUND,
90  LE_SCHM_BACKGROUND_INACTIVE,
91  LE_SCHM_BACKGROUND_DISABLED,
92  LE_SCHM_TEXT,
93  LE_SCHM_TEXT_HIGHLIGHT,
94  LE_SCHM_TEXT_HIGHLIGHTTEXT,
95  LE_SCHM_TEXT_INACTIVE,
96  LE_SCHM_TEXT_DISABLED
97 } leSchemeColor;
98 
99 #define LE_SCHEME_COLOR_COUNT 16
100 #define LE_SCHEME_COLOR_MODE_COUNT LE_COLOR_MODE_COUNT
101 
102 /*
103  Union:
104  leSchemeColorTable
105 
106  Summary:
107  This union specifies a list of scheme colors for a given color mode.
108 
109  Description:
110  This union specifies a list of scheme colors for a given color mode.
111 
112  Remarks:
113  None.
114  */
115 typedef union leSchemeColorTable
116 {
117  struct
118  {
119  leColor base;
120  leColor highlight;
121  leColor highlightLight;
122  leColor shadow;
123  leColor shadowDark;
124  leColor foreground;
125  leColor foregroundInactive;
126  leColor foregroundDisabled;
127  leColor background;
128  leColor backgroundInactive;
129  leColor backgroundDisabled;
130  leColor text;
131  leColor textHighlight;
132  leColor textHighlightText;
133  leColor textInactive;
134  leColor textDisabled;
135  } colors;
136  leColor values[LE_SCHEME_COLOR_COUNT];
138 
139 /*
140  Enumeration:
141  leScheme
142 
143  Summary:
144  This structure specifies the style scheme components of an object.
145 
146  Description:
147  A scheme is a collection of colors that can be referenced by widgets
148  or other objects. While the color names strive to be intuitive they
149  aren't always used in the manner in which they describe.
150 
151  Remarks:
152  None.
153  */
154 typedef struct leScheme
155 {
156  leSchemeColorTable tables[LE_SCHEME_COLOR_MODE_COUNT];
157  uint32_t blendTableCount;
158  const leBlendLookupTable** blendTables;
159 } leScheme;
160 
161 extern const struct leScheme leDefaultScheme;
162 
163 // *****************************************************************************
164 // *****************************************************************************
165 // Section: Routines
166 // *****************************************************************************
167 // *****************************************************************************
168 
169 /* Function:
170  void leScheme_Initialize(leScheme* scheme)
171 
172  Summary:
173  Initialize the scheme to the default values as per the specified color mode.
174 
175  Description:
176  Initialize the scheme to the default values as per the specified color mode.
177 
178  Parameters:
179  leScheme* scheme - the scheme to modify
180 
181  Returns:
182  void
183 
184 */
196 
209 leColor leScheme_GetColor(const leScheme* schm,
210  leSchemeColor clr,
211  leColorMode mode);
212 
224 leColor leScheme_GetRenderColor(const leScheme* schm,
225  leSchemeColor clr);
226 
227 #ifdef __cplusplus
228  }
229 #endif
230 
231 #endif // LEGATO_SCHEME_H
Color definitions and functions.
Common macros and definitions used by Legato.
leColor leScheme_GetRenderColor(const leScheme *schm, leSchemeColor clr)
Gets a scheme render color for the current layer color mode.
Definition: legato_scheme.c:71
This struct represents a blend color lookup table.
Definition: legato_color.h:293
leColor leScheme_GetColor(const leScheme *schm, leSchemeColor clr, leColorMode mode)
Gets a scheme color.
Definition: legato_scheme.c:57
Definition: legato_scheme.h:115
void leScheme_Initialize(leScheme *scheme)
Initialize scheme.
Definition: legato_scheme.c:49
leColorMode
This enum represents the supported RGB color formats.
Definition: legato_color.h:148
Definition: scheme.py:1
Definition: legato_scheme.h:154