You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by JLEIngenieros <jl...@gmail.com> on 2013/12/24 01:54:18 UTC

Re: Pivot/SVG Salamander

Hi.

At first, I know that the post is quite old, and apologize for my english.

At second, pardon my boldness to enter into a post without invitation, but
i've a question:

In the posted code, I think that 'image logo.src' is directly inserted on
ImageView, so it's only an normal 'image', not a SVGImage.

    <ImageView styles="{verticalAlignment:'top'}">
        <image>
            <bxml:include src="logo.svg"/>
        </image>
    </ImageView>

It's possible (and correct)  to rewrite the'bxml' and 'SVGImageDemo.java'
files with anything as this?:

1. In bxml file, delete the <bxml:include src="logo.svg"/> and add a
bxml:id, as this:

    <ImageView bxml:id="myPicture" styles="{verticalAlignment:'top'}">
        <image>
            <bxml:include src="logo.svg"/>
        </image>
    </ImageView>

2. Rewrite as this (for example):
 
    //An ImageView to serialize with bxml
    ImageView myImage;        
   
    //Uri for working with svg path, string or anything else    
    URI uri = null;
   
    //Reading the svg path...
    StringReader reader = new StringReader(---any svg string, file or
similar---);
   
    //Setting the URI
    uri = SVGCache.getSVGUniverse().loadSVG(reader, "titleOf...");
   
    //Getting the SVGdiagram
    SVGDiagram myDiagram = SVGCache.getSVGUniverse().getDiagram(uri);
       
    //Getting SVGImage from SVGdiagram
    SVGImage myGetImage =new SVGImage(myDiagram);
       
    //Serializing from bxml
    myImage= (ImageView) bxmlSerializer.getNamespace().get("myPicture");
       
    //Setting the image for to work
    myImage.setImage(myGetImage);

I think that, after doing this, we can work programatically with myImage as
SVG graphic.

Thank you for comments.
Javier 



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Pivot-SVG-Salamander-tp1609653p4022814.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.