⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uigraph.h

📁 嵌入工linux开发的源码
💻 H
字号:
#ifndef _GUI_GRAPH_H_
#define _GUI_GRAPH_H_

#include <pr2k.h>
#include <typedefine.h>
#include <uiGui_cfg.h>
//#include <../../driver/lcd/graphic.h>

#ifdef __WIN32__
	#include <lcd\Graphic.h>
#else
	#include <graphic.h>
#include <lcddrv.h>
#endif

#ifdef  GUI_WHITE
#undef  GUI_WHITE
#endif

#ifdef  GUI_LIGHTGRAY
#undef  GUI_LIGHTGRAY
#endif

#ifdef GUI_DARKGRAY
#undef  GUI_DARKGRAY
#endif

#ifdef GUI_BLACK
#undef  GUI_BLACK
#endif

//#ifdef __WIN32__
	#define GUI_WHITE		       0
	#define GUI_LIGHTGRAY	       1
	#define GUI_DARKGRAY	       2
	#define GUI_BLACK		       3
/*
#else
	#define GUI_BLACK			0
	#define GUI_WHITE			1  
	#define GUI_LIGHTGRAY		2
	#define GUI_DARKGRAY		3
#endif
*/
#define FG_BLACK_BG_WHITE	   (GUI_WHITE<<8)|GUI_BLACK
#define FG_BLACK_BG_LIGHTGRAY  (GUI_LIGHTGRAY<<8)|GUI_BLACK
#define FG_BLACK_BG_DARKGRAY   (GUI_DARKGRAY<<8)|GUI_BLACK

#define FG_WHITE_BG_BLACK	   (GUI_BLACK<<8)|GUI_WHITE
#define FG_WHITE_BG_LIGHTGRAY  (GUI_LIGHTGRAY<<8)|GUI_WHITE
#define FG_WHITE_BG_DARKGRAY   (GUI_DARKGRAY<<8)|GUI_WHITE

#define FG_DGRAY_BG_WHITE	   (GUI_WHITE<<8)|GUI_DARKGRAY
#define FG_DGRAY_BG_LIGHTGRAY  (GUI_LIGHTGRAY<<8)|GUI_DARKGRAY
#define FG_DGRAY_BG_BLACK      (GUI_BLACK<<8)|GUI_DARKGRAY

#define FG_LGRAY_BG_WHITE	   (GUI_WHITE<<8)|GUI_LIGHTGAAY
#define FG_LGRAY_BG_DARKGRAY   (GUI_DARKGRAY<<8)|GUI_LIGHTGAAY
#define FG_LGRAY_BG_BLACK	   (GUI_BLACK<<8)|GUI_LIGHTGAAY


#define BMP_1BIT_STYLE		0x01
#define BMP_2BIT_STYLE	    0x02
#define BMP_4BIT_STYLE	    0x04
#define BMP_8BIT_STYLE	    0x08
#define BMP_16BIT_STYLE	    0x10
#define BMP_24BIT_STYLE	    0x20
#define BMP_GRAY_LEVEL		0x40
#define BMP_COMPRESS		0x80
   
// style of image and font         
//#define REPLACE_STYLE       0x00000001
#define REPLACE_STYLE       0x00000000
#define AND_STYLE           0x00000002
#define OR_STYLE            0x00000004
#define EXOR_STYLE          0x00000008
#define INVERSE_STYLE       0x00000010
#define HATCH_STYLE         0x00000020

#define GUI_SOLID           0
#define GUI_HATCH           1

// used by guiFillRect() 
#define GUI_IMAGE 			8

typedef struct  tagRect{
   int left;
   int top;
   int right;
   int bottom;

}TRect;

typedef struct  tagImageHeader{
	BYTE width[2];     // width
	BYTE height[2];    // height
	BYTE mode;         // color mode
	BYTE scan;         // scan
	BYTE reserved[6];  // reserved
}TImageHeader;


DLL_EXP(short) guiGetScreenWidth(void);
DLL_EXP(short) guiGetScreenHeight(void);

/* call when init system */
void guiInitialGraphMode( void );  
  
/* call before call guiFillRect() , set pointer of image to be filled */
void guiSetPattern(const BYTE *pattern_img);

// call displayClear()
DLL_EXP(void) guiClearScreen(void);  
DLL_EXP(void)  guiGetScreen(unsigned char *pScreen);

// style unused
DLL_EXP(void) guiClearBlock(HNDL handle, int left, int top, int right, int bottom, int color, int style);         

DLL_EXP(void) guiDrawPixel(HNDL handle, int x, int y, int color); 

// style: GUI_SOLID, GUI_HATCH 
DLL_EXP(void) guiDrawLine (HNDL handle, int logic_x1, int logic_y1, int logic_x2, int logic_y2, int color, int style );
                                            
// invert data of pImage
DLL_EXP(void) guiInvertImage(BYTE *pImage ); 

DLL_EXP(void) guiGetImage(HNDL handle, int x1, int y1, int x2, int y2, BYTE *pImage );

DLL_EXP(int)  guiGetImageWidth( const BYTE *pImage );
DLL_EXP(int)  guiGetImageHeight( const BYTE *pImage );
DLL_EXP(BYTE) guiGetImageMode( const BYTE *pImage );
                                                                               
// may cut image
DLL_EXP(void) guiPutImage(HNDL handle, int left, int top, int right, int bottom, const BYTE *pImage);     
                                    
DLL_EXP(int)  guiGetImageSize( int x1, int y1, int x2, int y2 );        

DLL_EXP(int)  guiGetImageSizeFromImage(const BYTE *pImage);

// style: GUI_SOLID, GUI_HATCH 
DLL_EXP(void) guiDrawRect (HNDL handle, int left, int top, int right, int bottom, int color, int style);

/*********************************************** 
* may fill image with style GUI_IMAGE          *
* style: GUI_SOLID, GUI_HATCH,  GUI_IMAGE      *
************************************************/
DLL_EXP(void) guiFillRect (HNDL handle, int left, int top, int right, int bottom, int color, int style);

//iStyle: GUI_SOLID, GUI_HATCH	
DLL_EXP(void) guiDrawCircle (HNDL handle, int x0, int y0, int radius, int color, int style);

//iStyle: GUI_SOLID, GUI_HATCH	
DLL_EXP(void) guiFillCircle (HNDL handle, int x0, int y0, int radius, int color, int style);

DLL_EXP(void) guiInvertRect (HNDL handle,  int left, int top, int right, int bottom);

int _guiDrawHLineInView(TRect *rect, int x1, int x2, int y, int color);

int _guiDrawVLineInView(TRect *rect, int x, int y1, int y2, int color);

/************************************************************************
* pSrc  : buffer of source image                                        *
* pDest : buffer of destination image                                   *
* remark: cut form start_col, start_row to end_col, end_row of          *
*         source image to destination buffer                            *
*************************************************************************/
DLL_EXP(void) guiCutImage(int start_col, int start_row, int end_col, int end_row, const BYTE *pSrc, BYTE *pDest );

// cursor function 
DLL_EXP(void) guiDisableCursor();
DLL_EXP(void) guiEnableCursor();
//DLL_EXP(void) guiSetCursorBlink(int blink_gap); 
DLL_EXP(void) guiSetCursorSize(int width, int height);
DLL_EXP(void) GUISetCursorPos(short left, short top);  
DLL_EXP(void) guiGetCursorPos(int *left, int *top);


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -