This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
SVG_New_image
|
SVG_New_image ( parentSVGObject ; url {; x ; y {; width ; height}} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
parentSVGObject | SVG_Ref |
![]() |
Reference of parent element | |||||
url | String |
![]() |
Address of picture | |||||
x | Longint |
![]() |
Coordinate on X axis of upper left corner | |||||
y | Longint |
![]() |
Coordinate on Y axis of upper left corner | |||||
width | Longint |
![]() |
Width of picture | |||||
height | Longint |
![]() |
Height of picture | |||||
Function result | SVG_Ref |
![]() |
SVG object reference | |||||
The SVG_New_image command can be used to reference a picture at the url address in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.
The url parameter specifies the location of the picture and can take several forms:
The optional x and y parameters can be used to specify the position of the upper left corner of the picture in the SVG containers (default value 0).
The width and height parameters specify the size of the rectangle in which the picture will be displayed and thus determine the size and aspect ratio of the picture. These parameter are only optional in the case of a picture referenced by a relative path in the Resources folder of the host database. If width and/or height equal 0 then the picture is not rendered.
Place the ‘logo4D.png’ picture located in the ‘Pictures’ folder of the ‘Resources’ folder:
svgRef:=SVG_New
objectRef:=SVG_New_image(svgRef;"#Pictures/logo4D.png")
Place the ‘4dlogo.gif’ picture that can be accessed in the ’pictures’ directory of the ‘4d.com’ site:
svgRef:=SVG_New
objectRef:=SVG_New_image(svgRef;"http://www.4d.com/pictures/4dlogo.gif";20;20;39;53)
Here are a few examples for accessing pictures using relative URLs:
SVG_New_image($Dom_svg;"./images/picture.png";10;10)
// base is the "Resources" folder
// XML code will be xlink:href="../images/picture.png"
SVG_New_image($Dom_svg;"../picture.png";70;180)
// base is the database's folder
// XML code will be xlink:href="../../picture.png"
SVG_New_image($Dom_svg;"/sample pictures/picture.png";110;90;100;100)
// base is the "SVG" folder in the "Resources" folder
// XML code will be xlink:href="sample%20pictures/picture.gif"
Product: 4D
Theme: Drawing
Number:
65969
Created: Composant 4D SVG v11.3
Modified: 4D v14
4D SVG Component ( 4D v20 R7)