// Fill/Stroke
l void fill();
l void stroke();
l void clip();
l bool isPointInPath(qreal x, qreal y) const;
// Image manipulation (Draw CImageWgt using target and source rect)
l void drawImage(QObject *pObjImage, qreal sx, qreal sy,qreal sw, qreal sh, qreal dx, qreal dy,qreal dw, qreal dh);
l void drawImage(QObject *pObjImage, qreal dx, qreal dy);
l void drawImage(QObject *pObjImage, qreal dx, qreal dy, qreal dw, qreal dh);
l void drawImage(const QVariant& image, int width, int height, const QString& format, qreal sx, qreal sy,qreal sw,
qreal sh, qreal dx, qreal dy,qreal dw, qreal dh);
// Pixel manipulation
l ImageData createImageData(double sw, double sh);//Empty Image
l ImageData createImageData(ImageData fromImage);//from another Image
l ImageData createImageData(ArrayBuffer value); //From arraybuffer
l void putImageData(ImageData imgData,double dx, double dy);
l void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth,
double dirtyHeight);
l ImageData getImageData(qreal sx, qreal sy, qreal sw, qreal sh);
Canvas JavaScript Example
The canvas is initially blank. To display something, a script first needs to access the rendering context and draw on it:
var ctx = me.context2d;
then you can use the canvas methods, as in the below example
function GenericCanvasWgt1_onDraw(me, eventInfo)
{
var ctx = me.context2d;
ctx.fillStyle = 'red';
ctx.fillRect(0,0,250,250);
ctx.fillStyle = 'green';
ctx.fillRect(250,0,250,250);
ctx.fillStyle = 'blue';
ctx.fillRect(0,250,250,250);
ctx.fillStyle = 'black';
ctx.fillRect(250,250,250,250);
}
function GenericCanvasWgt1_onMouseDown(me, eventInfo)
{
alert("X = " + eventInfo.posX + "\nY = " + eventInfo.posY );
HMWIN Studio |User Manual| v206 (2017-06-30) | EN| © 2014-2017 Panasonic Electric Works Europe AG
285
32 Special widgets