(new in Rev4.02)
MQCanvas class is contained in MQWidgetPaintParam structure on an painting event. A drawing to the screen is performed by this class.
Class | |
MQCanvas | Constructor |
~MQCanvas | Destructor |
Member functions | |
SetColor | Set a color |
SetGradientColor | Set a gradation color |
SetStrokeWidth | Set a stroke width |
SetStrokeCap | Set a stroke cap |
SetStrokeJoin | Set a stroke join |
SetStrokeMiterLimit | Set a miter limit |
SetStrokeDash | Set a dash line |
SetFont | Set a font |
SetFontSize | Set a font size |
SetFontRateSize | Set a font rate size |
SetAntiAlias | Set an anti-alias |
PushClipRect | Set a clipping rectangle |
PopClipRect | Restore a clipping rectangle |
Clear | Fill the whole canvas |
DrawLine | Draw a line |
DrawPolyline | Draw a polyline |
DrawCircle | Draw a circle |
FillCircle | Fill a circle |
DrawEllipse | Draw an ellipse |
FillEllipse | Fill an ellipse |
DrawRect | Draw a rectangle |
FillRect | Fill a rectangle |
DrawRoundRect | Draw a round rectangle |
FillRoundRect | Fill a round rectangle |
DrawPolygon | Draw a polygon |
FillPolygon | Fill a polygon |
DrawDIB | Draw a bitmap |
DrawText | Draw a text |
MeasureText | Calculate a drawing size for a text |
MQCanvas::MQCanvas(void *ptr);
It is a constructor.
It is not necessary to call this method immediately. A class created automatically in SDK is provided to a plug-in.
MQCanvas::~MQCanvas();
This method is a destructor.
void MQCanvas::SetColor(int r, int g, int b, int a);
void MQCanvas::SetColor(const MQCanvasColor& col)
It specifies a color used in each drawing function.
void MQCanvas::SetGradientColor(int x1, int y1, int x2, int y2, const std::vector
void MQCanvas::SetGradientColor(float x1, float y1, float x2, float y2, const std::vector
It specifies a gradation color transferring between the begin point and the end point.
A gradation color is canceled by calling SetColor().
void MQCanvas::SetStrokeWidth(float width);
It specifies a width for drawing a line.
void MQCanvas::SetStrokeCap(MQCANVAS_CAP_TYPE cap);
It specifies a method of drawing a line cap.
void MQCanvas::SetStrokeJoin(MQCANVAS_JOIN_TYPE join);
It specifies a method of drawing a line joint.
void MQCanvas::SetStrokeMiterLimit(float limit);
It specifies a miter limit.
void MQCanvas::SetStrokeDash(const std::vector
It specifies a length and an interval for a dash line.
Please specify an empty array when you want to finish drawing a dash line.
void MQCanvas::SetFont(const wchar_t *fontname, bool bold);
It specifies a font for drawing a text.
The font name must exist in the system, and the font must correspond to the drawing character code.
void MQCanvas::SetFontSize(int size);
It specifies a font size.
void MQCanvas::SetFontRateSize(float rate);
It specifies a font size by the ratio of the default font.
void MQCanvas::SetAntiAlias(bool val);
It specifies whether an anti-alias is enabled or disabled.
void MQCanvas::PushClipRect(int x, int y, int w, int h);
It specifies a clipping rectangle.
It is necessary to call PopClipRect() after drawing. When PushClipRect() was called several times, PopClipRect() must be call same times.
void MQCanvas::PopClipRect();
It restores a clipping rectangle set by PushClipRect()/
void MQCanvas::Clear(int r, int g, int b, int a);
void MQCanvas::Clear(const MQCanvasColor& col);
It fills the whole canvas with the speicifed color.
void MQCanvas::DrawLine(int x1, int y1, int x2, int y2);
void MQCanvas::DrawLine(float x1, float y1, float x2, float y2);
It draws a line between specified two points.
void MQCanvas::DrawPolyline(POINT *points, int num_points);
void MQCanvas::DrawPolyline(MQCanvasPoint *points, int num_points);
It draws a polyline.
void MQCanvas::DrawCircle(int x, int y, float r);
void MQCanvas::DrawCircle(float x, float y, float r);
It draws a circle.
void MQCanvas::FillCircle(int x, int y, float r);
void MQCanvas::FillCircle(float x, float y, float r);
It fills in a circle.
void MQCanvas::DrawEllipse(int x, int y, float rx, float ry);
void MQCanvas::DrawEllipse(float x, float y, float rx, float ry);
It draws a circle.
void MQCanvas::FillEllipse(int x, int y, float rx, float ry);
void MQCanvas::FillEllipse(float x, float y, float rx, float ry);
It fills in an ellipse.
void MQCanvas::DrawRect(int x, int y, int w, int h);
void MQCanvas::DrawRect(float x, float y, float w, float h);
It draws a rectangle.
void MQCanvas::FillRect(int x, int y, int w, int h);
void MQCanvas::FillRect(float x, float y, float w, float h);
It fills in a rectangle.
void MQCanvas::DrawRoundRect(int x, int y, int w, int h, int rx, int ry);
void MQCanvas::DrawRoundRect(float x, float y, float w, float h, float rx, float ry);
It draws a rectangle with a corner round.
void MQCanvas::FillRoundRect(int x, int y, int w, int h, int rx, int ry);
void MQCanvas::FillRoundRect(float x, float y, float w, float h, float rx, float ry);
It fills in a rectangle with a corner round.
void MQCanvas::DrawPolygon(POINT *points, int num_points);
void MQCanvas::DrawPolygon(MQCanvasPoint *points, int num_points);
It draws a polygon.
void MQCanvas::FillPolygon(POINT *points, int num_points);
void MQCanvas::FillPolygon(MQCanvasPoint *points, int num_points);
It fills in a polygon.
void MQCanvas::DrawDIB(void *header, void *buffer, int x, int y);
void MQCanvas::DrawDIB(void *header, void *buffer, int x, int y, int w, int h);
It draws a DIB (Device Independent Bitmap) at the specified position.
header contains BITMAPINFOHEADER structure, and RGBQUAD arrays (in 8bit or less image)
buffer contains an image data.
void MQCanvas::DrawText(const wchar_t *str, int x, int y, int w, int h, bool horz_center, bool vert_center = true);
It draws a string in the speicified area.
POINT MQCanvas::MeasureText(const wchar_t *str);
It calculates a drawing size for the specified text.