📄 sma_colors.h
字号:
/***********************************************************************
* $Workfile: SMA_colors.h $
* $Revision: 1.1 $
* $Author: WellsK $
* $Date: Aug 30 2002 13:18:54 $
*
* Project: Color definitions
*
* Description:
* This package contains functions for color mapping, color conversion,
* and common defines.
*
* The palette table function can be configured for 555 or 565 color.
*
* Notes:
* Color entries are stored in BGR format, with blue mapped to the most
* significant bits of a color type.
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/CHIPS/archives/SOC/Source/Graphics/Utilities/Color conversion/SMA_colors.h-arc $
*
* Rev 1.1 Aug 30 2002 13:18:54 WellsK
* Corrected C/C++ wrapper.
*
* Rev 1.0 Aug 27 2002 08:37:44 WellsK
* Initial revision.
*
*
* SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
* OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
* AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
* SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
*
* SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
* FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
* SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
* FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
*
* COPYRIGHT (C) 2002 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
* CAMAS, WA
**********************************************************************/
#ifndef COLORS_H
#define COLORS_H
#ifdef __cplusplus
#if __cplusplus
extern "C"
{
#endif // __cplusplus
#endif // __cplusplus
#include "SMA_types.h"
//**********************************************************************
// Default configuration values
//**********************************************************************
// Pick the appropriate define for 8- or 16-bit color modes. Only ONE
// of these lines should be uncommented.
//#define COLORS_16 // 16-bit 565 color mode
#define COLORS_15 // 15-bit 555 color mode
//#define COLORS_8 // 8-bit color mode
// If COLORS_8 is used, then uncomment the following line to use 565
// output mode in the palette table, otherwise 555 mode will be used
//#define COLORS_8_565_MODE
#ifdef COLORS_16
// Colors definitions for 16-bit, 565 mode
#define BLACK 0x0000
#define LIGHTGRAY 0X7BEF
#define DARKGRAY 0x39E7
#define WHITE 0x7fff
#define RED 0xF800
#define GREEN 0x07E0
#define BLUE 0x001F
#define MAGENTA (RED | BLUE)
#define CYAN (GREEN | BLUE)
#define YELLOW (RED | GREEN)
#define LIGHTRED 0x7800
#define LIGHTGREEN 0x03E0
#define LIGHTBLUE 0x000F
#define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
#define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
#define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
// Masks and shift values for 565 mode
#define REDMASK 0xF800
#define REDSHIFT 11
#define GREENMASK 0x07E0
#define GREENSHIFT 5
#define BLUEMASK 0x001F
#define BLUESHIFT 0
// Number of colors
#define NUM_COLORS 65536
#define RED_COLORS 0x20
#define GREEN_COLORS 0x40
#define BLUE_COLORS 0x20
typedef UNS_16 color_type;
#else
#ifdef COLORS_15
// Colors definitions for 15-bit, 555 mode
#define BLACK 0x0000
#define LIGHTGRAY 0x3DEF
#define DARKGRAY 0x1CE7
#define WHITE 0x7fff
#define RED 0x7C00
#define GREEN 0x03E0
#define BLUE 0x001F
#define MAGENTA (RED | BLUE)
#define CYAN (GREEN | BLUE)
#define YELLOW (RED | GREEN)
#define LIGHTRED 0x3C00
#define LIGHTGREEN 0x01E0
#define LIGHTBLUE 0x000F
#define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
#define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
#define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
// Masks and shift values for 555 mode
#define REDMASK 0x7C00
#define REDSHIFT 10
#define GREENMASK 0x03E0
#define GREENSHIFT 5
#define BLUEMASK 0x001F
#define BLUESHIFT 0
// Number of colors
#define NUM_COLORS 32768
#define RED_COLORS 0x20
#define GREEN_COLORS 0x20
#define BLUE_COLORS 0x20
typedef UNS_16 color_type;
#else
// Colors definitions for 8-bit color mode
#define BLACK 0x00
#define LIGHTGRAY 0x6E
#define DARKGRAY 0x25
#define WHITE 0xFF
#define RED 0xE0
#define GREEN 0x1C
#define BLUE 0x03
#define MAGENTA (RED | BLUE)
#define CYAN (GREEN | BLUE)
#define YELLOW (RED | GREEN)
#define LIGHTRED 0x60
#define LIGHTGREEN 0x0C
#define LIGHTBLUE 0x01
#define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
#define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
#define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
// Masks for 8-bit mode (332 mode)
#define REDMASK 0xE0
#define REDSHIFT 5
#define GREENMASK 0x1C
#define GREENSHIFT 2
#define BLUEMASK 0x3
#define BLUESHIFT 0
// Number of colors
#define NUM_COLORS 256
#define RED_COLORS 0x08
#define GREEN_COLORS 0x08
#define BLUE_COLORS 0x04
typedef UNS_8 color_type;
#endif
#endif
//**********************************************************************
// Color configuration functions
//**********************************************************************
// Generate a palette table (only in 8-bit mode). If compiled in 16-bit
// color mode, this will be a NULL function.
void colors_set_palette (UNS_16 *palette_table);
#ifdef __cplusplus
}
#endif
#endif // COLORS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -