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

📄 device.h

📁 ecos下的gui开发源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef _DEVICE_H#define _DEVICE_H/* * Copyright (c) 1999, 2000, 2001, 2002, 2003 Greg Haerr <greg@censoft.com> * Portions Copyright (c) 2002 Koninklijke Philips Electronics * * Engine-level Screen, Mouse and Keyboard device driver API's and types * * Contents of this file are not for general export */#include "mwtypes.h"				/* public export typedefs*/#include "mwsystem.h"//added by lfei 070821 #define SPG293_PLATFORM 1///* Changeable limits and options*/#define ALPHABLEND	1			/* =1 to include blending code*/#define DYNAMICREGIONS	1			/* =1 to use MWCLIPREGIONS*/#define HAVEFLOAT	1			/* =1 incl float, GdArcAngle*/#define POLYREGIONS	1			/* =1 includes polygon regions*/#define ANIMATEPALETTE	0			/* =1 animated palette test*/#define FONTMAPPER	0			/* =1 for Morten's font mapper*/#define USE_ALLOCA	1			/* alloca() is available */#define FASTJPEG	1			/* =1 for temp quick jpeg 8bpp*/#define HAVE_MMAP       0#define TRANSLATE_ESCAPE_SEQUENCES  1		/* =1 to parse fnkeys w/tty driver*/#if !((DOS_DJGPP) || (__PACIFIC__) || (DOS_TURBOC))#define MW_FEATURE_IMAGES 1		/* =1 to enable GdLoadImage* / GdDrawImage* */#else#define MW_FEATURE_IMAGES 0		/* platform doesn't support images*/#endif#if UNIX || DOS_DJGPP || HAVE_TIMER_SUPPORT#define MW_FEATURE_TIMERS 1		/* =1 to include MWTIMER support */#else#define MW_FEATURE_TIMERS 0		/* Other platforms do not support timers yet */#endif/* determine compiler capability for handling EPRINTF/DPRINTF macros*/#ifndef MW_FEATURE_GDERROR#if (defined(GCC_VERSION) && (GCC_VERSION >= 2093)) || (defined(__GNUC__) && (__GNUC__ >= 2) && (__GNUC_MINOR__ >= 95))#define MW_FEATURE_GDERROR	0		/* use fprintf instead of GdError*/#else#define MW_FEATURE_GDERROR	1		/* use GdError for errors*/#endif#endif /* MW_FEATURE_GDERROR*/#if MW_FEATURE_GDERROR#define EPRINTF			GdError		/* error output*/#if DEBUG#define DPRINTF			GdError		/* debug output*/#else#define DPRINTF			GdErrorNull	/* no debug output*/#endif#else/* GCC compiler-only macro magic to save space */#include <stdio.h>    /* For stderr */#define EPRINTF(str, args...)   fprintf(stderr, str, ##args)  /* error output*/#if DEBUG#define DPRINTF(str, args...)   fprintf(stderr, str, ##args)  /* debug output*/#else#define DPRINTF(str, ...)	/* no debug output*/#endif#endif /* MW_FEATURE_GDERROR*//* Which low-level psd->DrawArea routines to include. */#define MW_FEATURE_PSDOP_COPY                   0#define MW_FEATURE_PSDOP_ALPHAMAP               0#define MW_FEATURE_PSDOP_ALPHACOL               0#define MW_FEATURE_PSDOP_BITMAP_BYTES_LSB_FIRST 0#define MW_FEATURE_PSDOP_BITMAP_BYTES_MSB_FIRST 0/* max char height/width must be >= 16 and a multiple of sizeof(MWIMAGEBITS)*/#define MAX_CHAR_HEIGHT	128			/* maximum text bitmap height*/#define MAX_CHAR_WIDTH	128			/* maximum text bitmap width*/#define	MIN_MWCOORD	((MWCOORD) -32768)	/* minimum coordinate value */#define	MAX_MWCOORD	((MWCOORD) 32767)	/* maximum coordinate value */#define	MAX_CLIPRECTS 	200			/* max clip rects (obsolete)*//* Override some of the above defines, for features which are required * for the Microwindows FreeType 2 font driver */#ifdef HAVE_FREETYPE_2_SUPPORT#undef  MW_FEATURE_PSDOP_ALPHACOL#define MW_FEATURE_PSDOP_ALPHACOL 1#undef  MW_FEATURE_PSDOP_BITMAP_BYTES_MSB_FIRST#define MW_FEATURE_PSDOP_BITMAP_BYTES_MSB_FIRST 1#endif/* Sanity check: VTSWITCH involves a timer. */#if VTSWITCH && !MW_FEATURE_TIMERS#error VTSWITCH depends on MW_FEATURE_TIMERS - disable VTSWITCH in config or enable MW_FEATURE_TIMERS in this file#endiftypedef struct _mwscreendevice *PSD;/* builtin C-based proportional/fixed font structure*/typedef struct {	char *		name;		/* font name*/	int		maxwidth;	/* max width in pixels*/	unsigned int	height;		/* height in pixels*/	int		ascent;		/* ascent (baseline) height*/	int		firstchar;	/* first character in bitmap*/	int		size;		/* font size in characters*/	MWIMAGEBITS *	bits;		/* 16-bit right-padded bitmap data*/	unsigned long *offset;		/* offsets into bitmap data*/	unsigned char *	width;		/* character widths or 0 if fixed*/	int		defaultchar;	/* default char (not glyph index)*/	long		bits_size;	/* # words of MWIMAGEBITS bits*/} MWCFONT, *PMWCFONT;/* draw procs associated with fonts.  Strings are [re]packed using defencoding*/typedef struct {	MWTEXTFLAGS	encoding;	/* routines expect this encoding*/	MWBOOL	(*GetFontInfo)(PMWFONT pfont, PMWFONTINFO pfontinfo);	void 	(*GetTextSize)(PMWFONT pfont, const void *text, int cc,			MWTEXTFLAGS flags, MWCOORD *pwidth, MWCOORD *pheight,			MWCOORD *pbase);	void	(*GetTextBits)(PMWFONT pfont, int ch, const MWIMAGEBITS **retmap,			MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);	void	(*DestroyFont)(PMWFONT pfont);	void	(*DrawText)(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,			const void *str, int count, MWTEXTFLAGS flags);	void    (*SetFontSize)(PMWFONT pfont, MWCOORD fontsize);	void    (*SetFontRotation)(PMWFONT pfont, int tenthdegrees);	void    (*SetFontAttr)(PMWFONT pfont, int setflags, int clrflags);	PMWFONT (*Duplicate) (PMWFONT psrcfont, MWCOORD fontsize);} MWFONTPROCS, *PMWFONTPROCS;/* new multi-renderer font struct*/typedef struct _mwfont {		/* common hdr for all font structures*/	PMWFONTPROCS	fontprocs;	/* font-specific rendering routines*/	MWCOORD		fontsize;	/* font height in pixels*/	int		fontrotation;	/* font rotation*/	int		fontattr;	/* font attributes: kerning/antialias*/	/* font-specific rendering data here*/} MWFONT;/* builtin core font struct*/typedef struct {	PMWFONTPROCS	fontprocs;	/* common hdr*/	MWCOORD		fontsize;	int		fontrotation;	int		fontattr;	char *		name;		/* Microwindows font name*/	PMWCFONT	cfont;		/* builtin font data*/} MWCOREFONT, *PMWCOREFONT;/* This structure is used to pass parameters into the low * level device driver functions. */typedef struct {	MWCOORD dstx, dsty, dstw, dsth, dst_linelen;	MWCOORD srcx, srcy, src_linelen;	void *pixels, *misc;	MWPIXELVAL bg_color, fg_color;	int gr_usebg;} driver_gc_t;/* Operations for the Blitter/Area functions */#if MW_FEATURE_PSDOP_COPY/* * FIXME Not Documented - see drivers/fblin16.c */#define PSDOP_COPY	0/* * FIXME Not Documented - see drivers/fblin16.c */#define PSDOP_COPYALL	1/* * FIXME Not Documented - see drivers/fblin16.c */#define PSDOP_COPYTRANS 2#endif /* MW_FEATURE_PSDOP_COPY */#if MW_FEATURE_PSDOP_ALPHAMAP/* * Copy an image to screen, using an alpha map. * Params: * dstx, dsty  - Destination for top left of image * dstw, dsth  - Image size * srcx, srcy  - Start co-ordinates in source image * src_linelen - Source image stride, in pixels * pixels      - Image to copy from.  Format: same color model as display. * misc        - Alpha map.  Format: ADDR8, entries *               are alpha values in range 0-255. * gr_usebg    - Ignored.  FIXME If set, should blend to bg_color. * bg_color    - Ignored.  FIXME Should be used if gr_usebg is set. * fg_color    - Ignored. */#define PSDOP_ALPHAMAP	3#endif /* MW_FEATURE_PSDOP_ALPHAMAP */#if MW_FEATURE_PSDOP_ALPHACOL/* * Draws an alpha map to screen (e.g. an anti-aliased font). * Params: * dstx, dsty  - Destination for top left of image * dstw, dsth  - Image size * srcx, srcy  - Start co-ordinates in source alpha map * src_linelen - Source image stride, in pixels * misc        - Alpha map.  Format: ADDR8, entries *               are alpha values in range 0-255. * fg_color    - The color to draw in, in the display format. * gr_usebg    - Ignored.  FIXME If set, should blend to bg_color. * bg_color    - Ignored.  FIXME Should be used if gr_usebg is set. * pixels      - Ignored. */#define PSDOP_ALPHACOL	4#endif /* MW_FEATURE_PSDOP_ALPHACOL */#if MW_FEATURE_PSDOP_BITMAP_BYTES_LSB_FIRST/* * Draws a mono bitmap to screen (e.g. a mono font). * This variant takes the bitmap as an array of bytes, * where the Least Significant Bit in each byte is * used to set the left-most of the eight pixels * controlled by that byte.  I.e: * * [ 1 1 1 1 0 0 0 1 ] == 0x8F * * Params: * dstx, dsty  - Destination for top left of image * dstw, dsth  - Image size * srcx, srcy  - Start co-ordinates in source alpha map * src_linelen - Source image stride, in pixels * pixels      - The bitmap.  Format: ADDR8, LSB is drawn first. * fg_color    - The color to draw "1" bits in, in the display format. * bg_color    - The color to draw "0" bits in, in the display format. * gr_usebg    - If zero, then "0" bits are transparent.  If nonzero, *               then "0" bits are bg_color. */#define PSDOP_BITMAP_BYTES_LSB_FIRST	5#endif /* MW_FEATURE_PSDOP_BITMAP_BYTES_LSB_FIRST */#if MW_FEATURE_PSDOP_BITMAP_BYTES_MSB_FIRST/* * Draws a mono bitmap to screen (e.g. a mono font). * This variant takes the bitmap as an array of bytes, * where the Most Significant Bit in each byte is * used to set the left-most of the eight pixels * controlled by that byte.  I.e: * * [ 1 1 1 1 0 0 0 1 ] == 0xF1 * * Params: * dstx, dsty  - Destination for top left of image * dstw, dsth  - Image size * srcx, srcy  - Start co-ordinates in source alpha map * src_linelen - Source image stride, in pixels * pixels      - The bitmap.  Format: ADDR8, MSB is drawn first. * fg_color    - The color to draw "1" bits in, in the display format. * bg_color    - The color to draw "0" bits in, in the display format. * gr_usebg    - If zero, then "0" bits are transparent.  If nonzero, *               then "0" bits are bg_color. */#define PSDOP_BITMAP_BYTES_MSB_FIRST	6#endif /* MW_FEATURE_PSDOP_BITMAP_BYTES_MSB_FIRST *//* common blitter parameter structure*/typedef struct {	PSD		dstpsd;		/* dst drawable*/	MWCOORD		dstx, dsty;	/* dst x,y,w,h*/	MWCOORD		dstw, dsth;	MWCOORD		srcx, srcy;	/* src x,y*/	MWCOORD		srcw, srch;	/* src w,h if stretchblit*/	PSD		srcpsd;		/* src drawable*/	unsigned long 	rop;		/* raster opcode*/	PSD		alphachan;	/* alpha chan for MWROP_BLENDCHANNEL*/	MWPIXELVAL	fgcolor;	/* fg/bg color for MWROP_BLENDFGBG*/	MWPIXELVAL	bgcolor;	MWPIXELVAL	transcolor;	/* trans color for MWROP_SRCTRANSCOPY*/} MWBLITARGS, *PMWBLITARGS;/* screen subdriver entry points: one required for each draw function*//* NOTE: currently used for fb driver only*/typedef struct {	int	 (*Init)(PSD psd);	void 	 (*DrawPixel)(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c);	MWPIXELVAL (*ReadPixel)(PSD psd, MWCOORD x, MWCOORD y);	void 	 (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y,			MWPIXELVAL c);	void	 (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2,			MWPIXELVAL c);	void	 (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,			MWCOORD y2,MWPIXELVAL c);	void	 (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w,			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);	void	 (*DrawArea)(PSD psd, driver_gc_t *gc, int op);		/* Note: StretchBlit() is deprecated, callers should prefer	 * StretchBlitEx() if available.  Drivers should just	 * implement StretchBlitEx().	 */	void	 (*StretchBlit)(PSD destpsd, MWCOORD destx, MWCOORD desty,			MWCOORD dstw, MWCOORD dsth, PSD srcpsd, MWCOORD srcx,			MWCOORD srcy, MWCOORD srcw, MWCOORD srch, long op);	void 	 (*StretchBlitEx) (PSD dstpsd, PSD srcpsd,			MWCOORD dest_x_start, int dest_y_start,			MWCOORD width, int height,			int x_denominator, int y_denominator,			int src_x_fraction, int src_y_fraction,			int x_step_fraction, int y_step_fraction, long op);} SUBDRIVER, *PSUBDRIVER;/* * Interface to Screen Device Driver * This structure is also allocated for memory (offscreen) drawing and blitting. */typedef struct _mwscreendevice {	MWCOORD	xres;		/* X screen res (real) */	MWCOORD	yres;		/* Y screen res (real) */	MWCOORD	xvirtres;	/* X drawing res (will be flipped in portrait mode) */	MWCOORD	yvirtres;	/* Y drawing res (will be flipped in portrait mode) */	int	planes;		/* # planes*/	int	bpp;		/* # bpp*/	int	linelen;	/* line length in bytes for bpp 1,2,4,8*/				/* line length in pixels for bpp 16, 24, 32*/	int	size;		/* size of memory allocated*/	long	ncolors;	/* # screen colors*/

⌨️ 快捷键说明

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