![]() |
µGFX
2.9
version 2.9
|
Module which contains different features such as array conversions.
Data Structures | |
struct | MatrixFloat2D |
A matrix for doing 2D graphics using floats. More... | |
struct | MatrixFixed2D |
A matrix for doing 2D graphics using fixed point maths. More... | |
Functions | |
void | gmiscArrayConvert (ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, gMemSize cnt) |
Convert from one array format to another array format. More... | |
float | invsqrt (float n) |
Fast inverse square root function (x^-1/2) More... | |
void | gmiscMatrixFloat2DApplyToPoints (gPoint *dst, const gPoint *src, const MatrixFloat2D *m, int cnt) |
Apply the matrix to a set of points. More... | |
void | gmiscMatrixFloat2DSetIdentity (MatrixFloat2D *m) |
Set the 2D matrix to the identity matrix. More... | |
void | gmiscMatrixFloat2DMultiply (MatrixFloat2D *dst, const MatrixFloat2D *src1, const MatrixFloat2D *src2) |
Multiple two 2D matrixes together. More... | |
void | gmiscMatrixFloat2DApplyTranslation (MatrixFloat2D *dst, const MatrixFloat2D *src, float tx, float ty) |
Add an x,y translation to a matrix. More... | |
void | gmiscMatrixFloat2DApplyScale (MatrixFloat2D *dst, const MatrixFloat2D *src, float sx, float sy) |
Add x,y scaling to a matrix. More... | |
void | gmiscMatrixFloat2DApplyShear (MatrixFloat2D *dst, const MatrixFloat2D *src, float sx, float sy) |
Add x,y shear to a matrix. More... | |
void | gmiscMatrixFloat2DApplyRotation (MatrixFloat2D *dst, const MatrixFloat2D *src, int angle) |
Add rotation to a matrix. More... | |
void | gmiscMatrixFixed2DApplyToPoints (gPoint *dst, const gPoint *src, const MatrixFixed2D *m, int cnt) |
Apply the matrix to a set of points. More... | |
void | gmiscMatrixFixed2DSetIdentity (MatrixFixed2D *m) |
Set the 2D matrix to the identity matrix. More... | |
void | gmiscMatrixFixed2DMultiply (MatrixFixed2D *dst, const MatrixFixed2D *src1, const MatrixFixed2D *src2) |
Multiple two 2D matrixes together. More... | |
void | gmiscMatrixFixed2DApplyTranslation (MatrixFixed2D *dst, const MatrixFixed2D *src, fixed tx, fixed ty) |
Add an x,y translation to a matrix. More... | |
void | gmiscMatrixFixed2DApplyScale (MatrixFixed2D *dst, const MatrixFixed2D *src, fixed sx, fixed sy) |
Add x,y scaling to a matrix. More... | |
void | gmiscMatrixFixed2DApplyShear (MatrixFixed2D *dst, const MatrixFixed2D *src, fixed sx, fixed sy) |
Add x,y shear to a matrix. More... | |
void | gmiscMatrixFixed2DApplyRotation (MatrixFixed2D *dst, const MatrixFixed2D *src, int angle) |
Add rotation to a matrix. More... | |
gBool | gmiscHittestPoly (const gPoint *pntarray, unsigned cnt, const gPoint *p) |
Check whether a point is inside or on the edge of a polygon. More... | |
double | fsin (int degrees) |
Fast Table Based Trig functions. More... | |
fixed | ffsin (int degrees) |
Fast Table Based Trig functions. More... | |
#define | FIXED(x) ((fixed)(x)<<16) /* @< integer to fixed */ |
Macros to convert to and from a fixed point. More... | |
#define | FSIN(degrees) sintabledouble[degrees]; |
Fast Table Based Trig functions. More... | |
#define | FFSIN(degrees) sintablefixed[degrees]; |
Fast Table Based Trig functions. More... | |
GMISC Functionality to be included | |
#define | GMISC_NEED_ARRAYOPS GFXOFF |
Include array operation functions. More... | |
#define | GMISC_NEED_FASTTRIG GFXOFF |
Include fast floating point trig functions (fsin, fcos) More... | |
#define | GMISC_NEED_FIXEDTRIG GFXOFF |
Include fast fixed point trig functions (ffsin, ffcos) More... | |
#define | GMISC_NEED_INVSQRT GFXOFF |
Include fast inverse square root (x^-1/2) More... | |
#define | GMISC_NEED_HITTEST_POLY GFXOFF |
Include polygon hit test functions. More... | |
GMISC Optional Parameters | |
#define | GMISC_INVSQRT_MIXED_ENDIAN GFXOFF |
Modifies the invsqrt() function to assume a different integer to floating point endianness. More... | |
#define | GMISC_INVSQRT_REAL_SLOW GFXOFF |
Modifies the invsqrt() function to do things the long slow way. More... | |
Macros | |
#define | gfxSampleFormatIsSigned(fmt) ((fmt) & 1) |
Is the sample data format a "signed" data format? More... | |
#define | gfxSampleFormatBits(fmt) ((fmt) & ~1) |
How many bits are in the sample data format. More... | |
#define | FIXED_PI FP2FIXED(GFX_PI) |
The famous number pi. More... | |
Typedefs | |
typedef enum ArrayDataFormat_e | ArrayDataFormat |
Sample data formats. More... | |
typedef gI32 | fixed |
The type for a fixed point type. More... | |
typedef struct MatrixFloat2D | MatrixFloat2D |
A matrix for doing 2D graphics using floats. More... | |
typedef struct MatrixFixed2D | MatrixFixed2D |
A matrix for doing 2D graphics using fixed point maths. More... | |
Enumerations | |
enum | ArrayDataFormat_e |
Sample data formats. More... | |
fixed ffsin | ( | int | degrees | ) |
Fast Table Based Trig functions.
[in] | degrees | The angle in degrees (not radians) |
double fsin | ( | int | degrees | ) |
Fast Table Based Trig functions.
[in] | degrees | The angle in degrees (not radians) |
void gmiscArrayConvert | ( | ArrayDataFormat | srcfmt, |
void * | src, | ||
ArrayDataFormat | dstfmt, | ||
void * | dst, | ||
gMemSize | cnt | ||
) |
Convert from one array format to another array format.
[in] | srcfmt | The format of the source array |
[in] | src | The source array |
[in] | dstfmt | The format of the destination array |
[in] | dst | The dstination array |
[in] | cnt | The number of array elements to convert |
Check whether a point is inside or on the edge of a polygon.
[in] | pntarray | The array of points that form the polygon |
[in] | cnt | The number of points in the point array pntarray |
[in] | p | The point to test |
gTrue
if the point p
is inside or on the edge of the polygon pntarray
, gFalse
otherwise.void gmiscMatrixFixed2DApplyRotation | ( | MatrixFixed2D * | dst, |
const MatrixFixed2D * | src, | ||
int | angle | ||
) |
Add rotation to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | angle | The angle to apply in degrees (not radians). |
void gmiscMatrixFixed2DApplyScale | ( | MatrixFixed2D * | dst, |
const MatrixFixed2D * | src, | ||
fixed | sx, | ||
fixed | sy | ||
) |
Add x,y scaling to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | sx,sy | The scaling to apply in the x and y direction. Negative numbers give reflection. |
void gmiscMatrixFixed2DApplyShear | ( | MatrixFixed2D * | dst, |
const MatrixFixed2D * | src, | ||
fixed | sx, | ||
fixed | sy | ||
) |
Add x,y shear to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | sx,sy | The shear to apply in the x and y direction. |
void gmiscMatrixFixed2DApplyToPoints | ( | gPoint * | dst, |
const gPoint * | src, | ||
const MatrixFixed2D * | m, | ||
int | cnt | ||
) |
Apply the matrix to a set of points.
[in] | dst | The destination array of points |
[in] | src | The source array of points |
[in] | m | The matrix to apply |
[in] | cnt | How many points are in the array |
void gmiscMatrixFixed2DApplyTranslation | ( | MatrixFixed2D * | dst, |
const MatrixFixed2D * | src, | ||
fixed | tx, | ||
fixed | ty | ||
) |
Add an x,y translation to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | tx,ty | The x and y translation to apply |
void gmiscMatrixFixed2DMultiply | ( | MatrixFixed2D * | dst, |
const MatrixFixed2D * | src1, | ||
const MatrixFixed2D * | src2 | ||
) |
Multiple two 2D matrixes together.
[in] | dst | The destination matrix |
[in] | src1 | The first source matrix |
[in] | src2 | The second source matrix |
void gmiscMatrixFixed2DSetIdentity | ( | MatrixFixed2D * | m | ) |
Set the 2D matrix to the identity matrix.
[in] | m | The matrix to set to identity |
void gmiscMatrixFloat2DApplyRotation | ( | MatrixFloat2D * | dst, |
const MatrixFloat2D * | src, | ||
int | angle | ||
) |
Add rotation to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | angle | The angle to apply in degrees (not radians). |
void gmiscMatrixFloat2DApplyScale | ( | MatrixFloat2D * | dst, |
const MatrixFloat2D * | src, | ||
float | sx, | ||
float | sy | ||
) |
Add x,y scaling to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | sx,sy | The scaling to apply in the x and y direction. Negative numbers give reflection. |
void gmiscMatrixFloat2DApplyShear | ( | MatrixFloat2D * | dst, |
const MatrixFloat2D * | src, | ||
float | sx, | ||
float | sy | ||
) |
Add x,y shear to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | sx,sy | The shear to apply in the x and y direction. |
void gmiscMatrixFloat2DApplyToPoints | ( | gPoint * | dst, |
const gPoint * | src, | ||
const MatrixFloat2D * | m, | ||
int | cnt | ||
) |
Apply the matrix to a set of points.
[in] | dst | The destination array of points |
[in] | src | The source array of points |
[in] | m | The matrix to apply |
[in] | cnt | How many points are in the array |
void gmiscMatrixFloat2DApplyTranslation | ( | MatrixFloat2D * | dst, |
const MatrixFloat2D * | src, | ||
float | tx, | ||
float | ty | ||
) |
Add an x,y translation to a matrix.
[in] | dst | The destination matrix |
[in] | src | The source matrix. Can be NULL |
[in] | tx,ty | The x and y translation to apply |
void gmiscMatrixFloat2DMultiply | ( | MatrixFloat2D * | dst, |
const MatrixFloat2D * | src1, | ||
const MatrixFloat2D * | src2 | ||
) |
Multiple two 2D matrixes together.
[in] | dst | The destination matrix |
[in] | src1 | The first source matrix |
[in] | src2 | The second source matrix |
void gmiscMatrixFloat2DSetIdentity | ( | MatrixFloat2D * | m | ) |
Set the 2D matrix to the identity matrix.
[in] | m | The matrix to set to identity |
float invsqrt | ( | float | n | ) |
Fast inverse square root function (x^-1/2)
[in] | n | The number to find the inverse square root of |
#define FFSIN | ( | degrees | ) | sintablefixed[degrees]; |
Fast Table Based Trig functions.
[in] | degrees | The angle in degrees 0 .. 359 |
#define FIXED_PI FP2FIXED(GFX_PI) |
#define FSIN | ( | degrees | ) | sintabledouble[degrees]; |
Fast Table Based Trig functions.
[in] | degrees | The angle in degrees 0 .. 359 |
#define gfxSampleFormatBits | ( | fmt | ) | ((fmt) & ~1) |
#define gfxSampleFormatIsSigned | ( | fmt | ) | ((fmt) & 1) |
#define GMISC_INVSQRT_MIXED_ENDIAN GFXOFF |
Modifies the invsqrt()
function to assume a different integer to floating point endianness.
If you have a software floating point that uses a non-standard floating point format (or very strange hardware) then define GMISC_INVSQRT_REAL_SLOW and it will do it the hard way.
Definition at line 78 of file gmisc_options.h.
#define GMISC_INVSQRT_REAL_SLOW GFXOFF |
Modifies the invsqrt()
function to do things the long slow way.
invsqrt()
function to work regardless of the processor floating point format. invsqrt()
function very slow. Definition at line 87 of file gmisc_options.h.
#define GMISC_NEED_ARRAYOPS GFXOFF |
Include array operation functions.
Defaults to GFXOFF
Definition at line 28 of file gmisc_options.h.
#define GMISC_NEED_FASTTRIG GFXOFF |
Include fast floating point trig functions (fsin, fcos)
Defaults to GFXOFF
Definition at line 35 of file gmisc_options.h.
#define GMISC_NEED_FIXEDTRIG GFXOFF |
Include fast fixed point trig functions (ffsin, ffcos)
Defaults to GFXOFF
Definition at line 42 of file gmisc_options.h.
#define GMISC_NEED_HITTEST_POLY GFXOFF |
Include polygon hit test functions.
Defaults to GFXOFF
Definition at line 56 of file gmisc_options.h.
#define GMISC_NEED_INVSQRT GFXOFF |
Include fast inverse square root (x^-1/2)
Defaults to GFXOFF
Definition at line 49 of file gmisc_options.h.
typedef enum ArrayDataFormat_e ArrayDataFormat |
Sample data formats.
typedef gI32 fixed |
typedef struct MatrixFixed2D MatrixFixed2D |
A matrix for doing 2D graphics using fixed point maths.
typedef struct MatrixFloat2D MatrixFloat2D |
A matrix for doing 2D graphics using floats.
enum ArrayDataFormat_e |