W3C home > Mailing lists > Public > www-svg@w3.org > May 1999

Re: wmf2svg and svgImage

From: Chris Lilley <chris@w3.org>
Date: Mon, 10 May 1999 14:11:31 -0500
Message-ID: <37372F63.5202CE8F@w3.org>
To: carmen@blackdirt.com
CC: www-svg@w3.org


Carmen Delessio wrote:
> 
> These are 2 java classes that I have created for converting a windows
> matafile into an SVG and for rendering an SVG.[...]

> svgImage is
> a component that plays an svg file.  I added  main method to handle
> testing.  I used IBM's xml4j and I am very happy with the functionality
> and ease of use.

The code does not cope with a (legal) trailing semicolon at the end of a
style attribute.

Here is a fragment with a couple of extra lines (++++) to fix that.

              offset = tempBuffer.indexOf("fill:");


              if (offset >=0){


                 tempBuffer = tempBuffer.substring(offset+5);


                 tempBuffer = tempBuffer.trim();


                 System.out.println("fill " + tempBuffer);


                 if (tempBuffer.startsWith("#")) {


                   tempBuffer = tempBuffer.substring(1);


                 }


       +         int semi_colon_index = tempBuffer.indexOf(';');
       +         if (semi_colon_index > 0) {
       +           tempBuffer = tempBuffer.substring(0,
semi_colon_index);
       +         }
                 currentColor =
Integer.valueOf(tempBuffer,16).intValue();


                 svgGraphics.setColor( new Color (currentColor));


                 drawFilled = true;



I can't get it to display anything yet, but it compiles OK (one warning)
and displays a blank window.

It always seems to think the width is 400 and the height is 300,
regardless of what the SVG instance says.

--
Chris
Received on Wednesday, 12 May 1999 10:50:45 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:17 GMT