Download Graphics Driver Manual for 2D core of S6E2D devices

Transcript
A P P L I C A T I O N
N O T E
11.19 Utilities for the Surface Management
Macros
− #define UTIL_SUCCESS(rc, execute)
− #define UTIL_ERR_OUT_OF_MEMORY MM_ERRCODE(0x31000001)
Functions
− MM_ERROR utSurfReadBitmap (MML_GDC_SURFACE surface, void ∗∗pImage, MM_U32
∗baseAddr, MM_U32 ∗clutAddr)
MM_ERROR utSurfLoadBitmap (MML_GDC_SURFACE surface, const void ∗pImage, MM_BOOL
bCopyToVRAM)
MM_S32 utSurfWidth (MML_GDC_SURFACE surf)
MM_S32 utSurfHeight (MML_GDC_SURFACE surf)
MM_ERROR utSurfCreateBuffer (MML_GDC_SURFACE surf, MM_U32 w, MM_U32 h,
MML_GDC_SURF_FORMAT eFormat)
−
−
−
−
− void utSurfDeleteBuffer (MML_GDC_SURFACE surf)
− MM_ERROR utSurfGetPixel (MML_GDC_SURFACE src, MM_U32 x, MM_U32 y, MM_U08 ∗r,
MM_U08 ∗g, MM_U08 ∗b, MM_U08 ∗a)
− MM_ERROR utSurfSetPixel (MML_GDC_SURFACE src, MM_U32 x, MM_U32 y, MM_U08 r,
MM_U08 g, MM_U08 b, MM_U08 a)
11.19.1 Detailed Description
This utility block realizes some helper functions related to the surface manager API of the 2D core graphics
driver. The following code allocates an 16bpp image buffer in the VRAM and initializes a surface object.
Afterwards it fills the surface with generated pixel data.
void CreatePattern(MML_GDC_SURFACE surf, MM_U32 width, MM_U32 height)
{
MM_U32 x;
MM_U32 y;
MM_U32 red;
MM_U32 green;
MM_U32 blue;
MM_U32 alpha;
mmlGdcSmResetSurfaceObject(surf);
utSurfCreateBuffer(surf, width, height, MML_GDC_SURF_FORMAT_R4G4B4A4);
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
red = 255 - 255 * x / width;
green = 255 * x / width;
blue = 255 * y / width;
alpha = 255 - 255 * y / width;
utSurfSetPixel(surf, x, y, red, green, blue, alpha);
September 11, 2015, S6E2DH_AN709-00022-1v0-E
CONFIDENTIAL
195