<< Click to Display Table of Contents >> Navigation: »No topics above this level« TOC : Script API > JavaScript > JavaScript API > GeneralScript > DrawingContext > Method >rect |
Draws a rectangle by the given position, width and height.
Prototype :
void rect
(
float X,
float Y,
float Width,
float Height
)
Arguments :
X |
X coordinate |
Y |
Y coordinate |
Width |
rectangle width |
Height |
rectangle height |
Reference :
The X and Y coordinates of the shape are relative to the upper-left corner of the component.
The function draws the shape on the screen regardless of transparency or clipping of the component and it can draw the arc even in areas outside of the component. However, the shape drawn outside the input component area is clipped.
The shape drawn by the function can be exported only in pdf, jpg, png, gif, tif, svg format.
Example :
//filled rectangle
ctx.fillStyle = "#FF0000";
ctx.rect(10, 10, 100, 50);
ctx.fill();
//unfilled rectangle
ctx.strokeStyle = "#FF0000";
ctx.rect(10, 10, 100, 50);
ctx.stroke();
Available Events :
OnPostDraw, OnPreDraw
See also :