SVG_New_regular_polygon

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

version 11.3


SVG_New_regular_polygon (parentSVGObject; width; number{; x{; y{; foregroundColor{; backgroundColor{; strokeWidth}}}}}) SVG_Ref

ParameterTypeDescription
parentSVGObjectSVG_RefReference of parent element
widthNumberDiameter of surrounding circle
numberNumberNumber of sides
xNumberCoordinate on center X axis
yNumberCoordinate on center Y axis
foregroundColorStringColor or gradient name
backgroundColorStringColor or gradient name
strokeWidthLongintLine thickness
Function resultSVG_RefReference of polygon

Description

The SVG_New_regular_polygon command draws a regular polygon with number of sides fit into a circle with a diameter of width in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.

The optional x and y parameters can be used to specify the center of the circle. If they are omitted, the figure will be drawn in the upper left corner of the document.

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 pentagon (default fill and border color, default line thickness):

   svgRef:= SVG_New
   objectRef:= SVG_New_regular_polygon (svgRef;100;5)

2. Draw an octogon, the circle containing it and the trace lines:

   svgRef:= SVG_New
   $width:=200
   $sides:=8
   objectRef:= SVG_New_regular_polygon (svgRef;$width;$sides;0;0;"crimson";"palevioletred";2)

   $radius:=$width/2
   objectRef:=SVG_New_rect (svgRef;0;0;$width;$width;0;0;"blue";"none")
   objectRef:=SVG_New_line (svgRef;0;$radius;$width;$radius;"blue")
   objectRef:=SVG_New_line (svgRef;$radius;0;$radius;$width;"blue")
   objectRef:=SVG_New_line (svgRef;0;0;$width;$width;"blue")
   objectRef:=SVG_New_line (svgRef;$width;0;0;$width;"blue")
   objectRef:=SVG_New_circle (svgRef;$radius;$radius;$radius;"blue";"none")

See Also

SVG_New_polygon.


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