www.pudn.com > emGUI.rar > device.h


/* 
 *  Screen Device Layer 
 * 
 * 
 *  COPYRIGHT (c) 2001 - 2010. 
 *  emTech System Corporation. 
 * 
 *  The license and distribution terms for this file may be 
 *  found in found in the file LICENSE. 
 */ 
 
/*	Huangf emcore@263.net 
 */ 
 
#ifndef		__DEVICE_h 
#define		__DEVICE_h 
 
#define 	GRARC								0x0001	/* arc*/ 
#define	 	GROUTLINE							0x0002 
#define 	GRARCOUTLINE						0x0003	/* arc + outline*/ 
#define 	GRPIE								0x0004	/* pie (filled)*/ 
#define 	GRELLIPSE							0x0008	/* ellipse outline*/ 
#define 	GRELLIPSEFILL						0x0010	/* ellipse filled*/ 
 
#define 	GRLEFTTOP							0x10 
#define 	GRLEFTBOTTOM						0x20 
#define		GRRIGHTTOP							0x40 
#define 	GRRIGHTBOTTOM						0x80		 
 
 
struct _emscreendevice; 
typedef struct _emscreendevice *PSD; 
 
typedef struct _emscreendevice { 
	PSD			(*Open)(PSD psd); 
	void 		(*Close)(PSD psd); 
	void		(*DrawPixel)(unsigned short *base, int x, int y, unsigned char c, int xorm); 
	int			(*ReadPixel)(unsigned short *base, int x, int y); 
	int			(*DrawHorzLine)(unsigned short *base, int x1, int y, int x2, unsigned char c, int xorm); 
	int			(*DrawVertLine)(unsigned short *base, int x, int y1, int y2, unsigned char c, int mode); 
	int			(*FillRect)(unsigned short *base, int x1, int y1, int x2, int y2, int c);  
	int			(*DrawBitmap)(unsigned short *base, int x0, int y0, int w, int h, unsigned char *pcc, int mode);  
	void		(*SwitchDrawArea)(void *base); 
	void		(*SaveDrawArea)(char *, char *, int, int, int, int); 
	void		(*RestoreDrawArea)(char *, char *, int, int, int, int); 
	int			(*CalcMemGCSize)(int, int, int, int); 
} SCREENDEVICE; 
 
int			ScreenOpen(); 
void		ScreenClose(); 
void 		DrawPixel( 
				unsigned short *base, 
				int	x, 
				int	y, 
				unsigned char c, 
				int mode 
); 
 
int			ReadPixel( 
				unsigned short *base, 
				int x, 
				int y 
); 
 
int			DrawHorzLine( 
				unsigned short *base, 
				int x1, 
				int y, 
				int x2, 
				unsigned char c, 
				int mode 
); 
 
int 		DrawVertLine( 
				unsigned short *base, 
				int x, 
				int y1, 
				int y2, 
				const char c, 
				int mode 
); 
 
int 		FillRect( 
				unsigned short *base, 
				int x1, 
				int y1, 
				int x2,  
				int y2, 
				int c 
); 
 
int 		DrawBitmap( 
				unsigned short *base, 
				int x0, 
				int y0, 
				int width, 
				int height, 
				unsigned char *pcc, 
				int mode 
); 
 
void SwitchDrawArea( 
	void *drawArea 
); 
 
int CalcMemGCSize( 
	int l, 
	int t, 
	int r, 
	int b 
); 
 
void RestoreDrawArea( 
	void *drawarea, 
	void *memory, 
	int	 l, 
	int  t, 
	int  r, 
	int  b 
); 
 
void SaveDrawArea( 
	void *drawarea, 
	void *memory, 
	int	 l, 
	int  t, 
	int  r, 
	int  b 
); 
 
#endif