Move away from color table for low level ops
This commit is contained in:
committed by
Raphael Coeffic
parent
1fa99fdeb2
commit
f1be9157ae
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "colors.h"
|
||||
|
||||
|
||||
@@ -21,8 +21,58 @@
|
||||
#ifndef _COLORS_H_
|
||||
#define _COLORS_H_
|
||||
|
||||
#include "libopenui_config.h"
|
||||
#include "libopenui_defines.h"
|
||||
|
||||
|
||||
// TODO common code, not in target
|
||||
enum LcdColorIndex
|
||||
{
|
||||
DEFAULT_COLOR_INDEX,
|
||||
DEFAULT_BGCOLOR_INDEX,
|
||||
FOCUS_COLOR_INDEX,
|
||||
FOCUS_BGCOLOR_INDEX,
|
||||
TEXT_STATUSBAR_COLOR_INDEX,
|
||||
LINE_COLOR_INDEX,
|
||||
MENU_LINE_COLOR_INDEX = LINE_COLOR_INDEX,
|
||||
CHECKBOX_COLOR_INDEX,
|
||||
SCROLLBAR_COLOR_INDEX,
|
||||
MENU_BGCOLOR_INDEX,
|
||||
MENU_HIGHLIGHT_BGCOLOR_INDEX = MENU_BGCOLOR_INDEX,
|
||||
MENU_COLOR_INDEX,
|
||||
MENU_TITLE_DISABLE_COLOR_INDEX,
|
||||
HEADER_COLOR_INDEX,
|
||||
ALARM_COLOR_INDEX,
|
||||
HIGHLIGHT_COLOR_INDEX,
|
||||
MENU_HIGHLIGHT_COLOR_INDEX = HIGHLIGHT_COLOR_INDEX,
|
||||
TEXT_DISABLE_COLOR_INDEX,
|
||||
DISABLE_COLOR_INDEX,
|
||||
CURVE_COLOR_INDEX,
|
||||
CURVE_AXIS_COLOR_INDEX,
|
||||
CURVE_CURSOR_COLOR_INDEX,
|
||||
HEADER_BGCOLOR_INDEX,
|
||||
HEADER_ICON_BGCOLOR_INDEX,
|
||||
HEADER_CURRENT_BGCOLOR_INDEX,
|
||||
TITLE_BGCOLOR_INDEX,
|
||||
TRIM_BGCOLOR_INDEX,
|
||||
TRIM_SHADOW_COLOR_INDEX,
|
||||
MAINVIEW_PANES_COLOR_INDEX,
|
||||
MAINVIEW_GRAPHICS_COLOR_INDEX,
|
||||
OVERLAY_COLOR_INDEX,
|
||||
CUSTOM_COLOR_INDEX,
|
||||
BARGRAPH1_COLOR_INDEX,
|
||||
BARGRAPH2_COLOR_INDEX,
|
||||
BARGRAPH_BGCOLOR_INDEX,
|
||||
SCROLLBOX_COLOR_INDEX,
|
||||
TABLE_HEADER_BGCOLOR_INDEX,
|
||||
TABLE_BGCOLOR_INDEX,
|
||||
|
||||
// this one MUST be last
|
||||
LCD_COLOR_COUNT,
|
||||
};
|
||||
|
||||
//
|
||||
// Basic color definitions
|
||||
//
|
||||
#define WHITE RGB(0xFF, 0xFF, 0xFF)
|
||||
#define LIGHTWHITE RGB(238, 234, 238)
|
||||
#define BLACK RGB(0, 0, 0)
|
||||
@@ -40,6 +90,37 @@
|
||||
#define BRIGHTGREEN RGB(0, 180, 60)
|
||||
#define ORANGE RGB(229, 100, 30)
|
||||
|
||||
//
|
||||
// Indexed colors
|
||||
//
|
||||
extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
|
||||
|
||||
inline void lcdSetColor(uint16_t color)
|
||||
{
|
||||
lcdColorTable[CUSTOM_COLOR_INDEX] = color;
|
||||
}
|
||||
|
||||
#define COLOR(index) (lcdColorTable[ unsigned(index) & 0xFF ] << 16u)
|
||||
|
||||
#define DEFAULT_COLOR COLOR(DEFAULT_COLOR_INDEX)
|
||||
#define DEFAULT_BGCOLOR COLOR(DEFAULT_BGCOLOR_INDEX)
|
||||
#define FOCUS_COLOR COLOR(FOCUS_COLOR_INDEX)
|
||||
#define FOCUS_BGCOLOR COLOR(FOCUS_BGCOLOR_INDEX)
|
||||
#define DISABLE_COLOR COLOR(DISABLE_COLOR_INDEX)
|
||||
#define HIGHLIGHT_COLOR COLOR(HIGHLIGHT_COLOR_INDEX)
|
||||
#define CHECKBOX_COLOR COLOR(CHECKBOX_COLOR_INDEX)
|
||||
#define SCROLLBAR_COLOR COLOR(SCROLLBAR_COLOR_INDEX)
|
||||
#define MENU_COLOR COLOR(MENU_COLOR_INDEX)
|
||||
#define MENU_BGCOLOR COLOR(MENU_BGCOLOR_INDEX)
|
||||
#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
|
||||
#define MENU_LINE_COLOR COLOR(MENU_LINE_COLOR_INDEX)
|
||||
#define MENU_HIGHLIGHT_COLOR COLOR(MENU_HIGHLIGHT_COLOR_INDEX)
|
||||
#define MENU_HIGHLIGHT_BGCOLOR COLOR(MENU_HIGHLIGHT_BGCOLOR_INDEX)
|
||||
#define OVERLAY_COLOR COLOR(OVERLAY_COLOR_INDEX)
|
||||
#define TABLE_BGCOLOR COLOR(TABLE_BGCOLOR_INDEX)
|
||||
#define TABLE_HEADER_BGCOLOR COLOR(TABLE_HEADER_BGCOLOR_INDEX)
|
||||
#define CUSTOM_COLOR COLOR(CUSTOM_COLOR_INDEX)
|
||||
|
||||
#define TEXT_STATUSBAR_COLOR COLOR(TEXT_STATUSBAR_COLOR_INDEX)
|
||||
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
|
||||
#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
|
||||
|
||||
Reference in New Issue
Block a user