Alpha Blending

Microchip Graphics Library

Microchip Graphics Library
Alpha Blending

Alpha Blending in Epson Controller uses blocks of pixels in the memory called Windows. A window can be any rectangular area in a display buffer. The display buffer is also considered as a page. For a QVGA display buffer a page would be 320x240 pixels. A window is a certain width and height contained inside a page. 

 

 

Alpha blending equation: 

OutPut Window = Foreground Window * (Alpha) + Background Window * (1-Alpha) 

when done in software requires a lot of CPU bandwith. Epson Controller implements alpha blending in hardware which offloads the CPU. 

The Display Driver Layer of the Graphics Library utilizes the Epson Controller alpha blending through the AlphaBlendWindow() function. Three windows are specified with equal widths and heights. An alpha parameter is passed to define the level of alpha blending. The logical flow of the operation is shown below:

 

An icon image with a given width (w) and height (h) is needed to be alpha blended into the display buffer.

  • Buffer A is allocated in memory and its location set by foregroundWindowAddr
  • Buffer B is allocated in memory and its location set by backgroundWindowAddr and
  • Buffer C is allocated in memory and its location set by destinationWindowAddr. Note that the destination window can be located within the display buffer. Doing this removes an intermediate step after AlphaBlendWindow() call to put the result of alpha blend in the display buffer.
The final location of the icon on the Display Buffer is used to locate the affected pixels in the Display Buffer. These affected pixels are copied into Buffer B while Buffer A is filled up with the Icon Image. Once Buffers A and B are ready they are alpha blended to Buffer C. Buffer C is then copied to the Display Buffer. 

 

Note that the Icon Image has a background color of ORANGE. To have the effect of the final output Display Buffer, set the Epson Controllers transparent color to ORANGE. This is set in the TRANSPARENTCOLOR macro defined in the Epson S1D13517 Driver. This TRANSPARENTCOLOR macro is not to be confused with the TransparentColorEnable() function of the Display Device Driver Level Primitives. TRANSPARENTCOLOR is set at build time. In the future release of the Epson driver, this will be converted to use the TransparentColorEnable() function.

Functions
 
Name 
Description 
 
This function calculates the address of a certain 0,0 location of a page in memory 
 
This function calculates the address of a certain x,y location in memory 
Module
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved