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.17.1 Detailed Description
The functions in this block are used by some tutorial examples for matrix operations. Different matrix formats
and related functions are defined to support different use cases:
− Mat3x2: This matrix format is sufficient for a fine operations like translation, rotation, scaling and
sharing.
− Mat3x3: A 3x3 matrix is required for perspective operations.
− Mat4x4: A 4x4 matrix is required for perspective operations including z (depth) calculation. The 2D
core HW does not calculate z-coordinates and the driver API does not support this type of matrix.
However, in the computer 3D world (e.g. OpenGL) 4x4 matrices are often used and for compatibility
reasons in some tutorial examples the 4x4 matrix type is used. To use such a matrix type with the 2D
core HW it is required to convert this matrix to a 3x3 matrix type and in some cases to make the
z-order calculation in software.
− Mat4x3: This matrix type is useful for color operations, modifying the R, G, B or Y, U, V color channels.
− Mat5x4: This matrix type is useful for color operations, modifying the R, G, B, A or Y, U, V, A color
channels.
The following code shows a matrix calculation using typical 3D operations with a 4x4 matrix.
be converted into a 3x3 matrix and assigned to a blit context.
The result will
Mat4x4 m44;
Mat3x3 m33;
utMat4x4LoadIdentity(m44); utMat4x4Translate(m44, w / 2.0f, h / 2.0f, 0);
utMat4x4Scale(m44, w / 4.0f, h / 4.0f, 1); utMat4x4Perspective(m44, 60.0f, (float)w / h, (float)0.1, 100.0);
utMat4x4Translate(m44, 0, 0, -2);
utMat4x4RotX(m44,
40);//fAngle);
utMat4x4RotZ(m44,
30);//fAngle2);
utMat4x4Scale(m44, (float)2 / iw, (float)2 / ih, 1);
utMat4x4Translate(m44, -iw / 2.0f, -ih/2.0f, 0);
//utMat4x4Trace("M4x4",
m44);
utMat4x4ToMat3x3(m44, m33);
//utMat3x3Trace("M3x3",
mmlGdcPeSetMatrix(ctx,
m33);
MML_GDC_PE_SRC, MML_GDC_PE_GEO_MATRIX_FORMAT_3X3, m33);
11.17.2 Macro Definition Documentation
11.17.2.1
#define MML_GDC_2D_MATRIX_API extern
MML_GDC_2D_MATRIX_API can be used to define function types like dll export.
11.17.3 Typedef Documentation
11.17.3.1
typedef MM_FLOAT Mat3x2[6]
Matrix with 3 columns and 2 rows for a fine geometry operations. If m is a Mat3x2 matrix type and x,y in an
input vector the resulting vector is:
x
m[0] m[2] m[4]
(m[0] × x) + (m[2] × y) + m[4]
(
) × (y) = (
)
m[1] m[3] m[5]
(m[1] × x) + (m[3] × y) + m[5]
September 11, 2015, S6E2DH_AN709-00022-1v0-E
CONFIDENTIAL
179