📄 screen.h
字号:
/******************************************************************************
**
** COPYRIGHT (C) 2000, 2001 Intel Corporation.
**
** This software as well as the software described in it is furnished under
** license and may only be used or copied in accordance with the terms of the
** license. The information in this file is furnished for informational use
** only, is subject to change without notice, and should not be construed as
** a commitment by Intel Corporation. Intel Corporation assumes no
** responsibility or liability for any errors or inaccuracies that may appear
** in this document or any software that may be provided in association with
** this document.
** Except as permitted by such license, no part of this document may be
** reproduced, stored in a retrieval system, or transmitted in any form or by
** any means without the express written consent of Intel Corporation.
**
** FILENAME: screen.h
**
** PURPOSE: Header file to describe the Screen context structure
**
** LAST MODIFIED: 01/19/2001
******************************************************************************/
#ifndef _screen_h
#define _screen_h
/* NTSC color space is YUYV 4:2:2 format. The U,V data is shared between two
* adjacent Y samples and therefore often needs to be set two pixels at a time
* in the horizontal direction. Vertical direction is not affected.
*/
#define LCD_M 1000000
#define Y(r,g,b) ( 587000*(g)/LCD_M + 114000*(b)/LCD_M + 299000*(r)/LCD_M)
#define Cb(r,g,b) (128-331000*(g)/LCD_M + 500000*(b)/LCD_M - 169000*(r)/LCD_M)
#define Cr(r,g,b) (128-419000*(g)/LCD_M - 81000*(b)/LCD_M + 500000*(r)/LCD_M)
#define YUV(r,g,b) ((unsigned)Cr(r,g,b)<<24)|(Y(r,g,b)<<16)|\
(Cb(r,g,b)<<8) | Y(r,g,b)
#define YUV_COLOR_BLACK YUV(50,50,50) /* Remove a bit of contrast */
#define YUV_COLOR_WHITE YUV(200,200,200) /* Remove a bit of contrast */
#define YUV_COLOR_GRAY YUV(127,127,127)
#define YUV_COLOR_RED YUV(255,0,0)
#define YUV_COLOR_GREEN YUV(0,255,0)
#define YUV_COLOR_BLUE YUV(0,0,255)
#define YUV_COLOR_YELLOW YUV(255,255,0)
#define YUV_COLOR_CYAN YUV(0,255,255)
#define YUV_COLOR_MAGENTA YUV(255,0,255)
#define YUV_COLOR_GRAY0 YUV(31,31,31)
#define YUV_COLOR_GRAY1 YUV(63,63,63)
#define YUV_COLOR_GRAY2 YUV(95,95,95)
#define YUV_COLOR_GRAY3 YUV(127,127,127)
#define YUV_COLOR_GRAY4 YUV(159,159,159)
#define YUV_COLOR_GRAY5 YUV(191,191,191)
#define YUV_COLOR_GRAY6 YUV(223,223,223)
#define YUV_COLOR_GRAY7 YUV(255,255,255)
/* 16 bit LCD color space is RGB565 or RGB444 (we use the former)
*/
#define RGB565(r,g,b) ((unsigned)((r & 0x1f) << 11) | ((g & 0x3f) << 5) |\
(b & 0x1f))
#define RGB444(r,g,b) ((unsigned)((r & 0xf) << 8) | ((g & 0xf) << 4) |\
(b & 0xf))
#define RGB565X_COLOR_BLACK ((RGB565(0,0,0) << 16) | RGB565(0,0,0))
#define RGB565X_COLOR_WHITE ((RGB565(31,63,31) << 16) | RGB565(31,63,31))
#define RGB565X_COLOR_GRAY ((RGB565(15,31,15) << 16) | RGB565(15,31,15))
#define RGB565X_COLOR_RED ((RGB565(31,0,0) << 16) | RGB565(31,0,0))
#define RGB565X_COLOR_GREEN ((RGB565(0,63,0) << 16) | RGB565(0,63,0))
#define RGB565X_COLOR_BLUE ((RGB565(0,0,31) << 16) | RGB565(0,0,31))
#define RGB565X_COLOR_YELLOW ((RGB565(31,63,0) << 16) | RGB565(31,63,0))
#define RGB565X_COLOR_CYAN ((RGB565(0,63,31) << 16) | RGB565(0,63,31))
#define RGB565X_COLOR_MAGENTA ((RGB565(31,0,31) << 16) | RGB565(31,0,31))
#define RGB565X_COLOR_GRAY0 ((RGB565(3,7,3) << 16) | RGB565(3,7,3))
#define RGB565X_COLOR_GRAY1 ((RGB565(7,15,7) << 16) | RGB565(7,15,7))
#define RGB565X_COLOR_GRAY2 ((RGB565(11,23,11) << 16) | RGB565(11,23,11))
#define RGB565X_COLOR_GRAY3 ((RGB565(15,31,15) << 16) | RGB565(15,31,15))
#define RGB565X_COLOR_GRAY4 ((RGB565(19,39,19) << 16) | RGB565(19,39,19))
#define RGB565X_COLOR_GRAY5 ((RGB565(23,47,23) << 16) | RGB565(23,47,23))
#define RGB565X_COLOR_GRAY6 ((RGB565(27,55,27) << 16) | RGB565(27,55,27))
#define RGB565X_COLOR_GRAY7 ((RGB565(31,63,31) << 16) | RGB565(31,63,31))
#define RGB565_COLOR_BLACK ((RGB565(0,0,0) << 16) | RGB565(0,0,0))
#define RGB565_COLOR_WHITE ((RGB565(30,62,30) << 16) | RGB565(30,62,30))
#define RGB565_COLOR_GRAY ((RGB565(14,30,14) << 16) | RGB565(14,30,14))
#define RGB565_COLOR_RED ((RGB565(30,0,0) << 16) | RGB565(30,0,0))
#define RGB565_COLOR_GREEN ((RGB565(0,62,0) << 16) | RGB565(0,62,0))
#define RGB565_COLOR_BLUE ((RGB565(0,0,30) << 16) | RGB565(0,0,30))
#define RGB565_COLOR_YELLOW ((RGB565(30,62,0) << 16) | RGB565(30,62,0))
#define RGB565_COLOR_CYAN ((RGB565(0,62,30) << 16) | RGB565(0,62,30))
#define RGB565_COLOR_MAGENTA ((RGB565(30,0,30) << 16) | RGB565(30,0,30))
#define RGB565_COLOR_GRAY0 ((RGB565(2,6,2) << 16) | RGB565(2,6,2))
#define RGB565_COLOR_GRAY1 ((RGB565(6,14,6) << 16) | RGB565(6,14,6))
#define RGB565_COLOR_GRAY2 ((RGB565(10,22,10) << 16) | RGB565(10,22,10))
#define RGB565_COLOR_GRAY3 ((RGB565(14,30,14) << 16) | RGB565(14,30,14))
#define RGB565_COLOR_GRAY4 ((RGB565(18,38,18) << 16) | RGB565(18,38,18))
#define RGB565_COLOR_GRAY5 ((RGB565(22,46,22) << 16) | RGB565(22,46,22))
#define RGB565_COLOR_GRAY6 ((RGB565(26,54,26) << 16) | RGB565(26,54,26))
#define RGB565_COLOR_GRAY7 ((RGB565(30,62,30) << 16) | RGB565(30,62,30))
#define RGB444_COLOR_BLACK ((RGB444(0,0,0) << 16) | RGB444(0,0,0))
#define RGB444_COLOR_WHITE ((RGB444(15,15,15) << 16) | RGB444(15,15,15))
#define RGB444_COLOR_GRAY ((RGB444(7,7,7) << 16) | RGB444(7,7,7))
#define RGB444_COLOR_RED ((RGB444(15,0,0) << 16) | RGB444(15,0,0))
#define RGB444_COLOR_GREEN ((RGB444(0,15,0) << 16) | RGB444(0,15,0))
#define RGB444_COLOR_BLUE ((RGB444(0,0,15) << 16) | RGB444(0,0,15))
#define RGB444_COLOR_YELLOW ((RGB444(15,15,0) << 16) | RGB444(15,15,0))
#define RGB444_COLOR_CYAN ((RGB444(0,15,15) << 16) | RGB444(0,15,15))
#define RGB444_COLOR_MAGENTA ((RGB444(15,0,15) << 16) | RGB444(15,0,15))
#define RGB444_COLOR_GRAY0 ((RGB444(1,1,1) << 16) | RGB444(1,1,1))
#define RGB444_COLOR_GRAY1 ((RGB444(3,3,3) << 16) | RGB444(3,3,3))
#define RGB444_COLOR_GRAY2 ((RGB444(5,5,5) << 16) | RGB444(5,5,5))
#define RGB444_COLOR_GRAY3 ((RGB444(7,7,7) << 16) | RGB444(7,7,7))
#define RGB444_COLOR_GRAY4 ((RGB444(9,9,9) << 16) | RGB444(9,9,9))
#define RGB444_COLOR_GRAY5 ((RGB444(11,11,11) << 16) | RGB444(11,11,11))
#define RGB444_COLOR_GRAY6 ((RGB444(13,13,13) << 16) | RGB444(13,13,13))
#define RGB444_COLOR_GRAY7 ((RGB444(15,15,15) << 16) | RGB444(15,15,15))
/* 8 bit LCD color space is RGB8
*/
#define RGB8_COLOR_BLACK 0
#define RGB8_COLOR_WHITE 1
#define RGB8_COLOR_RED 2
#define RGB8_COLOR_GREEN 3
#define RGB8_COLOR_BLUE 4
#define RGB8_COLOR_CYAN 5
#define RGB8_COLOR_MAGENTA 6
#define RGB8_COLOR_YELLOW 7
#define RGB8_COLOR_GRAY0 8
#define RGB8_COLOR_GRAY1 9
#define RGB8_COLOR_GRAY2 10
#define RGB8_COLOR_GRAY3 11
#define RGB8_COLOR_GRAY4 12
#define RGB8_COLOR_GRAY5 13
#define RGB8_COLOR_GRAY6 14
#define RGB8_COLOR_GRAY7 15
/*
* Output device
*/
typedef enum DM_ColorSpace_E
{
DM_ColorSpaceNone = 0,
DM_ColorSpaceYUV,
DM_ColorSpaceRGB565,
DM_ColorSpaceRGB444,
DM_ColorSpaceRGB
} DM_ColorSpace_T;
/* Display format
*/
typedef enum DM_DisplayFormat_E
{
DM_DisplayFormatNone = 0,
DM_DisplayFormatSqrNTSC,
DM_DisplayFormatNTSC,
DM_DisplayFormatSqrPAL,
DM_DisplayFormatPAL,
DM_DisplayFormatLCD,
DM_DisplayFormatVGA
} DM_DisplayFormat_T;
typedef enum DM_PrintFlags_E
{
DM_PrintFlagNormal = 0,
DM_PrintFlagCenter = 1,
DM_PrintFlagBold = 2,
DM_PrintFlagUnderline = 4,
DM_PrintFlagReverse = 8
} DM_PrintFlags_T;
typedef enum DM_Colors_E
{
DM_ColorBlack = 0,
DM_ColorWhite = 1,
DM_ColorRed = 2,
DM_ColorGreen = 3,
DM_ColorBlue = 4,
DM_ColorCyan = 5,
DM_ColorMagenta = 6,
DM_ColorYellow = 7,
DM_ColorGray0 = 8,
DM_ColorGray1 = 9,
DM_ColorGray2 = 10,
DM_ColorGray3 = 11,
DM_ColorGray4 = 12,
DM_ColorGray5 = 13,
DM_ColorGray6 = 14,
DM_ColorGray7 = 15
} DM_Colors_T;
/*
*******************************************************************************
LCD Frame descriptor structure
*******************************************************************************
*/
#ifdef never // [
typedef struct LCDFrameDescriptorS {
UINT32 FDADR;
UINT32 FSADR;
UINT32 FIDR;
UINT32 LDCMD;
} LCDFrameDescriptorT;
#endif // ]
typedef struct DM_OutputBBox_S
{
int x1;
int y1;
int x2;
int y2;
} DM_OutputBBox_T;
typedef void (*DM_OutputPrintString_T) (void *funcP,
char *s,
int row,
int col,
unsigned fg,
unsigned bg,
int flags);
typedef void (*DM_OutputPrintChar_T) (void *funcP,
char s,
int row,
int col,
unsigned fg,
unsigned bg);
typedef void (*DM_OutputClearScreen_T) (void *funcP,
unsigned bg);
typedef void (*DM_OutputClearRegion_T) (void *funcP,
int start,
int rows,
unsigned bg);
typedef void (*DM_OutputScrollRegion_T) (void *funcP,
int start,
int end,
int row,
unsigned bg);
typedef void (*DM_OutputGetGeometry_T) (void *funcP,
int *h,
int *v,
int *maxRow,
int *maxCol);
typedef DM_ColorSpace_T (*DM_OutputGetColorSpace_T) (void *funcP);
typedef int (*DM_OutputGetColorDepth_T) (void *funcP);
typedef DM_DisplayFormat_T (*DM_OutputGetDisplayFormat_T) (void *funcP);
typedef void * (*DM_OutputGetFrameBuffer_T) ( void *funcP);
typedef void * (*DM_OutputGetFieldBuffer_T) (void *funcP,
int fNum);
typedef void (*DM_OutputSetDisplay_T) (void *funcP,
int dt,
int cs);
typedef void (*DM_OutputDrawLine_T) (void *funcP,
int from_x, int from_y,
int to_x, int to_y,
unsigned fg,
int width);
typedef void (*DM_OutputFill_T) (void *funcP,
int x1, int y1,
int x2, int y2,
unsigned fg);
typedef void (*DM_OutputGetBBox_T) (void *funcP,
int start_row,
int rows,
int start_col,
int cols,
DM_OutputBBox_T *bbox);
typedef void * (*DM_OutputOffScreenBuffer_T) (void *funcP,
void *p);
typedef void (*DM_OutputSetOffScreenBuffer_T) (void *funcP,
void *p);
/*
*******************************************************************************
* This is the Screen Context Structure for the LCD device.
*******************************************************************************
*/
#if 0
typedef struct ScreenContextS {
LcdContextT * lcdP;
INT displayType; /* display device type */
DM_OutputPrintString_T printStringFnP;
DM_OutputPrintChar_T printCharFnP;
DM_OutputClearScreen_T clearScreenFnP;
DM_OutputClearRegion_T clearRegionFnP;
DM_OutputScrollRegion_T scrollRegionFnP;
DM_OutputGetGeometry_T getGeometryFnP;
DM_OutputGetColorSpace_T getColorSpaceFnP;
DM_OutputGetColorDepth_T getColorDepthFnP;
DM_OutputGetDisplayFormat_T getDisplayFormatFnP;
DM_OutputGetFrameBuffer_T getFrameBufferFnP;
DM_OutputGetFieldBuffer_T getFieldBufferFnP;
DM_OutputSetDisplay_T setDisplayFnP;
DM_OutputDrawLine_T drawLineFnP;
DM_OutputGetBBox_T getBBoxFnP;
DM_OutputFill_T fillRectFnP;
DM_OutputOffScreenBuffer_T offScreenBufferFnP;
DM_OutputSetOffScreenBuffer_T setOffScreenBufferFnP;
} ScreenContextT;
extern ScreenContextT Screen;
#endif
/*
*******************************************************************************
function prototypes
*******************************************************************************
*/
void ScreenSWInit(void);
#endif // _screen_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -