Module Documentation
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
83
11.4.1 Detailed Description
The Surface API provides all functions to manage memory blocks with image content, called image buffer. (See also
Surface Overview)
#include "mml_gdc_surfman.h"
The Surface API provides all functions to manage memory blocks with image content, called image buffer. A
"surface" is a description of such an image buffer, including dimension of the image, pixel format and physical
address in memory. The described image can be a (compressed) RGB(A) buffer and optionally use a color lookup
table.
Most modules of this driver can work on surfaces. Examples are display and PixEng. The Surface API allows for
instance to:
Pass surfaces created by the application to PixEng for further processing
Pass surfaces created by the application to Display for displaying on the screen, etc.
The properties can be assigned by using the helper functions mmlGdcSmAssignBuffer and mmlGdcSmAssignClut
or "manually" using mmlGdcSmSetAttribute calls. In the second case the minimal required attributes are typically
MML_GDC_SURF_ATTR_BASE_ADDRESS, MML_GDC_SURF_ATTR_WIDTH,
MML_GDC_SURF_ATTR_HEIGHT, MML_GDC_SURF_ATTR_BITPERPIXEL,
MML_GDC_SURF_ATTR_COLORBITS and MML_GDC_SURF_ATTR_COLORSHIFT.
Optionally a color lookup table can be defined for the image. A color lookup table is a list with a defined number of
red, green, blue and optionally alpha values. If an index table is defined for an image the blue and green color parts,
if the image are not longer used but the red component is used as "pointer" to the color lookup table and the related
red, green, blue (and alpha) value define the pixel color.
pixel color:
r
g
b
1
1
1
color lookup table:
index
r
g
b
0
0
0
0
1
255
255
255
2
0
255
255
resulting color:
255
255
255
A color lookup table can be defined with the helper function mmlGdcSmAssignClut or "manually" using
mmlGdcSmSetAttribute calls. In the second case the minimal required attributes are
MML_GDC_SURF_ATTR_CLUTMODE, MML_GDC_SURF_ATTR_CLUTCOUNT,
MML_GDC_SURF_ATTR_CLUTBITPERPIXEL, MML_GDC_SURF_ATTR_CLUTCOLORBITS,
MML_GDC_SURF_ATTR_CLUTCOLORSHIFT and MML_GDC_SURF_ATTR_CLUTBUFFERADDRESS.
Note:
The maximal bits per pixel for an index entry is 24. Therefore if an alpha channel is required a reduced bit with for
the color channels are required (e.g., R6G6B6A6). If this is not enough the alpha channel can also be stored in the
image pixel.
If an indexed image is used it is required that the red component starts at the lowest bit for each pixel (see
MML_GDC_SURF_ATTR_COLORBITS).