4D v13

SVG_New_rect

Home

 
4D v13
SVG_New_rect

SVG_New_rect 


 

SVG_New_rect ( parentSVGObject ; x ; y ; width ; height {; roundedX {; roundedY {; foregroundColor {; backgroundColor {; strokeWidth}}}}} ) -> Function result 
Parameter Type   Description
parentSVGObject  SVG_Ref in Reference of parent element
Longint in X of upper left corner
Longint in Y of upper left corner
width  Longint in Width of rectangle
height  Longint in Height of rectangle
roundedX  Longint in Horizontal curve
roundedY  Longint in Vertical curve
foregroundColor  String in Color or gradient name
backgroundColor  String in Color or gradient name
strokeWidth  Real in Line thickness
Function result  SVG_Ref in Reference of rectangle

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.

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

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

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)

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)

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")

 
PROPERTIES 

Product: 4D
Theme: Drawing
Number: 65979

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: Composant 4D SVG v11.4

 
SEE ALSO 

SVG_New_polygon
SVG_SET_ROUNDING_RECT