Re: wmf2svg and svgImage

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 UTC