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

Functions

MGPLUS_EXPORT HGRAPHICS MGPlusGraphicCreateFromDC (HDC hdc)
 Create Graphic’s buffer through hdc. More...
 
MGPLUS_EXPORT HGRAPHICS MGPlusGraphicCreateWithoutCanvas (HDC hdc)
 Create graphic from hdc and use hdc's surface as canvas. More...
 
MGPLUS_EXPORT HDC MGPlusGetGraphicDC (HGRAPHICS graphic)
 Get graphic’s buffer hdc. More...
 
MGPLUS_EXPORT HGRAPHICS MGPlusGraphicCreate (int width, int height)
 Create graphic. More...
 
MGPLUS_EXPORT int MGPlusSaveHG (HGRAPHICS hg)
 Save the graphic to stack. More...
 
MGPLUS_EXPORT BOOL MGPlusRestoreHG (HGRAPHICS hg, int saved_hg)
 Restore the graphic. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicCopyFromDC (HGRAPHICS graphic, HDC hdc, int sx, int sy, int sw, int sh, int dx, int dy)
 Copy the hdc content to graphic. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicCopy (HGRAPHICS src_gs, HGRAPHICS dst_gs)
 Copy the src graphic to dst. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicBlend (HGRAPHICS src_gs, HGRAPHICS dst_gs)
 Blend between Graphic’s buffer. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicClearEx (HGRAPHICS graphics, RECT *rect, ARGB color)
 Use color to clear graphics with the specific rect. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicSave (HGRAPHICS graphics, HDC hdc, int sx, int sy, int sw, int sh, int dx, int dy)
 Create Graphic’s buffer through hdc. More...
 
MGPLUS_EXPORT MPStatus MGPlusGraphicDelete (HGRAPHICS graphics)
 Delete the graphic. More...
 

Detailed Description

MGPlus maintains some graphics defines and operations

Function Documentation

MGPLUS_EXPORT HDC MGPlusGetGraphicDC ( HGRAPHICS  graphic)

Get graphic’s buffer hdc.

This function get graphic’s buffer hdc.

Parameters
graphicThe MGPlusGraphics pointer.
Returns
HDC if success, else return MP_GENERIC_ERROR.
See also
MGPlusDeleteGraphics
MPStatus MGPlusGraphicBlend ( HGRAPHICS  src_gs,
HGRAPHICS  dst_gs 
)

Blend between Graphic’s buffer.

This function Blends source MGPlusGraphics from dest MGPlusGraphics.

Parameters
src_gsThe source MGPlusGraphics pointer.
dst_gsThe dest MGPlusGraphics pointer.
Returns
MP_GENERIC_ERROR indicates an error.
See also
MGPlusDeleteGraphics
MPStatus MGPlusGraphicClearEx ( HGRAPHICS  graphics,
RECT *  rect,
ARGB  color 
)

Use color to clear graphics with the specific rect.

This function uses color to clear graphics with the specific rect, supported by mGPlus V1.2.1 or upper.

Parameters
graphicsThe MGPlusGraphics pointer
rectThe specific rect
colorThe clear color
Returns
Clear Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusDeleteGraphics
MPStatus MGPlusGraphicCopy ( HGRAPHICS  src_gs,
HGRAPHICS  dst_gs 
)

Copy the src graphic to dst.

This function copies the src graphic to dst.

Parameters
src_gsThe source MGPlusGraphics pointer.
dst_gsThe dest MGPlusGraphics pointer.
Returns
MP_GENERIC_ERROR indicates an error.
See also
MGPlusDeleteGraphics
MPStatus MGPlusGraphicCopyFromDC ( HGRAPHICS  graphic,
HDC  hdc,
int  sx,
int  sy,
int  sw,
int  sh,
int  dx,
int  dy 
)

Copy the hdc content to graphic.

This function copys the hdc content to graphic.

Parameters
graphicThe MGPlusGraphics pointer.
hdcThe copy hdc.
sxThe x coordinate of the upper-left corner of the rectangle in the source DC.
syThe y coordinate of the upper-left corner of the rectangle in the source DC.
swThe width of the source rectangle.
shThe height of the source rectangle.
dxThe x coordinate of the upper-left corner of the rectangle in the destination DC.
dyThe y coordinate of the upper-left corner of the rectangle in the destination DC.
See also
MGPlusDeleteGraphics
HGRAPHICS MGPlusGraphicCreate ( int  width,
int  height 
)

Create graphic.

This function creates MGPlusGraphics from specical size.

Parameters
widthThe width of the graphics's surface
heightThe height of the graphics's surface
Returns
HGRAPHICS when succeed to create, or else NULL indicates an error.
See also
MGPlusDeleteGraphics
HGRAPHICS MGPlusGraphicCreateFromDC ( HDC  hdc)

Create Graphic’s buffer through hdc.

This function creates MGPlusGraphics from specical hdc and returns the create status.

Parameters
hdcThe handle of hdc.
Returns
HGRAPHICS when succeed to create, or NULL indicates an error.
See also
MGPlusDeleteGraphics
HGRAPHICS MGPlusGraphicCreateWithoutCanvas ( HDC  hdc)

Create graphic from hdc and use hdc's surface as canvas.

This function creates MGPlusGraphics from specical hdc, but use hdc's surface as canvas of thr Graphics.

Parameters
hdcThe handle of hdc.
Returns
HGRAPHICS when succeed to create, or NULL indicates an error.
See also
MGPlusDeleteGraphics
MPStatus MGPlusGraphicDelete ( HGRAPHICS  graphics)

Delete the graphic.

This function deletes MGPlusGraphics

Parameters
graphicsThe MGPlusGraphics pointer.
Returns
Delete Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusGraphicsCreate
MPStatus MGPlusGraphicSave ( HGRAPHICS  graphics,
HDC  hdc,
int  sx,
int  sy,
int  sw,
int  sh,
int  dx,
int  dy 
)

Create Graphic’s buffer through hdc.

This function creates MGPlusGraphics from specical pix format and returns the create status.

Parameters
graphicsThe MGPlusGraphics pointer.
hdcThe dst hdc.
sxThe x coordinate of the upper-left corner of the rectangle in the source DC.
syThe y coordinate of the upper-left corner of the rectangle in the source DC.
swThe width of the source rectangle.
shThe height of the source rectangle.
dxThe x coordinate of the upper-left corner of the rectangle in the destination DC.
dyThe y coordinate of the upper-left corner of the rectangle in the destination DC.
Returns
Create Status, MP_GENERIC_ERROR indicates an error.
See also
MGPlusDeleteGraphics
HGRAPHICS MGPlusRestoreHG ( HGRAPHICS  hg,
int  saved_hg 
)

Restore the graphic.

This function restores graphic from saved stack, supported by mGPlus V1.2.1 or upper.

Parameters
hgThe Graphic handle.
saved_hgThe save_hg Specifies the saved state to be restored. If this parameter is positive, saved_hg represents a specific instance of the state to be restored. If this parameter is negative, saved_dc represents an instance relative to the current state. For example, -1 restores the most recently saved state.
Returns
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
See also
MGPlusSaveHG
MGPLUS_EXPORT int MGPlusSaveHG ( HGRAPHICS  hg)

Save the graphic to stack.

This function saves the graphic to stack, supported by mGPlus V1.2.1 or upper.

Parameters
hgThe Graphic handle.
Returns
If succee, return states, else return zero.
See also
MGPlusResotreHG