Hi there,

I have a text element in my svg document, and I want to change it value.

how can I do that?

My current non-working guess:

<svg width="200" height="200" viewBox="0 0 210 210"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:saxon="http://icl.com/saxon";>

        <desc>Example animMotion01 - demonstrate motion animation
computations</desc>

        <path id="textCircle" d="M180,75 A75,105 0 1,1 180,104" style="fill:none;"
/>
        <text id="stamp" x="105" y="118" style="font-size: 14pt; text-anchor:
middle; stroke: black; stroke-width:1.5; font-family: Verdana">
                        anything
        </text>

        <script type="text/javascript">
                var svgns = "http://www.w3.org/2000/svg";;
                var xlinkns = "http://www.w3.org/1999/xlink";;

                function updateTime() {
                        obj = svgDocument.getElementById("stamp");
                        obj.setText("value", "changed");
                }
                setInterval("updateTime()", 1000);
        </script>
</svg>



-----Mensagem original-----
De: Selber Jean-Fran�ois [mailto:[EMAIL PROTECTED]]
Enviada em: segunda-feira, 17 de fevereiro de 2003 12:57
Para: Batik Users; [EMAIL PROTECTED]
Assunto: Re: Is it possible to create a rect filled with SVGGraphics2D?


Thank you for your fast answers

In fact, I am trying to solve this problem to generate the smallest svg
file.
I know that I get the same result but the svg file could be smaller if the
rects (or other fill and draw shape) could be collaped
I think Vincent Hardy (who wrote the SVGGraphics2D) would perhaps have a
better idea on what can be done. May be an additional method grouping the
two functions,  drawAndFillRect(Shape),  could do the things in only one
rect definition, but it would perhaps be too complex to implement .


Thanks a lot
Best regards


----- Original Message -----
From: "Thomas E Deweese" <[EMAIL PROTECTED]>
To: "Batik Users" <[EMAIL PROTECTED]>
Sent: Monday, February 17, 2003 1:23 PM
Subject: Re: Is it possible to create a rect filled with SVGGraphics2D?


> >>>>> "SJ" == Selber Jean-Fran�ois <[EMAIL PROTECTED]> writes:
>
> SJ> ----- Original Message ----- From: "Thomas E Deweese"
> SJ> <[EMAIL PROTECTED]> To: "Batik Users"
> SJ> <[EMAIL PROTECTED]> Sent: Friday, February 14, 2003 7:06
> SJ> PM Subject: RE: Is it possible to create a rect filled with
> SJ> SVGGraphics2D?
>
>
> >> >>>>> "SJ" == Selber Jean-Fran�ois <[EMAIL PROTECTED]> writes:
> >>
> SJ> Hello, I am trying to use SVGGraphics2D class of batik to get an
> SJ> SVG result; What I want to get in the resulting SVG the following:
> SJ> <rect x="445" y="50" width="119" height="150" fill="green"
> SJ> stroke="blue" stroke-width="1"/>
> >>
> SJ> But looking at the SVGGraphics2D class I only find function to
> SJ> draw a rectangle or to fill it (fill(Rect) and draw(Rect);) Using
> SJ> these functions I get the following result:
> >>  I don't know for sure, but since SVG defines fill to be drawn
> >> before stoke I suspect that you had your draw and fill out of order
> >> given the SVG generated.  It certainly shouldn't collapse them if
> >> you do this, try reversing them.  Otherwise the source is available
> >> (there is an issue that it possible for the shape to change between
> >> calls which might make it difficult for the class to know they were
> >> the same).
>
> SJ> I have tried with your remarks see bellow an example of the
> SJ> code. But it doesn't work. In each case I obtain 2 rectangles. May
> SJ> be I have not understood your comments:
>
>     No it looks like your second case does it right.  It must not
> collapse the rects because it can't be sure they are the same (it
> would fairly be easy and simple to check a rect but for complex paths
> it gets harder).
>
>     I think that if it is essential for your application to get this
> working you are going to have to update the SVGGraphics2D (so you can
> detect this case - which isn't trivial) or go another route.  Unless
> Vincent Hardy (who wrote the SVGGraphics2D) has a better idea.
>
>     I'm a little curious why you are so concerned about this.  The
> two will render the same...
>
> SJ> 1-
>
> SJ> Java Code: svgGraphics2D.setColor(Color.black);
> SJ> svgGraphics2D.drawRect(74, 205, 41, 28);
> SJ> svgGraphics2D.setColor(Color.red); svgGraphics2D.fillRect(74, 205,
> SJ> 41, 28);
>
> SJ> SVG Result: <rect x="74" y="205" width="41" style="fill:none;
> SJ> stroke:black;" height="28" /> <rect x="74" y="205" width="41"
> SJ> style="fill:red; stroke:none;" height="28" />
>
> SJ> 2-
>
> SJ> Java Code: svgGraphics2D.setColor(Color.red);
> SJ> svgGraphics2D.fillRect(74, 205, 41, 28);
> SJ> svgGraphics2D.setColor(Color.black); svgGraphics2D.drawRect(74,
> SJ> 205, 41, 28);
>
> SJ> SVG Result: <rect x="74" y="205" width="41" style="fill:red;
> SJ> stroke:none;" height="28" /> <rect x="74" y="205" width="41"
> SJ> style="fill:none; stroke:black;" height="28" />
>
>
> SJ> How can I write java code in order to obtain svg as follow: <rect
> SJ> x="74" y="205" width="41" style="fill:red; stroke:black;"
> SJ> height="28" />
>
> SJ> Thank you Best regards Jean-Fran�ois Selber
>
>
> >>
> SJ> <rect x="445" y="50" width="119" height="150" fill="none"
> SJ> stroke="blue" stroke-width="1"/> <rect x="445" y="50" width="119"
> SJ> height="150" fill="green" />
> >>
> SJ> Is there a way that I can use so that the resulting svg will only
> SJ> contain one rectangle definition including properly the stroke and
> SJ> fill attributes;
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to