SVG_New_rect

4D - Documentation   Français   English   German   4D SVG Component, Command Theme List   4D SVG Component, Index   Back   Previous   Next

version 11.3


SVG_New_rect (parentSVGObject; x; y; width; height{; roundedX{; roundedY{; foregroundColor{; backgroundColor{; strokeWidth}}}}}) SVG_Ref

ParameterTypeDescription
parentSVGObjectSVG_RefReference of parent element
xNumberX of upper left corner
yNumberY of upper left corner
widthNumberWidth of rectangle
heightNumberHeight of rectangle
roundedXNumberHorizontal curve
roundedYNumberVertical curve
foregroundColorStringColor or gradient name
backgroundColorStringColor or gradient name
strokeWidthLongintLine thickness
Function resultSVG_RefReference of rectangle

Description

The SVG_New_rect command creates a new rectangle in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.

The rectangle is positioned and sized according to the values of x, y, width and height.

The optional roundedX and roundedY parameters can be used to round off the angles according to the indicated values. If the roundedY parameter is omitted (or is -1), the curve will be regular. Pass -1 in these parameters if you want them to be ignored by the command.

The optional foregroundColor and backgroundColor parameters contain, respectively, the name of the line color and of the background color. (For more information about colors, please refer to the commands of the Colors and Gradients theme).

The optional strokeWidth parameter contains the size of the pen expressed in pixels. Its default value is 1.

Examples

1. Draw a rectangle (default fill and border color, default line thickness):

   svgRef:= SVG_New
   objectRef:=SVG_New_rect (svgRef;10;10;200;100)

2. Draw a blue rectangle with a 3-pixel red border:

   svgRef:= SVG_New
   objectRef:=SVG_New_rect (svgRef;10;10;200;100;0;0;"red";"blue";3)

3. Draw a square with rounded edges (default fill and border color, default line thickness):

   svgRef:= SVG_New
   objectRef:=SVG_New_rect (svgRef;10;10;100;100;20)

4. Draw a light blue rectangle with rounded ends and a blue edge (default line thickness):

   svgRef:= SVG_New
   objectRef:=SVG_New_rect (svgRef;10;10;200;100;-1;50;"blue";"lightblue")

See Also

SVG_New_polygon, SVG_SET_ROUNDING_RECT.


4D - Documentation   Français   English   German   4D SVG Component, Command Theme List   4D SVG Component, Index   Back   Previous   Next