vhardy      2004/03/31 08:44:06

  Modified:    sources/org/apache/batik/transcoder/wmf/tosvg
                        WMFPainter.java
  Log:
  Commiting fix for Luan O'Caroll's WMFPainter related to the rendering of polygons.
  
  Revision  Changes    Path
  1.8       +27 -24    
xml-batik/sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
  
  Index: WMFPainter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WMFPainter.java   9 Aug 2003 16:58:43 -0000       1.7
  +++ WMFPainter.java   31 Mar 2004 16:44:06 -0000      1.8
  @@ -209,7 +209,7 @@
                           catch ( Exception e ) {}
                           int brushStyle = mr.ElementAt( 0 ).intValue();
                           if ( brushStyle == 0 ) {
  -                            addObjectAt(currentStore, BRUSH, 
  +                            addObjectAt(currentStore, BRUSH,
                                           new Color(mr.ElementAt( 1 ).intValue(),
                                                     mr.ElementAt( 2 ).intValue(),
                                                     mr.ElementAt( 3 ).intValue()),
  @@ -329,28 +329,31 @@
   
                   case WMFConstants.META_POLYPOLYGON:
                       {
  -                        int numPolygons = mr.ElementAt( 0 ).intValue();
  -                        int[] pts = new int[ numPolygons ];
  -                        for ( int ip = 0; ip < numPolygons; ip++ )
  -                            pts[ ip ] = mr.ElementAt( ip + 1 ).intValue();
  -
  -                        int offset = numPolygons+1;
  -                        for ( int j = 0; j < numPolygons; j++ ) {
  -                            int count = pts[ j ];
  -                            int[] xpts = new int[ count ];
  -                            int[] ypts = new int[ count ];
  -                            for ( int k = 0; k < count; k++ ) {
  -                                xpts[k] = (int)(  scaleX * ( vpX + mr.ElementAt( 
offset + k*2 ).intValue()));
  -                                ypts[k] = (int)( scaleY * ( vpY + mr.ElementAt( 
offset + k*2+1 ).intValue()));
  -                            }
  -                            offset += count;
  -                            if ( brushObject >= 0 ) {
  -                                setBrushColor( currentStore, g, brushObject );
  -                                g.fillPolygon( xpts, ypts, count );
  -                            }
  -                            setPenColor( currentStore, g, penObject );
  -                            g.drawPolygon( xpts, ypts, count );
  -                        }
  +                      int numPolygons = mr.ElementAt( 0 ).intValue();
  +                      int[] pts = new int[ numPolygons ];
  +                      for ( int ip = 0; ip < numPolygons; ip++ )
  +                          pts[ ip ] = mr.ElementAt( ip + 1 ).intValue();
  +
  +                      GeneralPath gp = new GeneralPath();
  +                      int offset = numPolygons+1;
  +                      for ( int j = 0; j < numPolygons; j++ ) {
  +                          int count = pts[ j ];
  +                          int[] xpts = new int[ count ];
  +                          int[] ypts = new int[ count ];
  +                          for ( int k = 0; k < count; k++ ) {
  +                              xpts[k] = (int)(  scaleX * ( vpX + mr.ElementAt( 
offset + k*2 ).intValue()));
  +                              ypts[k] = (int)( scaleY * ( vpY + mr.ElementAt( 
offset + k*2+1 ).intValue()));
  +                          }
  +                          offset += count;
  +                          Polygon p = new Polygon(xpts, ypts, count);
  +                          gp.append( p, true );
  +                      }
  +                      if ( brushObject >= 0 ) {
  +                          setBrushColor( currentStore, g, brushObject );
  +                          ( (Graphics2D) g).fill(gp);
  +                      }
  +                      setPenColor( currentStore, g, penObject );
  +                      ( (Graphics2D) g).draw(gp);
                       }
                       break;
   
  
  
  

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

Reply via email to