sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 10305 - svn://svn.freehep.org/svn / freehep / branches / vectorgraphics-emfplus / freehep-graphicsio-emf / src / main / java / org / freehep / graphicsio / emf / EMFOutputStream.java
Unified Diff View - EMFOutputStream.java
Search for Help
/freehep/branches/vectorgraphics-emfplus/freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/EMFOutputStream.java @ revision 10304
/freehep/branches/vectorgraphics-emfplus/freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/EMFOutputStream.java @ revision 10305
@@ -9,6 +9,8 @@ import java.io.IOException; import java.io.OutputStream; +import org.freehep.graphicsio.emf.gdi.GDIComment; +import org.freehep.graphicsio.emf.gdiplus.EMFPlusTag; import org.freehep.util.io.ActionHeader; import org.freehep.util.io.Tag; import org.freehep.util.io.TagHeader; @@ -19,7 +21,7 @@  * binary EMF file.  *  * @author Mark Donszelmann - * @version $Id: EMFOutputStream.java 10188 2006-12-11 20:26:14Z duns $ + * @version $Id: EMFOutputStream.java 10305 2007-01-12 23:43:03Z duns $  */ public class EMFOutputStream extends TaggedOutputStream { @@ -65,7 +67,8 @@     public void close() throws IOException {         int len = popBuffer();         recordCount++; -        EMFHeader header = new EMFHeader(imageBounds, getVersion(), 0, len, +        // FIXME check this +        EMFHeader header = new EMFHeader(EMFHeader.TYPE_WMF, imageBounds, getVersion(), 0, len,                 recordCount, handles.maxHandlesUsed(), application, name,                 device);         writeHeader(header); @@ -111,11 +114,11 @@         writeShort(c.getAlpha() << 8);     } - public void writeColor(Color color) { -  writeByte(c.getBlue()); -  writeByte(c.getGreen()); -  writeByte(c.getRed()); -  writeByte(c.getAlpha()); + public void writeCOLOR(Color c) throws IOException { +        writeByte(c.getBlue()); +        writeByte(c.getGreen()); +        writeByte(c.getRed()); +        writeByte(c.getAlpha());  }     public void writeXFORM(AffineTransform t) throws IOException { @@ -235,20 +238,30 @@         return 4;     } +    protected TagHeader createTagHeader(Tag tag, long len) { +        EMFTag emfTag = (EMFTag)tag; +        return new EMFTagHeader(tag.getTag(), len, emfTag.getFlags()); +    } +     protected void writeTagHeader(TagHeader header) throws IOException { - -        int tagID = header.getTag(); -        long length = header.getLength(); -        writeUnsignedInt(tagID); -        writeUnsignedInt(length + 8); +        EMFTagHeader tagHeader = (EMFTagHeader)header; +        writeUnsignedInt(tagHeader.getTag() | (tagHeader.getFlags() << 16)); +        writeUnsignedInt(tagHeader.getLength() + 8);     }     public void writeTag(Tag tag) throws IOException { +        // nest EMFPlusTags in GDIComments +        if (tag instanceof EMFPlusTag) { +            tag = new GDIComment((EMFPlusTag)tag); +        } +        writeTag(tag, true); +    } +    public void writeTag(Tag tag, boolean doNotEmbed) throws IOException {         recordCount++; -        super.writeTag(tag); +        super.writeTag(tag);     } - +     protected void writeActionHeader(ActionHeader header) throws IOException {         // empty     }


feed icon

sventon 2.5.1