Hello,
 
Some of the WMF Metafile operand are not implemented in the converter (v. 1.5 of Batik), for example META_PATBLT. I found that this operand is heavily used in WMF files for filling rectangles (see example attached).
 
I added this in my copy of Batik files, and it is working correctly. If you are are interested by supporting this operand, here is how to do it :
  • add the new PATBLT codes in WMFConstants 
    public static final int META_PATCOPY                = 0x00F00021; 
    public static final int META_PATINVERT              = 0x005A0049;
    public static final int META_DSTINVERT              = 0x00550009;
    public static final int META_BLACKNESS            = 0x00000042;
    public static final int META_WHITENESS            = 0x00FF0062;
  • process the PATBLT operand in WMFRecordStore :
            case WMFConstants.META_PATBLT :
                {
                    mr.numPoints = recSize;
                    mr.functionId = functionId;
 
                    int rop = readInt( is );
                    int height = readShort( is );
                    int width = readShort( is );
                    int left = readShort( is );
                    int top = readShort( is );
                   
                    mr.AddElement( new Integer( rop ));
                    mr.AddElement( new Integer( height ));
                    mr.AddElement( new Integer( width ));
                    mr.AddElement( new Integer( top ));
                    mr.AddElement( new Integer( left ));
                   
                    records.addElement( mr );                   
                }
                break;
 
  • paint PATBLT in WMFPainter :
                case WMFConstants.META_PATBLT:
                    {
                        int rop = mr.ElementAt( 0 ).intValue();
                        int height = mr.ElementAt( 1 ).intValue();
                        int width = mr.ElementAt( 2 ).intValue();
                        int left = mr.ElementAt( 3 ).intValue();
                        int top = mr.ElementAt( 4 ).intValue();
                       
                        Color clr = null;
                        boolean ok = false;
                        if (rop == WMFConstants.META_BLACKNESS) {
                            clr = Color.BLACK;
                            ok = true;
                        } else if (rop == WMFConstants.META_WHITENESS) {
                            clr = Color.WHITE;
                            ok = true;
                        } else if (rop == WMFConstants.META_PATCOPY) {
                            if ( brushObject >= 0 ) {                           
                                setBrushColor( currentStore, g, brushObject );
                                ok = true;
                            }
                        }
                       
                        if (ok) {
                            if (clr != null) {
                                g.setColor(clr);
                            } else {
                                setBrushColor( currentStore, g, brushObject );
                            }
                            g.fillRect( left, top, width, height);
                        }
                    }
                    break;
 
 

Attachment: META_PATBLT.wmf
Description: Binary data

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

Reply via email to