mGPlus API Reference  v1.4.0
A MiniGUI component which provides support for advanced 2D graphics functions
Functions
Path

Functions

MGPLUS_EXPORT HPATH MGPlusPathCreate (MPFillMode brushMode)
 Create a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathDelete (HPATH path)
 Delete the HPATH. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathReset (HPATH path)
 Reset the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathSetAllOrientation (HPATH path, MPOrientation orientation)
 Set all path orientation. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathGetVertex (HPATH path, int idx, double *x, double *y, int *cmd)
 Get the special idx vertex of the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathGetPointCount (HPATH path, int *count)
 Get the key points count of the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathGetPoints (HPATH path, int *count, MPPOINT **pt)
 Get the key points coor of the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddLine (HPATH path, float x1, float y1, float x2, float y2)
 Add a line to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddLineI (HPATH path, int x1, int y1, int x2, int y2)
 Add a line to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddLines (HPATH path, const MPPOINT *points, int count)
 Add a series lines to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddArc (HPATH path, float cx, float cy, float rx, float ry, float startAngle, float sweepAngle)
 Add a arc to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddArcI (HPATH path, int cx, int cy, int rx, int ry, int startAngle, int sweepAngle)
 Add a arc to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddBezier (HPATH path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
 Add a bezier to the path . More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddBezierI (HPATH path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 Add a bezier to the path . More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddRoundRectEx (HPATH path, int x, int y, int width, int height, int rx, int ry)
 Add a round rect to the path . More...
 
MGPLUS_EXPORT MPStatus MGPlusPathArcto (HPATH path, double x1, double y1, double x2, double y2, double radius)
 Add a arc to a path and two tangent line of arc. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathArctoI (HPATH path, int x1, int y1, int x2, int y2, int radius)
 Add a arc to a path and two tangent line through subpath last vectors, (x1, y1), (x2, y2). More...
 
MGPLUS_EXPORT MPStatus MGPlusPathMoveto (HPATH path, float x, float y)
 Move the path to a new point. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathMovetoI (HPATH path, int x, int y)
 Move the path to a new point. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathLineto (HPATH path, float x, float y)
 Line the path to a new point. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathLinetoI (HPATH path, int x, int y)
 Line the path to a new point. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathBezierto (HPATH path, float x1, float y1, float x2, float y2, float x3, float y3)
 Add a bezier curve to the last vector. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathBeziertoI (HPATH path, int x1, int y1, int x2, int y2, int x3, int y3)
 Add a bezier curve to the last vector. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathQuadraticto (HPATH path, float x1, float y1, float x2, float y2)
 Add a quadratic curve to the last vector. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathQuadratictoI (HPATH path, int x1, int y1, int x2, int y2)
 Add a quadratic curve to the last vector. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddRectangle (HPATH path, float x, float y, float width, float height)
 Add a rectangle to the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddRectangleI (HPATH path, int x, int y, int width, int height)
 Add a rectangle to the path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddEllipse (HPATH path, float cx, float cy, float rx, float ry, BOOL clockwise)
 Add a ellipse to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddEllipseI (HPATH path, int cx, int cy, int rx, int ry, BOOL clockwise)
 Add a ellipse to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddCurve (HPATH path, const MPPOINT *points, int count)
 Add a curve to a path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathAddPath (HPATH path, HPATH add_path)
 copy a path to the other path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathStartFigure (HPATH path)
 Add a new sub path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathCloseFigure (HPATH path)
 Close the current sub path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathRotateAroundPoint (HPATH path, const MPPOINT *pt, float angle)
 Transform the special path to rotating around the point. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathSetTransform (HPATH path, MPMatrix *matrix)
 Set the transform matrix to the special path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathGetTransform (HPATH path, MPMatrix *matrix)
 Get the special path's transform matrix . More...
 
MGPLUS_EXPORT MPStatus MGPlusPathResetTransform (HPATH path)
 Reset the transform matrix of the special path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathScale (HPATH path, float sx, float sy)
 Scale the special path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathRotate (HPATH path, float angle)
 Scale the special path. More...
 
MGPLUS_EXPORT MPStatus MGPlusPathTranslate (HPATH path, float dx, float dy)
 Scale the special path. More...
 

Detailed Description

MGPlus maintains some path defines and operations

Function Documentation

MPStatus MGPlusPathAddArc ( HPATH  path,
float  cx,
float  cy,
float  rx,
float  ry,
float  startangle,
float  sweepangle 
)

Add a arc to a path.

This function adds a arc to a path.

Parameters
pathThe path pointer.
cxThe x position of the center of ellipse that contains the arc.
cyThe y position of the center of ellipse that contains the arc.
rxThe x-radius of the ellipse.
ryThe y-radius of the ellipse.
startangleThe start angle.
sweepangleThe specifies the angle, between the starting point (startangle)
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddArcI
MPStatus MGPlusPathAddArcI ( HPATH  path,
int  cx,
int  cy,
int  rx,
int  ry,
int  startangle,
int  sweepangle 
)

Add a arc to a path.

This function adds a arc to a path.

Parameters
pathThe path pointer.
cxThe x position of the center of ellipse that contains the arc.
cyThe y position of the center of ellipse that contains the arc.
rxThe x-radius of the ellipse.
ryThe y-radius of the ellipse.
startangleThe start angle.
sweepangleThe specifies the angle, between the starting point(startangle)
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddArc
MPStatus MGPlusPathAddBezier ( HPATH  path,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
float  x4,
float  y4 
)

Add a bezier to the path .

This function adds a bezier to the path.

Parameters
pathThe path pointer.
x1The start x of bezier.
y1The start y of bezier.
x2The first control x of bezier.
y2The first control y of bezier.
x3The second control x of bezier.
y3The second control y of bezier.
x4The end x of bezier.
y4The end y of bezier.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusDrawBezierI
MPStatus MGPlusPathAddBezierI ( HPATH  path,
int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
int  x4,
int  y4 
)

Add a bezier to the path .

This function adds a bezier to the path.

Parameters
pathThe path pointer.
x1The start x of bezier.
y1The start y of bezier.
x2The first control x of bezier.
y2The first control y of bezier.
x3The second control x of bezier.
y3The second control y of bezier.
x4The end x of bezier.
y4The end y of bezier.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusDrawBezier
MPStatus MGPlusPathAddCurve ( HPATH  path,
const MPPOINT points,
int  count 
)

Add a curve to a path.

This function adds a curve to a path.

Parameters
pathThe path pointer.
pointsThe points pointer.
countThe points count.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathAddEllipse ( HPATH  path,
float  cx,
float  cy,
float  rx,
float  ry,
BOOL  clockwise 
)

Add a ellipse to a path.

This function adds a ellipse to a path.

Parameters
pathThe path pointer.
cxThe x position of the center of the ellipse.
cyThe y position of the center of the ellipse.
rxThe x-radius of the ellipse.
ryThe y-radius of the ellipse.
clockwiseThe direction, if TRUE, it is clockwise, else counter-clockwise.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddEllipseI
MPStatus MGPlusPathAddEllipseI ( HPATH  path,
int  cx,
int  cy,
int  rx,
int  ry,
BOOL  clockwise 
)

Add a ellipse to a path.

This function adds a ellipse to a path.

Parameters
pathThe path pointer.
cxThe x position of the center of the ellipse.
cyThe y position of the center of the ellipse.
rxThe x-radius of the ellipse.
ryThe y-radius of the ellipse.
clockwiseThe direction if TRUE, it is clockwise, else counter-clockwise.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddEllipse
MPStatus MGPlusPathAddLine ( HPATH  path,
float  x1,
float  y1,
float  x2,
float  y2 
)

Add a line to a path.

This function adds a line to a path.

Parameters
pathThe path pointer.
x1The start x of the line.
y1The start y of the line.
x2The end x of the line.
y2The end y of the line.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddLineI
MPStatus MGPlusPathAddLineI ( HPATH  path,
int  x1,
int  y1,
int  x2,
int  y2 
)

Add a line to a path.

This function adds a line to a path.

Parameters
pathThe path pointer.
x1The start x of the line.
y1The start y of the line.
x2The end x of the line.
y2The end y of the line.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddLine
MPStatus MPStatus MGPlusPathAddLines ( HPATH  path,
const MPPOINT points,
int  count 
)

Add a series lines to a path.

This function adds a series lines to a path.

Parameters
pathThe path pointer.
pointsThe points pointer.
countThe number of points.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusAddPathLine
MPStatus MGPlusPathAddPath ( HPATH  path,
HPATH  add_path 
)

copy a path to the other path.

This function copies a path to the other path.

Parameters
pathThe dst path pointer.
add_pathThe src path pointer.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathAddRectangle ( HPATH  path,
float  x,
float  y,
float  width,
float  height 
)

Add a rectangle to the path.

This function adds a rectangle to the path.

Parameters
pathThe MGPlusPath pointer.
xThe left x of the rectangle.
yThe top y of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddRectangleI
MPStatus MGPlusPathAddRectangleI ( HPATH  path,
int  x,
int  y,
int  width,
int  height 
)

Add a rectangle to the path.

This function adds a rectangle to the path.

Parameters
pathThe path pointer.
xThe left x of the rectangle.
yThe top y of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathAddRectangle
MPStatus MGPlusPathAddRoundRectEx ( HPATH  path,
int  x,
int  y,
int  width,
int  height,
int  rx,
int  ry 
)

Add a round rect to the path .

This function adds a bezier to the path.

Parameters
pathThe path pointer.
xThe left x of the rectangle.
yThe top y of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
rxThe radius width of round rect arc.
ryThe radius height of round rect arc.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusDrawBezier
MPStatus MPStatus MGPlusPathArcto ( HPATH  path,
double  x1,
double  y1,
double  x2,
double  y2,
double  radius 
)

Add a arc to a path and two tangent line of arc.

This function add a arc to a path and two tangent line of arc, first line through subpath last vectors to (x1, y1), second line through one arc point to (x2, y2). supported by mGPlus V1.2.1 or upper.

------—(last vector) -— (x1,y1) -— (point of tangent).

                                 arc

                                    |(point of tangent).
                                    |
                                    | 
                                    (x2,y2)
Parameters
pathThe path pointer.
x1The x coordinat of first point .
y1The y coordinat of first point .
x2The x coordinat of second point .
y2The y coordinat of second point .
radiusThe arc radius.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathArctoI
MPStatus MPStatus MGPlusPathArctoI ( HPATH  path,
int  x1,
int  y1,
int  x2,
int  y2,
int  radius 
)

Add a arc to a path and two tangent line through subpath last vectors, (x1, y1), (x2, y2).

This function add a arc to a path and two tangent line through subpath last vectors, (x1, y1), (x2, y2), supported by mGPlus V1.2.1 or upper.

Parameters
pathThe path pointer.
x1The x coordinat of first point .
y1The y coordinat of first point .
x2The x coordinat of second point .
y2The y coordinat of second point .
radiusThe arc radius.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathArcto
MPStatus MGPlusPathBezierto ( HPATH  path,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

Add a bezier curve to the last vector.

This function adds a bezier curve to the last vector, supported by mGPlus V1.2.1 or upper.

Parameters
pathThe MGPlusPath pointer.
x1The first control point x coordinate.
y1The first control point y coordinate.
x2The second control point x coordinate.
y2The second control point y coordinate.
x3The last point x coordinate.
y3The last point y coordinate.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathBeziertoI
MPStatus MGPlusPathBeziertoI ( HPATH  path,
int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

Add a bezier curve to the last vector.

This function adds a bezier curve to the last vector, supported by mGPlus V1.2.1 or upper.

Parameters
pathThe MGPlusPath pointer.
x1The first control point x coordinate.
y1The first control point y coordinate.
x2The second control point x coordinate.
y2The second control point y coordinate.
x3The last point x coordinate.
y3The last point y coordinate.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathBezierto
MPStatus MGPlusPathCloseFigure ( HPATH  path)

Close the current sub path.

This function closes the current sub path.

Parameters
pathThe path pointer.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathStartFigure
HPATH MGPlusPathCreate ( MPFillMode  brushMode)

Create a path.

This function creates a path, and return the HPATH.

Parameters
brushModeThe path filled mode.
Returns
If success, it returns the HPATH.
See also
MGPlusPathDelete
MPStatus MGPlusPathDelete ( HPATH  path)

Delete the HPATH.

This function deletes the path.

Parameters
pathThe path need to be deleted.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathCreate
MPStatus MGPlusPathGetPointCount ( HPATH  path,
int *  count 
)

Get the key points count of the path.

This function gets the key points count of the path.

Parameters
pathThe path pointer.
countThe path count pointer.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathGetPoints ( HPATH  path,
int *  count,
MPPOINT **  pt 
)

Get the key points coor of the path.

This function gets the key points coor of the path.

Parameters
pathThe path pointer.
countThe path count pointer.
ptThe path point coor pointer.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathGetTransform ( HPATH  path,
MPMatrix matrix 
)

Get the special path's transform matrix .

This funciton gets the special path's transform matrix, supported by mGPlus V1.2.1 or upper.

Parameters
pathThe path.
matrixThe translate matrix.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathGetVertex ( HPATH  path,
int  idx,
double *  x,
double *  y,
int *  cmd 
)

Get the special idx vertex of the path.

This function gets the key points count of the path.

Parameters
pathThe path pointer.
idxThe vertex idx.
xThe pointer of get vertex's x coord .
yThe pointer of get vertex's y coord .
cmdThe vertex cmd type of point.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathLineto ( HPATH  path,
float  x,
float  y 
)

Line the path to a new point.

This function lines the path to a new point.

Parameters
pathThe MGPlusPath pointer.
xThe left x of the point.
yThe top y of the point.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathLinetoI
MPStatus MGPlusPathLinetoI ( HPATH  path,
int  x,
int  y 
)

Line the path to a new point.

This function lines the path to a new point.

Parameters
pathThe MGPlusPath pointer.
xThe left x of the point.
yThe top y of the point.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathLineto
MPStatus MGPlusPathMoveto ( HPATH  path,
float  x,
float  y 
)

Move the path to a new point.

This function moves the path to a new point.

Parameters
pathThe MGPlusPath pointer.
xThe left x of the point.
yThe top y of the point.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathMovetoI
MPStatus MGPlusPathMovetoI ( HPATH  path,
int  x,
int  y 
)

Move the path to a new point.

This function moves the path to a new point.

Parameters
pathThe MGPlusPath pointer.
xThe left x of the point.
yThe top y of the point.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathMoveto
MPStatus MGPlusPathQuadraticto ( HPATH  path,
float  x1,
float  y1,
float  x2,
float  y2 
)

Add a quadratic curve to the last vector.

This function adds a quadratic curve to the last vector supported by mGPlus V1.2.1 or upper.

Parameters
pathThe MGPlusPath pointer.
x1The control point x coordinate.
y1The control point y coordinate.
x2The last point x coordinate.
y2The last point y coordinate.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathQuadratictoI
MPStatus MGPlusPathQuadratictoI ( HPATH  path,
int  x1,
int  y1,
int  x2,
int  y2 
)

Add a quadratic curve to the last vector.

This function adds a quadratic curve to the last vector supported by mGPlus V1.2.1 or upper.

Parameters
pathThe MGPlusPath pointer.
x1The control point x coordinate.
y1The control point y coordinate.
x2The last point x coordinate.
y2The last point y coordinate.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathQuadraticto
MPStatus MGPlusPathReset ( HPATH  path)

Reset the path.

This function resets the path.

Parameters
pathThe path need to be reset.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathResetTransform ( HPATH  path)

Reset the transform matrix of the special path.

Parameters
pathThe operate path.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathRotate ( HPATH  path,
float  angle 
)

Scale the special path.

Parameters
pathpath.
angleThe rotation angle.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathRotateAroundPoint ( HPATH  path,
const MPPOINT pt,
float  angle 
)

Transform the special path to rotating around the point.

Parameters
pathThe path.
ptThe translate center point.
angleThe the rotation angle.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathScale ( HPATH  path,
float  sx,
float  sy 
)

Scale the special path.

Parameters
pathThe operate path.
sxThe x scaling factor.
syThe y scaling factor.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathSetAllOrientation ( HPATH  path,
MPOrientation  orientation 
)

Set all path orientation.

This function set all path orientation.

Parameters
pathThe path need to be set.
orientationThe path direction.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
MPStatus MGPlusPathSetTransform ( HPATH  path,
MPMatrix matrix 
)

Set the transform matrix to the special path.

Parameters
pathThe path.
matrixThe translate matrix.
Returns
If success return MP_OK, else return MP_GENERIC_ERROR.
MPStatus MGPlusPathStartFigure ( HPATH  path)

Add a new sub path.

This function adds a new sub path.

Parameters
pathThe path pointer.
Returns
Get Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusPathCloseFigure
MPStatus MGPlusPathTranslate ( HPATH  path,
float  dx,
float  dy 
)

Scale the special path.

Parameters
pathThe path.
dxThe dx translation distance.
dyThe dy translation distance.
Returns
if success return MP_OK, else return MP_GENERIC_ERROR.