SVG - Simple Example

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG - Simple Example

4D Tech mailing list
Good morning all,

Can someone direct me to very simple SVG example?

Thanks!

Ed Glassgow
[hidden email]



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: SVG - Simple Example

4D Tech mailing list
A basic approach could be like this:

---------------------------
C_TEXT($svg;$ref)
C_PICTURE($pict)

$svg:=SVG_New // this new svg document is referred to as "$svg"
$ref:=SVG_New_rect ($svg;10;10;100;100)  // refer to this new rectangle in "$svg" as "$ref"
SVG_SET_FILL_BRUSH ($ref;"red")
$pict:=SVG_Export_to_picture ($svg)  // get it to a picture variable
SVG_CLEAR ($svg)

SET PICTURE TO PASTEBOARD($pict)
INVOKE ACTION(ak show clipboard)
---------------------------

Keith - CDI

> On Aug 24, 2018, at 10:32 AM, Ed Glassgow via 4D_Tech <[hidden email]> wrote:
>
> Good morning all,
>
> Can someone direct me to very simple SVG example?
>
> Thanks!
>
> Ed Glassgow
> [hidden email]
>
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: SVG - Simple Example

4D Tech mailing list
Very cool...  Thank you Keith!

Ed

On 8/24/18, 10:11 AM, "4D_Tech on behalf of Keith Culotta via 4D_Tech" <[hidden email] on behalf of [hidden email]> wrote:

    ---------------------------
    C_TEXT($svg;$ref)
    C_PICTURE($pict)
   
    $svg:=SVG_New // this new svg document is referred to as "$svg"
    $ref:=SVG_New_rect ($svg;10;10;100;100)  // refer to this new rectangle in "$svg" as "$ref"
    SVG_SET_FILL_BRUSH ($ref;"red")
    $pict:=SVG_Export_to_picture ($svg)  // get it to a picture variable
    SVG_CLEAR ($svg)
   
    SET PICTURE TO PASTEBOARD($pict)
    INVOKE ACTION(ak show clipboard)
    ---------------------------
   
   


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

RE: SVG - Simple Example

4D Tech mailing list
Hi,

A command that I find very useful is the SVGTool_SHOW_IN_VIEWER command.
You pass the SVG document to it and it will display it in a new window which also allows you to toggle to it's XML source.

Piggybacking off the earlier example:

C_TEXT($svg;$ref)
C_PICTURE($pict)

$svg:=SVG_New   // this new svg document is referred to as "$svg"
$ref:=SVG_New_rect ($svg;10;10;100;100)  // refer to this new rectangle in "$svg" as "$ref"
SVG_SET_FILL_BRUSH ($ref;"red")
SVGTool_SHOW_IN_VIEWER ($svg) //Will open a Viewer window for "$svg"

I find that this helps with seeing the structure of the SVG and how 4D builds it.
You can even modify the XML and see the effects immediately.

Hopefully this is helpful.

Best Regards,
-Tai B.



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: SVG - Simple Example

4D Tech mailing list
That's a marvelous tip Tai!  Thank you...

Ed

On 8/24/18, 10:45 AM, "Tai Bui" <[hidden email]> wrote:

    Hi,
   
    A command that I find very useful is the SVGTool_SHOW_IN_VIEWER command.
    You pass the SVG document to it and it will display it in a new window which also allows you to toggle to it's XML source.
   
    Piggybacking off the earlier example:
   
    C_TEXT($svg;$ref)
    C_PICTURE($pict)
   
    $svg:=SVG_New   // this new svg document is referred to as "$svg"
    $ref:=SVG_New_rect ($svg;10;10;100;100)  // refer to this new rectangle in "$svg" as "$ref"
    SVG_SET_FILL_BRUSH ($ref;"red")
    SVGTool_SHOW_IN_VIEWER ($svg) //Will open a Viewer window for "$svg"
   
    I find that this helps with seeing the structure of the SVG and how 4D builds it.
    You can even modify the XML and see the effects immediately.
   
    Hopefully this is helpful.
   
    Best Regards,
    -Tai B.
   
   
    Tai Bui
    Technical Services Engineer
   
    4D Inc
    95 S. Market Street, Suite #240
    CA 95113 San Jose
    United States
   
    Téléphone : +1-408-557-4600
    Standard :  +1-408-557-4600
    Fax :       +1-408-271-5080
    Email :     [hidden email]
    Web :       www.4d.com
   
   
   
   
   
   
   


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************