Difference between revisions of "GDISP"

From uGFX Wiki
Jump to: navigation, search
(Board file)
(Multipel displays)
Line 41: Line 41:
  
 
== Multipel displays ==
 
== Multipel displays ==
ToDo
+
The GDISP module can drive more than just one display. See [[Multiple displays]].
  
 
== Remote displays ==
 
== Remote displays ==

Revision as of 23:58, 2 July 2014

GDISP module architecture.

The GDISP module provides a simple interface for graphic displays and a feature rich set of highlevel functions to draw primitive shapes such as lines, circles and rectangles, but also font rendering, clipping and other advanced features.

Whilst most other graphics libraries require the use of a framebuffer, GDISP does not necessarily need one. This allows to drive graphics displays on microcontrollers and other low-performance systems that have insufficient RAM for a frame buffer.

Some LCD controllers offer hardware accelerated drawings for complex drawing operations such as circles or ellipses. The GDISP module is based on a software emulation layer: When the LCD controller does not support these features (most cases), the GDISP module emulates these drawing operations. Therefore, the exact same application code can be used on very different hardware platforms.

Furthermore, you can drive more than just one display with GDISP. They don't even need to have the same display driver. Please refer to the multiple displays section for more information. Especially interesting might be the use of one or more remote displays.


Board file

The board file API for the GDISP module looks like the following:

static void     init_board(GDisplay *g);
static void     post_init_board(GDisplay *g);
static void     setpin_reset(GDisplay *g, bool_t state);
static void     set_backlight(GDisplay *g, uint8_t percent);
static void     acquire_bus(GDisplay *g);
static void     release_bus(GDisplay *g);
static void     write_index(GDisplay *g, uint16_t index);
static void     write_data(GDisplay *g, uint16_t data);
static void     setreadmode(GDisplay *g);
static void     setwritemode(GDisplay *g);
static uint16_t read_data(GDisplay *g);

For more information about the, see GDisplay.
Examples and a template file can be found under /drivers/gdisp/xxx/.

Drawing

ToDo

Images

The GDISP module provides built-in decoders for a variety of image formats. See Images.

FrameBuffer

ToDo

Hardware acceleration

ToDo

Multipel displays

The GDISP module can drive more than just one display. See Multiple displays.

Remote displays

ToDo

GDisplay

ToDo

struct GDisplay {
	// The public GDISP stuff - must be the first element
	GDISPControl				g;
 
	#if GDISP_TOTAL_CONTROLLERS > 1
		const struct GDISPVMT const *	vmt;		// The Virtual Method Table
	#endif
 
	void *						priv;				// A private area just for the drivers use.
	void *						board;				// A private area just for the board interfaces use.
 
	uint8_t						systemdisplay;
	uint8_t						controllerdisplay;
	uint16_t					flags;
		#define GDISP_FLG_INSTREAM		0x0001		// We are in a user based stream operation
		#define GDISP_FLG_SCRSTREAM		0x0002		// The stream area currently covers the whole screen
		#define GDISP_FLG_DRIVER		0x0004		// This flags and above are for use by the driver
 
	// Multithread Mutex
	#if GDISP_NEED_MULTITHREAD
		gfxMutex				mutex;
	#endif
 
	// Software clipping
	#if GDISP_HARDWARE_CLIP != TRUE && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
		coord_t					clipx0, clipy0;
		coord_t					clipx1, clipy1;		/* not inclusive */
	#endif
 
	// Driver call parameters
	struct {
		coord_t			x, y;
		coord_t			cx, cy;
		coord_t			x1, y1;
		coord_t			x2, y2;
		color_t			color;
		void			*ptr;
	} p;
 
	// In call working buffers
 
	#if GDISP_NEED_TEXT
		// Text rendering parameters
		struct {
			font_t		font;
			color_t		color;
			color_t		bgcolor;
			coord_t		clipx0, clipy0;
			coord_t		clipx1, clipy1;
		} t;
	#endif
	#if GDISP_LINEBUF_SIZE != 0 && ((GDISP_NEED_SCROLL && !GDISP_HARDWARE_SCROLL) || (!GDISP_HARDWARE_STREAM_WRITE && GDISP_HARDWARE_BITFILLS))
		// A pixel line buffer
		color_t		linebuf[GDISP_LINEBUF_SIZE];
	#endif
 
};