You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Jeremias Maerki <de...@jeremias-maerki.ch> on 2014/08/26 14:57:27 UTC

Fw: org.apache.batik.transcoder.wmf.tosvg.WMFPainter.java - quick bug report with code fix (very simple, assuming I actually know what I'm talking about)

Dropped from the moderation queue:

----------------------- Original Message -----------------------
 From:    "Darren Hoffman" <da...@qoppa.com>
 To:      <ba...@xmlgraphics.apache.org>
 Date:    Tue, 12 Aug 2014 15:37:21 -0400
 Subject: org.apache.batik.transcoder.wmf.tosvg.WMFPainter.java - quick bug report with code fix (very simple, assuming I actually know what I'm talking about)
----

I think this is wrong:

 

                case WMFConstants.META_SETWINDOWORG:

                    currentStore.setVpX( vpX = -(float)mr.elementAt( 0 ) );

                    currentStore.setVpY( vpY = -(float)mr.elementAt( 1 ) );

                    vpX = vpX * scale;

                    vpY = vpY * scale;

                    break;

 

Specifically these two lines should be deleted: 

                    vpX = vpX * scale;

                    vpY = vpY * scale;

 

Scale is effectively applied twice to vpX and vpY when various shapes are
created, e.g.:

                case WMFConstants.META_ELLIPSE:
                    {
                        float x1 = scaleX * ( vpX + xOffset + mr.elementAt(
0 ) );
                        float x2 = scaleX * ( vpX + xOffset + mr.elementAt(
2 ) );
                        float y1 = scaleY * ( vpY + yOffset + mr.elementAt(
1 ) );
                        float y2 = scaleY * ( vpY + yOffset + mr.elementAt(
3 ) );
 
                        Ellipse2D.Float el = new Ellipse2D.Float(x1, y1,
x2-x1, y2-y1);
                        paint(brushObject, penObject, el, g2d);
                    }
                    break;

 

I believe in most WMFs, the vpX and vpY values will be 0, so the bug would
not be noticed. But I have encountered WMFs where vpX and vpY are set to
non-Zero values; I can send you an example WMF file if you wish.

I'm not actually clear on the purpose of scaleX and scaleY, as they appear
to always be equivalent to scale. I hope I'm not missing something. (I
assume they are there for as-of-yet unimplemented functionality, i.e.
supporting different user-supplied x and y scaling values)

 

Darren Hoffman

Software Engineer

Qoppa Software 

+1 (404) 685-8733

 <http://www.qoppa.com> www.qoppa.com 

 


--------------------- Original Message Ends --------------------


Best regards,
Jeremias Märki
_________________________________________________________
Jeremias Märki, Software-Development and Consulting
Contact Information and Public Keys:
http://www.jeremias-maerki.ch/contact.html

Please don't print e-mails. Strive to become paperless.
Avoid media breaks. Cherish metadata.