libpixie-java-1.1.6/0000755000175000017500000000000011636143736012721 5ustar renerenelibpixie-java-1.1.6/source/0000755000175000017500000000000011365605266014221 5ustar renerenelibpixie-java-1.1.6/source/overview.html0000644000175000017500000000144311365605266016757 0ustar renerene

The pixie library is a fork of the original gnu.bhresearch.pixie library. It only purpose is to add vector graphics support to JFreeReport. At the moment, this library contains code to read most wmf-files.

The wmf-code supports most options of the Windows 3.1 WMF-specififcations. Palette animation or OLE embedding is not supported.

FloodFill is also not implemented as the Graphics2D implementation is not pixel-based.Simple embedded bitmaps should work, but most BitBlt operations are unsupported. BitBlt Operations are bitmap-based operations and will not be supported by this library.

For more information, visit http://www.jfree.org/jfreereport/pixie/

libpixie-java-1.1.6/source/org/0000755000175000017500000000000011365605264015006 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/0000755000175000017500000000000011365605264016444 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/0000755000175000017500000000000011365605264020455 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/0000755000175000017500000000000011365605264022431 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/0000755000175000017500000000000011365605266023551 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/PixieViewer.java0000644000175000017500000000337211365605266026661 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie; import java.awt.Image; import java.io.IOException; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Creation-Date: 13.05.2006, 09:47:26 * * @author Thomas Morgner */ public class PixieViewer extends JFrame { public PixieViewer(final String filename) throws IOException { final WmfFile wmf = new WmfFile(filename, 800, 600); System.out.println(wmf); final Image img = wmf.replay(); setContentPane(new JLabel(new ImageIcon(img))); } public static void main(final String[] args) throws IOException { if (args.length == 0) { System.err.println("Need a file parameter."); System.exit(1); } final PixieViewer viewer = new PixieViewer(args[0]); viewer.pack(); viewer.setVisible(true); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/PixieInfo.java0000644000175000017500000000353111365605266026310 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie; import org.pentaho.reporting.libraries.base.LibBaseInfo; import org.pentaho.reporting.libraries.base.versioning.ProjectInformation; public class PixieInfo extends ProjectInformation { private static PixieInfo singleton; /** * Returns the single instance of this class. * * @return The single instance of information about the JCommon library. */ public static synchronized PixieInfo getInstance() { if (singleton == null) { singleton = new PixieInfo(); } return singleton; } /** * Creates a new instance. (Must be public so that we can instantiate * the library-info using Class.newInstance(..)). */ public PixieInfo() { super("libpixie", "Pixie"); setInfo("http://reporting.pentaho.org/pixie/"); setCopyright("(C)opyright 2000-2010, by Pentaho Corporation, Object Refinery Limited and Contributors"); setLicenseName("LGPL"); addLibrary(LibBaseInfo.getInstance()); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/0000755000175000017500000000000011365605266024342 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/PenConstants.java0000644000175000017500000000424611365605266027632 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * The PenConstants were defined in the Windows-API and are used do define the appearance * of Wmf-Pens. */ public interface PenConstants { /* Pen Styles */ public static final int PS_SOLID = 0; public static final int PS_DASH = 1; /* ------- */ public static final int PS_DOT = 2; /* ....... */ public static final int PS_DASHDOT = 3; /* _._._._ */ public static final int PS_DASHDOTDOT = 4; /* _.._.._ */ public static final int PS_NULL = 5; public static final int PS_INSIDEFRAME = 6; public static final int PS_USERSTYLE = 7; public static final int PS_ALTERNATE = 8; public static final int PS_STYLE_MASK = 0x0000000F; public static final int PS_ENDCAP_ROUND = 0x00000000; public static final int PS_ENDCAP_SQUARE = 0x00000100; public static final int PS_ENDCAP_FLAT = 0x00000200; public static final int PS_ENDCAP_MASK = 0x00000F00; public static final int PS_JOIN_ROUND = 0x00000000; public static final int PS_JOIN_BEVEL = 0x00001000; public static final int PS_JOIN_MITER = 0x00002000; public static final int PS_JOIN_MASK = 0x0000F000; public static final int PS_COSMETIC = 0x00000000; public static final int PS_GEOMETRIC = 0x00010000; public static final int PS_TYPE_MASK = 0x000F0000; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfLogPen.java0000644000175000017500000001064011365605266026655 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Stroke; /** * A Windows metafile logical pen object. */ public class MfLogPen implements WmfObject { /** * ___ ___ ___ */ private static final float[] DASH_DASH = { 6f, 2f }; /** * _ _ _ _ _ _ */ private static final float[] DASH_DOT = { 2f, 2f }; /** * ___ _ ___ _ */ private static final float[] DASH_DASHDOT = { 6f, 2f, 2f, 2f }; /** * ___ _ _ ___ */ private static final float[] DASH_DASHDOTDOT = { 6f, 2f, 2f, 2f, 2f, 2f }; private int style; private int endCap; private int joinType; private int width; private Color color; /** * The default pen for a new DC. */ public MfLogPen() { style = PenConstants.PS_SOLID; width = 0; color = Color.black; } /** * Return one of the PS_ styles. */ public int getStyle() { return style; } public void setStyle(final int style) { this.style = style & 0x000000FF; this.endCap = style & 0x00000F00; this.joinType = style & 0x0000F000; } /** * Return width. */ public int getWidth() { return width; } public void setWidth(final int width) { this.width = width; } /** * Return color of the current pen, or null. */ public Color getColor() { return color; } public void setColor(final Color color) { this.color = color; } /** * True if not a dashed or dotted style. */ public boolean isSimpleStyle() { switch (style) { case PenConstants.PS_SOLID: case PenConstants.PS_NULL: case PenConstants.PS_INSIDEFRAME: return true; default: return false; } } public boolean isVisible() { return getStyle() != PenConstants.PS_NULL; } public int getType() { return OBJ_PEN; } public Stroke getStroke() { if (isSimpleStyle()) { return new BasicStroke(getWidth(), getEndCap(), getJoinType(), 0); } return new BasicStroke(getWidth(), getEndCap(), getJoinType(), 0, getDashes(), 0); } private int getJoinType() { switch (joinType) { case PenConstants.PS_JOIN_ROUND: return BasicStroke.JOIN_ROUND; case PenConstants.PS_JOIN_BEVEL: return BasicStroke.JOIN_BEVEL; case PenConstants.PS_JOIN_MITER: return BasicStroke.JOIN_MITER; default: return BasicStroke.JOIN_ROUND; } } private int getEndCap() { switch (endCap) { case PenConstants.PS_ENDCAP_ROUND: return BasicStroke.CAP_ROUND; case PenConstants.PS_ENDCAP_SQUARE: return BasicStroke.CAP_SQUARE; case PenConstants.PS_ENDCAP_FLAT: return BasicStroke.CAP_BUTT; default: return BasicStroke.CAP_ROUND; } } private float[] getDashes() { switch (getStyle()) { case PenConstants.PS_DASH: return DASH_DASH; case PenConstants.PS_DOT: return DASH_DOT; case PenConstants.PS_DASHDOT: return DASH_DASHDOT; case PenConstants.PS_DASHDOTDOT: return DASH_DASHDOTDOT; default: throw new IllegalStateException("Illegal Pen defined"); } } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("MfLogPen:="); b.append(" width="); b.append(getWidth()); b.append(" style="); b.append(getStyle()); b.append(" color="); b.append(getColor()); return b.toString(); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/TextConstants.java0000644000175000017500000000406211365605266030030 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * The TextConstants were defined in the Windows-API and are used do define the appearance * of Wmf-Text. * * @noinspection SuspiciousNameCombination */ public interface TextConstants { public static final int TA_NOUPDATECP = 0x0000; //bin 00.00000000 public static final int TA_UPDATECP = 0x0001; //bin 00.00000001 public static final int TA_LEFT = 0x0000; //bin 00.00000000 public static final int TA_RIGHT = 0x0002; //bin 00.00000010 public static final int TA_CENTER = 0x0006; //bin 00.00000110 public static final int TA_TOP = 0x0000; //bin 00.00000000 public static final int TA_BOTTOM = 0x0008; //bin 00.00001000 public static final int TA_BASELINE = 0x0018; //bin 00.00011000 public static final int TA_RTLREADING = 0x0100; //bin 01.00000000 public static final int TA_MASK = (TA_BASELINE + TA_CENTER + TA_UPDATECP + TA_RTLREADING); public static final int VTA_BASELINE = TA_BASELINE; public static final int VTA_LEFT = TA_BOTTOM; public static final int VTA_RIGHT = TA_TOP; public static final int VTA_CENTER = TA_CENTER; public static final int VTA_BOTTOM = TA_RIGHT; public static final int VTA_TOP = TA_LEFT; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/Buffer.java0000644000175000017500000001714711365605266026430 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.io.ByteArrayInputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; /** * A block of raw mmeory. This is used to store various metafile objects as they are read * in from file. */ public class Buffer { /** * The memory itself. */ private byte[] bytes; /** * The current length of the memory. */ private int length; /** * Default Constructor. Defines a buffer without an initial size. */ protected Buffer() { } /** * Defines a new buffer with the given initial size in bytes. * * @param length the length of the buffer in bytes. */ protected Buffer(final int length) { setCapacity(length); } /** * The size of the stored data in the memory. */ public final int getLength() { return length; } /** * Extends the length to the given new size. * * @param len the new length. * @throws IllegalArgumentException if the length is shorter than the used storage in * memory. */ protected void setLength(final int len) { if (len > bytes.length) { throw new IllegalArgumentException(); } this.length = len; } /** * Ensures that the buffer has enough space for the given number of bytes. * * @param capacity the new capacity that should be ensured. * @throws IllegalArgumentException if the capacity is smaller than the buffers length. */ protected void setCapacity(final int capacity) { if (capacity < getLength()) { throw new IllegalArgumentException(); } if (bytes == null || bytes.length == 0) { bytes = new byte[capacity]; } else if (capacity != bytes.length) { final byte[] old = bytes; bytes = new byte[capacity]; System.arraycopy(old, 0, bytes, 0, Math.min(old.length, capacity)); } } /** * Read len bytes into the memory from a stream and stores the read bytes * at the given offset. * * @param in the input stream that should be used * @param offset the offset * @param len the number bytes that should be read. */ public void read(final InputStream in, int offset, int len) throws IOException { // make sure, that all bytes can be read and create the buffer if needed. if (bytes == null || offset + len > bytes.length) { setCapacity(offset + len); } //in.readFully( bytes, offset, len ); while (len > 0) { final int blockSize = in.read(bytes, offset, len); if (blockSize <= 0) { throw new EOFException(); } offset += blockSize; len -= blockSize; setLength(offset); } } /** * Moves the buffer contents from the source offset to the target offset, the areas * should not overlap. * * @param sourceoffset * @param length * @param targetoffset */ protected void move(final int sourceoffset, final int length, final int targetoffset) { System.arraycopy(bytes, sourceoffset, bytes, targetoffset, length); } /** * Set the int value as big-endian. * * @param offset the offset where to set the int value. * @param value the integer value that should be set. */ public void setInt(final int offset, final int value) { if (offset > (getLength() - 4)) { throw new IndexOutOfBoundsException(); } setShort(offset, value & 0x0ffff); setShort(offset + 2, value >> 16); } /** * Return the 32-bit int at the given byte offset. * * @param offset the offset where the integer value is stored in the memory * @return the integer. */ public int getInt(final int offset) { if (offset > (getLength() - 4)) { throw new IndexOutOfBoundsException(); } return (getShort(offset) & 0x0ffff) | (getShort(offset + 2) << 16); } /** * Stores the given short as BigEndian value. * * @param offset the offset. * @param shortval the shortvalue. */ public void setShort(final int offset, final int shortval) { if (offset > (getLength() - 2)) { throw new IndexOutOfBoundsException(); } bytes[offset] = (byte) (shortval & 0x0ff); bytes[offset + 1] = (byte) (shortval >> 8); } /** * Return the 16-bit int at the given byte offset. * * @param offset the offset from where to read the short. * @return the short. */ public int getShort(final int offset) { if (offset > (getLength() - 2)) { throw new IndexOutOfBoundsException ("Offset " + offset + " is out of limit. " + "Max length is " + (getLength() - 2)); } return (bytes[offset] & 0x0ff) | (bytes[offset + 1] << 8); } /** * Sets the byte at the given offset. * * @param offset the offset. * @param value the byte that should be set. */ public void setByte(final int offset, final int value) { if (offset > (getLength() - 1)) { throw new IndexOutOfBoundsException(); } bytes[offset] = (byte) (value & 0x0ff); } /** * Return the 8-bit int at the given byte offset. * * @param offset the offset from where to read the byte * @return the byte read. */ public int getByte(final int offset) { if (offset > (getLength() - 1)) { throw new IndexOutOfBoundsException(); } return bytes[offset] & 0x0ff; } /** * Writes the given string as byte stream using the plattforms default encoding. * * @param offset the offset, where to store the string. * @param str the string that should be stored in the Wmf. */ public void setString(final int offset, final String str) { if ((offset + str.length()) > (getLength() - 1)) { throw new IndexOutOfBoundsException(); } final byte[] b = str.getBytes(); final int len = getLength() - offset; for (int i = 0; i < len; i++) { bytes[offset + i] = b[offset]; } if ((offset + len) < getLength()) { bytes[offset + len] = 0; } } /** * Return the null-terminated string at the given byte offset with the given maximum * length. * * @param offset the offset where the string starts * @param len the maximum length of the string * @return the null-terminated string read. */ public String getString(final int offset, final int len) { int i; for (i = 0; i < len; i++) { if (bytes[offset + i] == 0) { break; } } return new String(bytes, offset, i); } /** * Gets an input stream to read from the memory buffer. * * @param offset the offse, from where to read. * @return the InputStream. */ public InputStream getInputStream(final int offset) { return new ByteArrayInputStream(bytes, offset, bytes.length - offset); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfLogPalette.java0000644000175000017500000000205611365605266027533 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; public class MfLogPalette implements WmfObject { public MfLogPalette() { } public int getType() { return OBJ_PALETTE; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfDcState.java0000644000175000017500000002572411365605266027031 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; /** * Track the state of the DeviceContext of a Windows metafile. */ public class MfDcState implements Cloneable { public static class MfScale { private int yNum; private int xNum; private int yDenom; private int xDenom; public MfScale(final int xNum, final int xDenom, final int yNum, final int yDenom) { if (xNum == 0 || yNum == 0 || xDenom == 0 || yDenom == 0) { throw new IllegalArgumentException("Illegal Scaling"); } this.xNum = xNum; this.yNum = yNum; this.xDenom = xDenom; this.yDenom = yDenom; } public int scaleX(final int coord) { return ((coord * xNum) / xDenom); } public int scaleY(final int coord) { return ((coord * yNum) / yDenom); } } private int viewportOrgX; private int viewportOrgY; private int viewportExtX = 1; private int viewportExtY = 1; private int windowExtX = 1; private int windowExtY = 1; private MfScale viewportScale; private MfScale windowScale; private int curPosX; private int curPosY; private Color fgColor; private Color bkColor; private Color textColor; private int textAlign; private int textCharExtra; private int breakCount; private int extraSpaceLength; private int bkmode; private MfLogBrush logBrush; private MfLogPen logPen; private MfLogFont logFont; private MfLogRegion logRegion; private MfLogPalette logPalette; private int polyFillMode; private int rop; private int mapMode; private int mapperFlag; private int stretchBltMode; private Rectangle clipRegion; private WmfFile parent; public MfDcState(final WmfFile parent) { fgColor = Color.black; bkColor = Color.white; textColor = Color.black; this.logBrush = new MfLogBrush(); this.logPen = new MfLogPen(); this.parent = parent; } public MfDcState(final MfDcState copy) { this.parent = copy.parent; this.windowExtX = copy.windowExtX; this.windowExtY = copy.windowExtY; this.viewportOrgX = copy.viewportOrgX; this.viewportOrgY = copy.viewportOrgY; this.viewportExtX = copy.viewportExtX; this.viewportExtY = copy.viewportExtY; this.curPosX = copy.curPosX; this.curPosY = copy.curPosY; this.fgColor = copy.fgColor; this.bkColor = copy.bkColor; this.textAlign = copy.textAlign; this.textCharExtra = copy.textCharExtra; this.textColor = copy.textColor; this.logBrush = copy.logBrush; this.logPen = copy.logPen; this.logFont = copy.logFont; this.mapMode = copy.mapMode; this.mapperFlag = copy.mapperFlag; this.stretchBltMode = copy.stretchBltMode; this.viewportScale = copy.viewportScale; this.windowScale = copy.windowScale; this.polyFillMode = copy.polyFillMode; this.rop = copy.rop; this.bkmode = copy.bkmode; this.breakCount = copy.breakCount; this.extraSpaceLength = copy.extraSpaceLength; if (copy.clipRegion != null) { this.clipRegion = new Rectangle(copy.clipRegion); } } public void restoredState() { final Graphics2D graphic = parent.getGraphics2D(); if (logBrush != null) { updateBrushBackground(); graphic.setPaint(logBrush.getPaint()); } if (logPen != null) { graphic.setStroke(logPen.getStroke()); } if (logFont != null) { graphic.setFont(logFont.createFont()); } } // if no clipping region is set and the default clipping region // is not modified, return the current viewport // // btw. i dont have a clue, whether this is the correct implementation :) public Rectangle getClipRegion() { if (clipRegion == null) { return new Rectangle(viewportOrgX, viewportOrgY, viewportExtX, viewportExtY); } return clipRegion; } public void setClipRegion(final Rectangle clipRegion) { this.clipRegion = clipRegion; } public int getBkMode() { return bkmode; } public void setBkMode(final int bkmode) { if (this.bkmode != bkmode) { this.bkmode = bkmode; updateBrushBackground(); } } private void updateBrushBackground() { if (bkmode == BrushConstants.TRANSPARENT) { logBrush.setBackgroundColor(new Color(MfLogBrush.COLOR_FULL_ALPHA, true)); } else { logBrush.setBackgroundColor(getBkColor()); } } public int getBreakCount() { return breakCount; } public int getExtraSpaceLength() { return extraSpaceLength; } public void setTextJustification(final int breakCount, final int extraSpaceLength) { this.breakCount = breakCount; this.extraSpaceLength = extraSpaceLength; } public int getStretchBltMode() { return stretchBltMode; } public void setStretchBltMode(final int stretchBltMode) { this.stretchBltMode = stretchBltMode; } public Color getTextColor() { return textColor; } public void setTextColor(final Color textColor) { this.textColor = textColor; } public int getTextCharExtra() { return textCharExtra; } public void setTextCharExtra(final int textCharExtra) { this.textCharExtra = textCharExtra; } public int getMapMode() { return mapMode; } public void setMapMode(final int mapMode) { this.mapMode = mapMode; } public int getMapperFlag() { return mapperFlag; } public void setMapperFlag(final int mapperFlag) { this.mapperFlag = mapperFlag; } public int getROP() { return rop; } public void setROP(final int rop) { this.rop = rop; } public int getPolyFillMode() { return polyFillMode; } public void setPolyFillMode(final int mode) { this.polyFillMode = mode; } public void setWindowOrg(final int windowOrgX, final int windowOrgY) { this.viewportOrgY = -windowOrgY; this.viewportOrgX = -windowOrgX; } public int getWindowOrgX() { return viewportOrgX; } public int getWindowOrgY() { return viewportOrgY; } public void setWindowExt(final int windowExtX, final int windowExtY) { this.windowExtY = windowExtY; this.windowExtX = windowExtX; } public int getWindowExtX() { return windowExtX; } public int getWindowExtY() { return windowExtY; } public void setViewportOrg(final int viewportOrgX, final int viewportOrgY) { this.viewportOrgX = viewportOrgX; this.viewportOrgY = viewportOrgY; } public int getViewportOrgX() { return viewportOrgX; } public int getViewportOrgY() { return viewportOrgY; } public void setViewportExt(final int viewportExtX, final int viewportExtY) { this.viewportExtY = viewportExtY; this.viewportExtX = viewportExtX; } public int getViewportExtX() { return viewportExtX; } public int getViewportExtY() { return viewportExtY; } public void setCurPos(final int _curPosX, final int _curPosY) { this.curPosY = _curPosY; this.curPosX = _curPosX; } public int getCurPosX() { return curPosX; } public int getCurPosY() { return curPosY; } public int getTextAlign() { return textAlign; } public void setTextAlign(final int textAlign) { this.textAlign = textAlign; } public void setFgColor(final Color fgColor) { if (fgColor == null) { throw new NullPointerException(); } this.fgColor = fgColor; logBrush.setColor(fgColor); logPen.setColor(fgColor); } public void setBkColor(final Color bkColor) { if (bkColor == null) { throw new NullPointerException(); } this.bkColor = bkColor; logBrush.setBackgroundColor(bkColor); } public Color getFgColor() { return fgColor; } public Color getBkColor() { return bkColor; } public MfLogFont getLogFont() { return logFont; } public MfLogBrush getLogBrush() { return logBrush; } public MfLogPen getLogPen() { return logPen; } public void setLogFont(final MfLogFont logFont) { if (logFont == null) { throw new NullPointerException(); } this.logFont = logFont; } public void setLogBrush(final MfLogBrush logBrush) { if (logBrush == null) { throw new NullPointerException(); } this.logBrush = logBrush; updateBrushBackground(); parent.getGraphics2D().setPaint(logBrush.getPaint()); } public void setLogPen(final MfLogPen logPen) { if (logPen == null) { throw new NullPointerException(); } this.logPen = logPen; parent.getGraphics2D().setStroke(logPen.getStroke()); } public void setLogPalette(final MfLogPalette logPalette) { if (logPalette == null) { throw new NullPointerException(); } this.logPalette = logPalette; } public void setLogRegion(final MfLogRegion logRegion) { if (logRegion == null) { throw new NullPointerException(); } this.logRegion = logRegion; } // No scaling yet? public int getPhysicalX(final int logPointX) { return logPointX + viewportOrgX; } // No scaling yet? public int getPhysicalY(final int logPointY) { return logPointY + viewportOrgY; } public void prepareDraw() { parent.getGraphics2D().setPaint(logPen.getColor()); } public void postDraw() { parent.getGraphics2D().setPaint(logBrush.getPaint()); } public void prepareDrawText() { parent.getGraphics2D().setPaint(textColor); parent.getGraphics2D().setFont(logFont.createFont()); } public void postDrawText() { parent.getGraphics2D().setPaint(logBrush.getPaint()); } public void preparePaint() { parent.getGraphics2D().setPaint(logBrush.getPaint()); } public void postPaint() { } public int getVerticalTextAlignment() { return (textAlign & TextConstants.TA_CENTER); } public int getHorizontalTextAlignment() { return (textAlign & TextConstants.TA_BASELINE); } public MfLogRegion getLogRegion() { return logRegion; } public MfLogPalette getLogPalette() { return logPalette; } public Object clone() throws CloneNotSupportedException { return super.clone(); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfLogRegion.java0000644000175000017500000000263311365605266027361 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Rectangle; /** * A Wmf logical region definition. */ public class MfLogRegion implements WmfObject { private int x; private int y; private int w; private int h; public int getType() { return OBJ_REGION; } public MfLogRegion() { } public void setBounds(final int x, final int y, final int w, final int h) { this.x = x; this.y = y; this.w = w; this.h = h; } public Rectangle getBounds() { return new Rectangle(x, y, w, h); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/GDIColor.java0000644000175000017500000001065611365605266026617 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Color; /** * A color implementation, that supports some additional flags defined by the Windows API, * but has no Alpha-Channel. This is a BGR color implementation, the flags are stored in * the highest byte. */ public class GDIColor extends Color { private static final long serialVersionUID = 1161533883291249918L; public static final int PC_RESERVED = 0x01; public static final int PC_EXPLICIT = 0x02; public static final int PC_NOCOLLAPSE = 0x04; /** * The color flags. */ private int flags; /** * Creates a new GDI color instance by parsing the color reference. * * @param colorref the integer color reference. */ public GDIColor(final int colorref) { this(getR(colorref), getG(colorref), getB(colorref), getFlags(colorref)); } /** * Creates a new GDI Color instance. * * @param r the red channel. * @param g the green channel. * @param b the blue channel. * @param flags the Windows Color flags. */ public GDIColor(final int r, final int g, final int b, final int flags) { super(r, g, b); this.flags = flags; } /** * Extracts the RED channel from the given ColorReference. * * @param ref the color reference. * @return the red channel. */ private static int getR(final int ref) { int retval = (ref & 0x000000ff); if (retval < 0) { retval = (retval + 256); } return retval; } /** * Extracts the GREEN channel from the given ColorReference. * * @param ref the color reference. * @return the green channel. */ private static int getG(final int ref) { return (ref & 0x0000ff00) >> 8; } /** * Extracts the BLUE channel from the given ColorReference. * * @param ref the color reference. * @return the blue channel. */ private static int getB(final int ref) { return (ref & 0x00ff0000) >> 16; } /** * Extracts the Color Flags from the given ColorReference. * * @param ref the color reference. * @return the color flags. */ private static int getFlags(final int ref) { return (ref & 0xff000000) >> 24; } /** * Returns the PC_RESERVED flag state for this color. * * @return true, if PC_RESERVED is set, false otherwise. */ public boolean isReserved() { return (this.flags & PC_RESERVED) == PC_RESERVED; } /** * Returns the PC_EXPLICIT flag state for this color. * * @return true, if PC_EXPLICIT is set, false otherwise. */ public boolean isExplicit() { return (this.flags & PC_EXPLICIT) == PC_EXPLICIT; } /** * Returns the PC_NOCOLLAPSE flag state for this color. * * @return true, if PC_NOCOLLAPSE is set, false otherwise. */ public boolean isNoCollapse() { return (this.flags & PC_NOCOLLAPSE) == PC_NOCOLLAPSE; } /** * Gets the assigned flag for the color. * * @return the flags. */ public int getFlags() { return flags; } /** * Translates the given color instance into a GDI color reference. * * @param c the color that should be translated. * @return the created color reference. */ public static int translateColor(final Color c) { final int red = c.getRed(); final int green = c.getGreen(); final int blue = c.getBlue(); int flags = 0; if (c instanceof GDIColor) { final GDIColor gc = (GDIColor) c; flags = gc.getFlags(); } int retval = flags; retval = (retval << 8) + blue; retval = (retval << 8) + green; retval = (retval << 8) + red; return retval; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfHeader.java0000644000175000017500000002103211365605266026656 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Rectangle; import java.io.IOException; import java.io.InputStream; /** * A buffer which represents a Metafile header. *

* The meta file header has the following structure * * * * * * * *
offset length in bytes name meaning
0x00 2 mfType MetaFile type: 0x1 = memory based meta * file, 0x2 = disk based meta file
0x02 2mfHeader length of header in words (16bit)
0x042 mfVersion Windows version used to save the file as BCD number. * 0x30 for windows 3.0, 0x31 for win3.1 etc.
0x06 4mfSize File length in words
0x0A 2mfNoObj maximum number of objects in the file
0x0c 4 mfMaxRec Maximum record length
0x10 2 mfnoPar Not used
*/ public class MfHeader extends Buffer { /** * A constant stating that the given file is not Wmf-File at all. */ public static final int QUALITY_NO = 0; // Can't convert. /** * A constant stating that the given file could be a Wmf-File. */ public static final int QUALITY_MAYBE = 1; // Might be able to convert. /** * A constant stating that the given file is a Wmf-File. */ public static final int QUALITY_YES = 2; // Can convert. private static final int PLACEABLE_HEADER_SIZE = 22; private static final int STANDARD_HEADER_SIZE = 18; /** * Metadata Positions This implementation always reserves space for both the standard * and the extended wmf header; the standard header is always placed after the extended * header. */ private static final int WMF_FILE_TYPE = PLACEABLE_HEADER_SIZE; // WORD private static final int WMF_HEADER_SIZE = PLACEABLE_HEADER_SIZE + 0x2; // WORD // private static final int WMF_VERSION = PLACEABLE_HEADER_SIZE + 0x4; // WORD private static final int WMF_FILE_SIZE = PLACEABLE_HEADER_SIZE + 0x06; // DWORD private static final int WMF_NUM_OF_REC = PLACEABLE_HEADER_SIZE + 0x0a; // WORD private static final int WMF_MAX_REC_SIZE = PLACEABLE_HEADER_SIZE + 0x0c; // DWORD // private static final int WMF_NUM_PARAMS = PLACEABLE_HEADER_SIZE + 0x10; // WORD always 0 not used /** * MetaData type: WmfFile is a memory copy. */ private static final int WMF_TYPE_MEM = 0; /** MetaData type: WmfFile is a disk copy. */ // private static final int WMF_TYPE_DISK = 1; /** * A magic number indicating that this is a Aldus WMF file. */ private static final int ALDUS_MAGIC_NUMBER_VAL = 0x9ac6cdd7; private static final int ALDUS_MAGIC_NUMBER_POS = 0; // private static final int ALDUS_HANDLE_POS = 4; private static final int ALDUS_POS_LEFT = 6; private static final int ALDUS_POS_TOP = 8; private static final int ALDUS_POS_RIGHT = 10; private static final int ALDUS_POS_BOTTOM = 12; private static final int ALDUS_RESOLUTION = 14; // units per inch public MfHeader() { } // private static final int ALDUS_RESERVED = 16; // private static final int ALDUS_CHECKSUM = 20; /** * Is the given input a metafile? We have to guess by reading the header and/or by * looking at the file name. * * @param inName the file name of the stream source * @param in the input stream. * @return either QUALITY_NO, QUALITY_MAYBE or QUALITY_YES. * @throws IOException if an error occured. */ public static int isMetafile(final String inName, final InputStream in) throws IOException { if (in != null) { // See if we have a valid header. in.mark(PLACEABLE_HEADER_SIZE + STANDARD_HEADER_SIZE); final MfHeader header = new MfHeader(); header.read(in); in.reset(); if (!header.isValid()) { return QUALITY_NO; } if (header.isPlaceable()) { return QUALITY_YES; } // We are not so confident of identifying non-placeable // metafiles, so we require both isValid() and the file // extension to match. } // True if the extension is .wmf. if (inName.regionMatches(true, inName.length() - 4, ".wmf", 0, 4)) { return QUALITY_MAYBE; } return QUALITY_NO; } /** * Read the header from the given input. * * @param in the input stream * @throws IOException if an error occured. */ public void read(final InputStream in) throws IOException { final int total = PLACEABLE_HEADER_SIZE + STANDARD_HEADER_SIZE; setCapacity(total); read(in, 0, 4); if (isPlaceable()) { // read the standard header and the extended Aldus header read(in, 4, total - 4); } else { // Ignore the space for the placeable header, move the (already read) // standard header information to the correct position (after the space // of the (non-existent) extended header move(0, PLACEABLE_HEADER_SIZE, 4); // read the remaining bytes of the standard header ... read(in, PLACEABLE_HEADER_SIZE + 4, STANDARD_HEADER_SIZE - 4); } // Now have the placeable header at the start of the headers buffer, // and the windows header following it. } /** * Return true if this is an Aldus placeable header. * * @return true, if this is an Aldus placeable header, false otherwise. */ private boolean isPlaceable() { // Verify magic number. return getInt(ALDUS_MAGIC_NUMBER_POS) == ALDUS_MAGIC_NUMBER_VAL; } /** * Returns true if it looks like a real metafile. This implementation does not support * Memory-WmfFiles. * * @return true, if this file is valid, false otherwise. */ public boolean isValid() { final int type = getShort(WMF_FILE_TYPE); // Memory or disk. if (type == WMF_TYPE_MEM) { // type == null means this is a wmf from memory. we don't want that return false; } if (getShort(WMF_HEADER_SIZE) != 9) // Header size. { // A VALID wmf-File has always a standard-header size of 9 WORDS == 18 bytes return false; } return true; } /** * Return the bounding box of this metafile. This returns an empty (0,0,0,0) rectangle * if this file is not placeable. * * @return the bounding box of the metafile. */ public Rectangle getBBox() { final int left = getShort(ALDUS_POS_LEFT); final int top = getShort(ALDUS_POS_TOP); final int right = getShort(ALDUS_POS_RIGHT); final int bottom = getShort(ALDUS_POS_BOTTOM); return new Rectangle(left, top, right - left, bottom - top); } /** * Gets the defined resolution, if this is an Aldus-File, null otherwise. * * @return the image resolution or 0 if not defined. */ public int getUnitsPerInch() { return getShort(ALDUS_RESOLUTION); } /** * Gets the file size of the WmfFile. * * @return the filesize in bytes. */ public int getFileSize() { return getInt(WMF_FILE_SIZE) * 2; } /** * Gets the number of records stored in this metafile. * * @return the number of records. */ public int getObjectsSize() { return getShort(WMF_NUM_OF_REC); } /** * Gets the size of the largest Record. * * @return the maximum record size. */ public int getMaxRecordSize() { return getInt(WMF_MAX_REC_SIZE) * 2; } /** * Gets the header size. * * @return the header size. */ public int getHeaderSize() { if (isPlaceable()) { return PLACEABLE_HEADER_SIZE + STANDARD_HEADER_SIZE; } else { return STANDARD_HEADER_SIZE; } } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfRecord.java0000644000175000017500000001333511365605266026713 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.io.IOException; import java.io.InputStream; /** * A Windows metafile record. *

* Every record has a standard header. * *
bytesmeaning
4 Size of header in words
2 type of the record
n*2 array with n words * parameters
*/ public class MfRecord extends Buffer { /** * The size of the record header in bytes. */ public static final int RECORD_HEADER_SIZE = 6; private static final int RECORD_TYPE_POS = 4; /** * the RecordType. */ private MfType type; /** * Creates a new MetaFileRecord with the specified capacitiy. The capacity is given in * 16-Bit words. The resulting buffer has the size of 2*parcount + RECORD_HEADER. * * @param parcount the number of 16-Bit words stored as bulk in the record. */ public MfRecord(final int parcount) { super(parcount * 2 + RECORD_HEADER_SIZE); } /** * Constructs a new MfRecord by reading the data from the input stream. * * @param in the source inputstream * @throws IOException if an IOError occurs. */ public MfRecord(final InputStream in) throws IOException { read(in); } /** * Read a record from an input stream. */ protected void read(final InputStream in) throws IOException { super.read(in, 0, RECORD_HEADER_SIZE); final int remaining = getInt(0) * 2 - RECORD_HEADER_SIZE; if (remaining > 0) { super.read(in, RECORD_HEADER_SIZE, remaining); } type = MfType.get(getType()); } /** * Queries the 16-bit type of this record. * * @return the RecordType */ public int getType() { return getShort(RECORD_TYPE_POS); } /** * Defines the 16-bit type of this record. * * @param type the RecordType */ public void setType(final int type) { setShort(RECORD_TYPE_POS, type); } /** * Return a 16-bit param from the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @return the parameter value. */ public int getParam(final int p) { return getShort(p * 2 + RECORD_HEADER_SIZE); } /** * Defines a 16-bit param at the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @param value the parameter value. */ public void setParam(final int p, final int value) { setShort(p * 2 + RECORD_HEADER_SIZE, value); } /** * Return a 32-bit param from the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @return the parameter value. */ public int getLongParam(final int p) { // Offset is in 16-bit words. return getInt(p * 2 + RECORD_HEADER_SIZE); } /** * Defines a 32-bit param at the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @param value the parameter value. */ public void setLongParam(final int p, final int value) { setInt(p * 2 + RECORD_HEADER_SIZE, value); } /** * Return a string param from the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @return the parameter value. */ public String getStringParam(final int p, final int len) { return getString(p * 2 + RECORD_HEADER_SIZE, len); } /** * Defines a string param at the given offset. Offset is in 16-bit words. * * @param p the parameter position in words. * @param s the parameter value. */ public void setStringParam(final int p, final String s) { setString(p * 2 + RECORD_HEADER_SIZE, s); } /** * Return the name of this type of record. */ public String getName() { return type.getName(); } /** * Return debug info. */ public String toString() { final StringBuffer result = new StringBuffer(); result.append(type); result.append(' '); result.append(getName()); result.append(": "); final StringBuffer str = new StringBuffer(); final int len = (getInt(0) - 3) * 2; for (int i = 0; i < len; i++) { if ((i % 16) == 0) { result.append('\n'); str.append('\n'); } else if ((i % 8) == 0) { result.append(' '); } final int by = getByte(i + RECORD_HEADER_SIZE); if (by < 16) { result.append('0'); } result.append(Integer.toHexString(by)); //str.append ((char) by); result.append(' '); } return result.toString(); } /** * True if this record marks the screen. Currently such records are ignored. */ public boolean doesMark() { return (type.doesMark()); } /** * True if this record affects mapping modes. */ public boolean isMappingMode() { return (type.isMappingMode()); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MappingConstants.java0000644000175000017500000000304011365605266030472 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * Various MappingConstants defined in the Windows API. */ public interface MappingConstants { public static final int MM_TEXT = 1; public static final int MM_LOMETRIC = 2; public static final int MM_HIMETRIC = 3; public static final int MM_LOENGLISH = 4; public static final int MM_HIENGLISH = 5; public static final int MM_TWIPS = 6; public static final int MM_ISOTROPIC = 7; public static final int MM_ANISOTROPIC = 8; /* Min and Max Mapping Mode values */ public static final int MM_MIN = MM_TEXT; public static final int MM_MAX = MM_ANISOTROPIC; public static final int MM_MAX_FIXEDSCALE = MM_TWIPS; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfType.java0000644000175000017500000002352111365605266026414 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * Predefined types of Windows metafile records. */ public class MfType { // NOT YET IMPLEMENTED // Needs Bitmap-Implementation to work correctly public static final int CREATE_DIB_PATTERN_BRUSH = 0x0142; // Needs Bitmap-Implementation to work correctly public static final int CREATE_PATTERN_BRUSH = 0x01F9; public static final int SET_DIBITS_TO_DEVICE = 0x0d33; public static final int ANIMATE_PALETTE = 0x0436; public static final int ARC = 0x0817; public static final int BIT_BLT = 0x0940; public static final int CHORD = 0x0830; public static final int CREATE_BRUSH_INDIRECT = 0x02fc; public static final int CREATE_FONT_INDIRECT = 0x02fb; public static final int CREATE_PALETTE = 0x00f7; public static final int CREATE_PEN_INDIRECT = 0x02fa; public static final int CREATE_REGION = 0x06ff; public static final int DELETE_OBJECT = 0x01f0; public static final int ELLIPSE = 0x0418; public static final int ESCAPE = 0x0626; public static final int EXCLUDE_CLIP_RECT = 0x0415; public static final int EXT_FLOOD_FILL = 0x0548; public static final int EXT_TEXT_OUT = 0x0a32; public static final int FLOOD_FILL = 0x0419; public static final int FILL_REGION = 0x0228; public static final int FRAME_REGION = 0x0429; public static final int INTERSECT_CLIP_RECT = 0x0416; public static final int INVERT_REGION = 0x012a; public static final int LINE_TO = 0x0213; public static final int MOVE_TO = 0x0214; public static final int OFFSET_CLIP_RGN = 0x0220; public static final int OFFSET_VIEWPORT_ORG = 0x0211; public static final int OFFSET_WINDOW_ORG = 0x020f; public static final int PAINTREGION = 0x012b; public static final int PAT_BLT = 0x061d; public static final int PIE = 0x081a; public static final int POLYGON = 0x0324; public static final int POLYLINE = 0x0325; public static final int POLY_POLYGON = 0x0538; public static final int REALISE_PALETTE = 0x0035; public static final int RECTANGLE = 0x041b; public static final int RESIZE_PALETTE = 0x0139; public static final int RESTORE_DC = 0x0127; public static final int ROUND_RECT = 0x061c; public static final int SAVE_DC = 0x001e; public static final int SCALE_VIEWPORT_EXT = 0x0412; public static final int SCALE_WINDOW_EXT = 0x0400; public static final int SELECT_CLIP_REGION = 0x012c; public static final int SELECT_OBJECT = 0x012d; public static final int SELECT_PALETTE = 0x0234; public static final int SET_BK_COLOR = 0x0201; public static final int SET_BK_MODE = 0x0102; public static final int SET_MAP_MODE = 0x0103; public static final int SET_MAPPER_FLAGS = 0x0231; public static final int SET_PALETTE_ENTRIES = 0x0037; public static final int SET_PIXEL = 0x041f; public static final int SET_POLY_FILL_MODE = 0x0106; public static final int SET_ROP2 = 0x0104; public static final int SET_STRETCH_BLT_MODE = 0x0107; public static final int SET_TEXT_ALIGN = 0x012e; public static final int SET_TEXT_CHAR_EXTRA = 0x0108; public static final int SET_TEXT_COLOR = 0x0209; public static final int SET_TEXT_JUSTIFICATION = 0x020a; public static final int SET_VIEWPORT_EXT = 0x020e; public static final int SET_VIEWPORT_ORG = 0x020d; public static final int SET_WINDOW_EXT = 0x020c; public static final int SET_WINDOW_ORG = 0x020b; public static final int STRETCH_BLT = 0x0b41; public static final int STRETCH_DIBITS = 0x0f43; public static final int TEXT_OUT = 0x0521; public static final int END_OF_FILE = 0x0000; public static final int OLD_STRETCH_BLT = 0x0b23; public static final int OLD_CREATE_PATTERN_BRUSH = 0x01f9; public static final int OLD_BIT_BLT = 0x0922; /** * Type bit flags. */ public static final int STATE = 0x01; public static final int VECTOR = 0x02; public static final int RASTER = 0x04; public static final int MAPPING_MODE = 0x08; /** * All the known types. The last is the default. */ private static MfType[] ntab = { new MfType(PAINTREGION, "MfPaintRegion", VECTOR), new MfType(ARC, "MfArc", VECTOR), new MfType(CHORD, "MfChord", VECTOR), new MfType(ELLIPSE, "MfEllipse", VECTOR), new MfType(EXCLUDE_CLIP_RECT, "MfExcludeClipRect", STATE), new MfType(FLOOD_FILL, "MfFloodFill", VECTOR), new MfType(INTERSECT_CLIP_RECT, "MfIntersectClipRect", STATE), new MfType(LINE_TO, "MfLineTo", VECTOR), new MfType(MOVE_TO, "MfMoveTo", STATE), new MfType(OFFSET_CLIP_RGN, "MfOffsetclipRgn", STATE), new MfType(OFFSET_VIEWPORT_ORG, "MfOffsetViewportOrg", STATE | MAPPING_MODE), new MfType(OFFSET_WINDOW_ORG, "MfOffsetWindowOrg", STATE | MAPPING_MODE), new MfType(PAT_BLT, "MfPatBlt", RASTER), new MfType(PIE, "MfPie", VECTOR), new MfType(REALISE_PALETTE, "MfRealisePalette", STATE), new MfType(RECTANGLE, "MfRectangle", VECTOR), new MfType(RESIZE_PALETTE, "MfResizePalette", STATE), new MfType(RESTORE_DC, "MfRestoreDC", STATE | MAPPING_MODE), new MfType(ROUND_RECT, "MfRoundRect", VECTOR), new MfType(SAVE_DC, "MfSaveDC", STATE), new MfType(SCALE_VIEWPORT_EXT, "MfScaleViewportExt", STATE | MAPPING_MODE), new MfType(SCALE_WINDOW_EXT, "MfScaleWindowExt", STATE | MAPPING_MODE), new MfType(SET_BK_COLOR, "MfSetBkColor", STATE), new MfType(SET_BK_MODE, "MfSetBkMode", STATE), new MfType(SET_MAP_MODE, "MfSetMapMode", STATE | MAPPING_MODE), new MfType(SET_MAPPER_FLAGS, "MfSetMapperFlags", STATE), new MfType(SET_PIXEL, "MfSetPixel", RASTER), new MfType(SET_POLY_FILL_MODE, "MfSetPolyFillMode", STATE), new MfType(SET_ROP2, "MfSetROP2", STATE), new MfType(SET_STRETCH_BLT_MODE, "MfSetStretchBltMode", STATE), new MfType(SET_TEXT_ALIGN, "MfSetTextAlign", STATE), new MfType(SET_TEXT_CHAR_EXTRA, "MfSetTextCharExtra", STATE), new MfType(SET_TEXT_COLOR, "MfSetTextColor", STATE), new MfType(SET_TEXT_JUSTIFICATION, "MfSetTextJustification", STATE), new MfType(SET_VIEWPORT_EXT, "MfSetViewportExt", STATE | MAPPING_MODE), new MfType(SET_VIEWPORT_ORG, "MfSetViewportOrg", STATE | MAPPING_MODE), new MfType(SET_WINDOW_EXT, "MfSetWindowExt", STATE | MAPPING_MODE), new MfType(SET_WINDOW_ORG, "MfSetWindowOrg", STATE | MAPPING_MODE), new MfType(ANIMATE_PALETTE, "MfAnimatePalette", STATE), new MfType(BIT_BLT, "MfBitBlt", RASTER), new MfType(OLD_BIT_BLT, "MfOldBitBlt", RASTER), new MfType(CREATE_BRUSH_INDIRECT, "MfCreateBrush", STATE), new MfType(CREATE_FONT_INDIRECT, "MfCreateFont", STATE), new MfType(CREATE_PALETTE, "MfCreatePalette", STATE), new MfType(OLD_CREATE_PATTERN_BRUSH, "MfOldCreatePatternBrush", STATE), new MfType(CREATE_PATTERN_BRUSH, "MfCreatePatternBrush", STATE), new MfType(CREATE_PEN_INDIRECT, "MfCreatePen", STATE), new MfType(CREATE_REGION, "MfCreateRegion", STATE), new MfType(DELETE_OBJECT, "MfDeleteObject", STATE), // new MfType( DRAW_TEXT, "MfDrawText", VECTOR ), new MfType(ESCAPE, "MfEscape", STATE), new MfType(EXT_TEXT_OUT, "MfExtTextOut", VECTOR), new MfType(POLYGON, "MfPolygon", VECTOR), new MfType(POLY_POLYGON, "MfPolyPolygon", VECTOR), new MfType(POLYLINE, "MfPolyline", VECTOR), new MfType(SELECT_CLIP_REGION, "MfSelectClipRegion", STATE), new MfType(SELECT_OBJECT, "MfSelectObject", STATE), new MfType(SELECT_PALETTE, "MfSelectPalette", STATE), new MfType(SET_DIBITS_TO_DEVICE, "MfSetDIBitsToDevice", RASTER), new MfType(SET_PALETTE_ENTRIES, "MfSetPaletteEntries", STATE), new MfType(OLD_STRETCH_BLT, "MfOldStretchBlt", RASTER), new MfType(STRETCH_BLT, "MfStretchBlt", RASTER), new MfType(STRETCH_DIBITS, "MfStretchDIBits", RASTER), new MfType(TEXT_OUT, "MfTextOut", VECTOR), new MfType(END_OF_FILE, "MfEndOfFile", STATE), new MfType(-1, "MfUnknown", 0) }; /** * Map a 16-bit type id onto an object. */ public static MfType get(final int id) { for (int i = 0; i < ntab.length; i++) { if (ntab[i].id == id) { return ntab[i]; } } return ntab[ntab.length - 1]; // Not found. } // Getter functionen private int id; private int type; private String name; public int getId() { return id; } public String getName() { return name; } public int getType() { return type; } /** * True if this record marks the screen. */ public boolean doesMark() { return (type & (VECTOR | RASTER)) != 0; } /** * True if this record affects mapping modes. */ public boolean isMappingMode() { return (type & MAPPING_MODE) != 0; } private MfType(final int id, final String name, final int type) { this.id = id; this.name = name; this.type = type; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/FontConstants.java0000644000175000017500000000541711365605266030017 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * Various FontConstants defined in the Windows API. */ public interface FontConstants { public static final int DEFAULT_QUALITY = 0; public static final int DRAFT_QUALITY = 1; public static final int PROOF_QUALITY = 2; public static final int NONANTIALIASED_QUALITY = 3; public static final int ANTIALIASED_QUALITY = 4; public static final int DEFAULT_PITCH = 0; public static final int FIXED_PITCH = 1; public static final int VARIABLE_PITCH = 2; public static final int MONO_FONT = 8; /* Font Families */ /* Don't care or don't know. */ public static final int FF_DONTCARE = (0 << 4); /** * Variable stroke width, serifed. Times Roman, Century Schoolbook, etc. */ public static final int FF_ROMAN = (1 << 4); /* * Variable stroke width, sans-serifed. * Helvetica, Swiss, etc. */ public static final int FF_SWISS = (2 << 4); /* * Constant stroke width, serifed or sans-serifed. * Pica, Elite, Courier, etc. */ public static final int FF_MODERN = (3 << 4); /* Cursive, etc. */ public static final int FF_SCRIPT = (4 << 4); /* Old English, etc. */ public static final int FF_DECORATIVE = (5 << 4); /* Font Weights */ public static final int FW_DONTCARE = 0; public static final int FW_THIN = 100; public static final int FW_EXTRALIGHT = 200; public static final int FW_LIGHT = 300; public static final int FW_NORMAL = 400; public static final int FW_MEDIUM = 500; public static final int FW_SEMIBOLD = 600; public static final int FW_BOLD = 700; public static final int FW_EXTRABOLD = 800; public static final int FW_HEAVY = 900; public static final int FW_ULTRALIGHT = FW_EXTRALIGHT; public static final int FW_REGULAR = FW_NORMAL; public static final int FW_DEMIBOLD = FW_SEMIBOLD; public static final int FW_ULTRABOLD = FW_EXTRABOLD; public static final int FW_BLACK = FW_HEAVY; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/BrushConstants.java0000644000175000017500000000410211365605266030162 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * The BrushConstants were defined in the Windows-API and are used do define the * appearance of Wmf-Brushes. */ public interface BrushConstants { /* Brush Styles */ public static final int BS_SOLID = 0; public static final int BS_NULL = 1; public static final int BS_HOLLOW = BS_NULL; public static final int BS_HATCHED = 2; public static final int BS_PATTERN = 3; public static final int BS_INDEXED = 4; public static final int BS_DIBPATTERN = 5; public static final int BS_DIBPATTERNPT = 6; public static final int BS_PATTERN8X8 = 7; public static final int BS_DIBPATTERN8X8 = 8; public static final int BS_MONOPATTERN = 9; /* Hatch Style: -----. */ public static final int HS_HORIZONTAL = 0; /* Hatch Style: |||||. */ public static final int HS_VERTICAL = 1; /* Hatch Style: \\\\\\\ . */ public static final int HS_FDIAGONAL = 2; /* Hatch Style: //////// . */ public static final int HS_BDIAGONAL = 3; /* Hatch Style: +++++++ . */ public static final int HS_CROSS = 4; /* Hatch Style: XXXXXXX . */ public static final int HS_DIAGCROSS = 5; public static final int TRANSPARENT = 1; public static final int OPAQUE = 2; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfPalette.java0000644000175000017500000000214311365605266027066 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * A WmfLogicalPalette, currently not implemented. */ public class MfPalette implements WmfObject { public MfPalette() { } public int getType() { return OBJ_PALETTE; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/0000755000175000017500000000000011365605266025616 5ustar renerenelibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/RGBCompression.java0000644000175000017500000001642111365605266031321 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.IOException; import java.io.InputStream; public class RGBCompression extends BitmapCompression { public RGBCompression() { } public int[] decompress(final InputStream in, final GDIPalette palette) throws IOException { final int[] target = new int[getWidth() * getHeight()]; switch (getBpp()) { case 1: fillMono(target, in, palette); break; case 4: fill4Bit(target, in, palette); break; case 8: fill8Bit(target, in, palette); break; case 16: fill16Bit(target, in, palette); break; case 24: fill24Bit(target, in, palette); break; case 32: fill32Bit(target, in, palette); break; } return target; } /** * Cut or padd the string to the given size * * @param size the wanted length * @param padChar char to use for padding (must be of length()==1!) * @return the string with correct lenght, padded with pad if necessary */ public static String forceToSizeLeft(final String str, final int size, final char padChar) { if (str != null && str.length() == size) { return str; } final StringBuffer tmp; if (str == null) { tmp = new StringBuffer(size); } else { tmp = new StringBuffer(str); } if (tmp.length() > size) { tmp.setLength(size); return tmp.toString(); // do cutting } else { final StringBuffer t2 = new StringBuffer(size); final int arsize = size - tmp.length(); final char[] ar = new char[arsize]; for (int i = 0; i < arsize; i++) { ar[i] = padChar; } t2.append(ar); t2.append(tmp); return t2.toString(); } } public void fillMono(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = (int) Math.ceil(target.length / 8); if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { final int iByte = readInt(in); if (iByte == -1) { return; } final int[] data = expandMonocrome(iByte, pal); final int left = (target.length - i * 8); final int size = Math.min(8, left); for (int ij = size - 1; ij >= 0; ij--) { target[7 - ij + i * 8] = data[ij]; } } } else { for (int i = 0; i < noOfBytes; i++) { final int iByte = readInt(in); if (iByte == -1) { return; } final int[] data = expandMonocrome(iByte, pal); System.arraycopy(data, 0, target, i * 8, 8); } } } public void fill4Bit(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = (int) Math.ceil(target.length / 2); if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { final int iByte = in.read(); if (iByte == -1) { return; } final int[] data = expand4BitTuple(iByte, pal); target[i * 2] = data[1]; target[i * 2 + 1] = data[0]; } } else { for (int i = 0; i < noOfBytes; i++) { final int iByte = in.read(); if (iByte == -1) { return; } final int[] data = expand4BitTuple(iByte, pal); target[i * 2] = data[0]; target[i * 2 + 1] = data[1]; } } } public void fill8Bit(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = target.length; if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { final int iByte = in.read(); if (iByte == -1) { return; } target[i] = pal.lookupColor(iByte); } } else { for (int i = 0; i < noOfBytes; i++) { final int iByte = in.read(); if (iByte == -1) { return; } target[i] = pal.lookupColor(iByte); } } } public void fill16Bit(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = target.length * 2; if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { final int iByte = in.read(); if (iByte == -1) { return; } final int iByte2 = in.read(); if (iByte2 == -1) { return; } target[i] = pal.lookupColor((iByte2 << 8) + iByte); } } else { for (int i = 0; i < noOfBytes; i++) { final int iByte = in.read(); if (iByte == -1) { return; } final int iByte2 = in.read(); if (iByte2 == -1) { return; } target[i] = pal.lookupColor((iByte2 << 8) + iByte); } } } public void fill24Bit(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = target.length * 4; if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { target[i] = pal.lookupColor(readInt(in)); } } else { for (int i = 0; i < noOfBytes; i++) { target[i] = pal.lookupColor(readInt(in)); } } } public void fill32Bit(final int[] target, final InputStream in, final GDIPalette pal) throws IOException { final int noOfBytes = target.length * 4; if (isTopDown() == false) { for (int i = noOfBytes - 1; i >= 0; i--) { target[i] = pal.lookupColor(readInt(in)); } } else { for (int i = 0; i < noOfBytes; i++) { target[i] = pal.lookupColor(readInt(in)); } } } protected int readInt(final InputStream in) throws IOException { final int iByte = in.read(); if (iByte == -1) { return -1; } final int iByte2 = in.read(); if (iByte2 == -1) { return -1; } final int iByte3 = in.read(); if (iByte3 == -1) { return -1; } final int iByte4 = in.read(); if (iByte4 == -1) { return -1; } return ((iByte4 << 24) + (iByte3 << 16) + (iByte2 << 8) + (iByte)); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/DIBReader.java0000644000175000017500000000450411365605266030205 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; public class DIBReader { private GDIPalette palette; // as GDI Color value private BitmapHeader header; public DIBReader() { } public BufferedImage setRecord(final MfRecord record) throws IOException { return setRecord(record, 0); } public BufferedImage setRecord(final MfRecord record, final int offset) throws IOException { header = new BitmapHeader(); header.setRecord(record, offset); palette = new GDIPalette(); palette.setNoOfColors(header.getNoOfColors()); final int width = header.getWidth(); final int height = header.getHeight(); final int paletteStart = MfRecord.RECORD_HEADER_SIZE + header.getHeaderSize() + 4 + offset; final InputStream dataIn = record.getInputStream(paletteStart); palette.readPalette(dataIn); final int compression = header.getCompression(); final BitmapCompression comHandler = BitmapCompressionFactory.getHandler(compression); comHandler.setDimension(width, height); comHandler.setBpp(header.getBitsPerPixel()); final int[] data = comHandler.decompress(dataIn, palette); final BufferedImage retval = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); retval.setRGB(0, 0, width, height, data, 0, width); return retval; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/RLE8Compression.java0000644000175000017500000000221211365605266031412 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.InputStream; public class RLE8Compression extends BitmapCompression { public RLE8Compression() { } public int[] decompress(final InputStream in, final GDIPalette palette) { return null; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitFieldsCompression.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitFieldsCompression.jav0000644000175000017500000000222411365605266032407 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.InputStream; public class BitFieldsCompression extends BitmapCompression { public BitFieldsCompression() { } public int[] decompress(final InputStream in, final GDIPalette palette) { return null; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitmapCompressionFactory.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitmapCompressionFactory0000644000175000017500000000274411365605266032536 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; public class BitmapCompressionFactory { private BitmapCompressionFactory() { } public static BitmapCompression getHandler(final int comp) { switch (comp) { case BitmapHeader.BI_RGB: return new RGBCompression(); case BitmapHeader.BI_RLE4: return new RLE4Compression(); case BitmapHeader.BI_RLE8: return new RLE8Compression(); case BitmapHeader.BI_BITFIELDS: return new BitFieldsCompression(); default: throw new IllegalArgumentException("Unknown compression: " + comp); } } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/RLE4Compression.java0000644000175000017500000000221211365605266031406 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.InputStream; public class RLE4Compression extends BitmapCompression { public RLE4Compression() { } public int[] decompress(final InputStream in, final GDIPalette palette) { return null; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/GDIPalette.java0000644000175000017500000000430611365605266030406 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.IOException; import java.io.InputStream; public class GDIPalette { private int noColors; private int[] colors; public GDIPalette() { } public void setNoOfColors(final int colors) { this.noColors = colors; } public void setNoOfImportantColors(final int colors) { if (colors > noColors) { throw new IllegalArgumentException("There may be not more important colors than colors defined in the palette."); } } public void readPalette(final InputStream in) throws IOException { colors = new int[noColors]; for (int i = 0; i < noColors; i++) { colors[i] = readNextColor(in); } } private int readNextColor(final InputStream in) throws IOException { final int b = in.read(); final int g = in.read(); final int r = in.read(); //final int filler = //noinspection ResultOfMethodCallIgnored in.read(); return b + (g << 8) + (r << 16); } public int lookupColor(final int color) { if (noColors == 0) { // Convert from BGR (windows) format to RGB (java) format final int b = (color & 0x00ff0000) >> 16; final int g = (color & 0x0000ff00); final int r = (color & 0x000000ff); return b + g + (r << 16); } return colors[color]; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitmapCompression.java0000644000175000017500000000602711365605266032124 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.io.IOException; import java.io.InputStream; public abstract class BitmapCompression { private int height; private int width; private int bpp; private boolean topDown; protected BitmapCompression() { } public void setDimension(final int width, final int height) { this.width = width; this.height = height; } public int getHeight() { return height; } public int getWidth() { return width; } public int getBpp() { return bpp; } public void setBpp(final int bpp) { this.bpp = bpp; } public void setTopDown(final boolean b) { this.topDown = b; } public boolean isTopDown() { return topDown; } public abstract int[] decompress(InputStream in, GDIPalette palette) throws IOException; public static int[] expandMonocrome(final int b, final GDIPalette pal) { final int tColor = pal.lookupColor(1); final int fColor = pal.lookupColor(0); final int[] retval = new int[8]; if ((b & 0x01) == 0x01) { retval[0] = tColor; } else { retval[0] = fColor; } if ((b & 0x02) == 0x02) { retval[1] = tColor; } else { retval[1] = fColor; } if ((b & 0x04) == 0x04) { retval[2] = tColor; } else { retval[2] = fColor; } if ((b & 0x08) == 0x08) { retval[3] = tColor; } else { retval[3] = fColor; } if ((b & 0x10) == 0x10) { retval[4] = tColor; } else { retval[4] = fColor; } if ((b & 0x20) == 0x20) { retval[5] = tColor; } else { retval[5] = fColor; } if ((b & 0x40) == 0x40) { retval[6] = tColor; } else { retval[6] = fColor; } if ((b & 0x80) == 0x80) { retval[7] = tColor; } else { retval[7] = fColor; } return retval; } public static int[] expand4BitTuple(final int b, final GDIPalette pal) { final int[] retval = new int[2]; retval[0] = pal.lookupColor((b & 0xF0) >> 4); retval[1] = pal.lookupColor(b & 0x0F); return retval; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitmapHeader.java0000644000175000017500000001047411365605266031014 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; public final class BitmapHeader { public static final int BI_RGB = 0; public static final int BI_RLE8 = 1; public static final int BI_RLE4 = 2; public static final int BI_BITFIELDS = 3; private static final int BMPH_DATA_OFFSET = MfRecord.RECORD_HEADER_SIZE; private static final int BMPH_HEADERSIZE = MfRecord.RECORD_HEADER_SIZE + 4; private static final int BMPH_WIDTH = MfRecord.RECORD_HEADER_SIZE + 8; private static final int BMPH_HEIGHT = MfRecord.RECORD_HEADER_SIZE + 12; private static final int BMPH_NO_PLANES = MfRecord.RECORD_HEADER_SIZE + 14; private static final int BMPH_BPP = MfRecord.RECORD_HEADER_SIZE + 16; private static final int BMPH_COMPRESSION = MfRecord.RECORD_HEADER_SIZE + 20; private static final int BMPH_DATASIZE = MfRecord.RECORD_HEADER_SIZE + 24; private static final int BMPH_HRES = MfRecord.RECORD_HEADER_SIZE + 28; private static final int BMPH_VRES = MfRecord.RECORD_HEADER_SIZE + 32; private static final int BMPH_NO_COLORS = MfRecord.RECORD_HEADER_SIZE + 36; private static final int BMPH_NO_IMPORTANT_COLORS = MfRecord.RECORD_HEADER_SIZE + 40; private int dataOffset; private int headerSize; private int width; private int height; private int noPlanes; private int bitPerPixel; private int compression; private int dataSize; private int hres; // ignored private int vres; // ignored private int noColors; // in palette private int noImportantColors; // is <= noColors private boolean isTopDown; public BitmapHeader() { } public void setRecord(final MfRecord record, final int offset) { dataOffset = record.getInt(offset + BMPH_DATA_OFFSET); headerSize = record.getInt(offset + BMPH_HEADERSIZE); width = record.getInt(offset + BMPH_WIDTH); height = record.getInt(offset + BMPH_HEIGHT); noPlanes = record.getShort(offset + BMPH_NO_PLANES); bitPerPixel = record.getShort(offset + BMPH_BPP); compression = record.getInt(offset + BMPH_COMPRESSION); dataSize = record.getInt(offset + BMPH_DATASIZE); hres = record.getInt(offset + BMPH_HRES); vres = record.getInt(offset + BMPH_VRES); noColors = record.getInt(offset + BMPH_NO_COLORS); noImportantColors = record.getInt(offset + BMPH_NO_IMPORTANT_COLORS); if (height < 0) { isTopDown = true; height = -height; } fixPalette(); } private void fixPalette() { if (bitPerPixel < 16) { if (noColors == 0) { noColors = (int) StrictMath.pow(2, bitPerPixel); } if (noImportantColors == 0) { noImportantColors = (int) StrictMath.pow(2, bitPerPixel); } } } public int getHeaderSize() { return headerSize; } public int getCompression() { return compression; } public int getBitsPerPixel() { return bitPerPixel; } public int getHRes() { return hres; } public int getVRes() { return vres; } public int getWidth() { return width; } public int getHeight() { return height; } public int getNoOfColors() { return noColors; } public int getNoOfImportantColors() { return noImportantColors; } public boolean isTopDown() { return isTopDown; } public int getDataOffset() { return dataOffset; } public int getDataSize() { return dataSize; } public int getNoPlanes() { return noPlanes; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/bitmap/BitmapReader.java0000644000175000017500000002533411365605266031027 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.bitmap; import java.awt.Image; import java.awt.Toolkit; import java.awt.image.MemoryImageSource; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.pentaho.reporting.libraries.base.util.IOUtils; public class BitmapReader { private BitmapReader() { } // build an int from a byte array - convert little to big endian public static int constructInt(final byte[] in, final int offset) { int ret = ((int) in[offset + 3] & 0xff); ret = (ret << 8) | ((int) in[offset + 2] & 0xff); ret = (ret << 8) | ((int) in[offset + 1] & 0xff); ret = (ret << 8) | ((int) in[offset] & 0xff); return (ret); } // build an int from a byte array - convert little to big endian // set high order bytes to 0xfff public static int constructInt3(final byte[] in, final int offset) { int ret = 0xff; ret = (ret << 8) | ((int) in[offset + 2] & 0xff); ret = (ret << 8) | ((int) in[offset + 1] & 0xff); ret = (ret << 8) | ((int) in[offset] & 0xff); return (ret); } // build an int from a byte array - convert little to big endian public static long constructLong(final byte[] in, final int offset) { long ret = ((long) in[offset + 7] & 0xff); ret |= (ret << 8) | ((long) in[offset + 6] & 0xff); ret |= (ret << 8) | ((long) in[offset + 5] & 0xff); ret |= (ret << 8) | ((long) in[offset + 4] & 0xff); ret |= (ret << 8) | ((long) in[offset + 3] & 0xff); ret |= (ret << 8) | ((long) in[offset + 2] & 0xff); ret |= (ret << 8) | ((long) in[offset + 1] & 0xff); ret |= (ret << 8) | ((long) in[offset] & 0xff); return (ret); } // build an double from a byte array - convert little to big endian public static double constructDouble(final byte[] in, final int offset) { final long ret = constructLong(in, offset); return (Double.longBitsToDouble(ret)); } // build an short from a byte array - convert little to big endian public static short constructShort(final byte[] in, final int offset) { short ret = (short) ((short) in[offset + 1] & 0xff); ret = (short) ((ret << 8) | (short) ((short) in[offset] & 0xff)); return (ret); } // // internal class representing a bitmap header structure // with code to read it from a file protected static class BitmapHeader { public int nsize; public int nbisize; public int nwidth; public int nheight; public int nplanes; public int nbitcount; public int ncompression; public int nsizeimage; public int nxpm; public int nypm; public int nclrused; public int nclrimp; protected BitmapHeader() { } // read in the bitmap header public void read(final InputStream fs) throws IOException { final int bflen = 14; // 14 byte BITMAPFILEHEADER final byte[] bf = new byte[bflen]; IOUtils.getInstance().readFully(fs, bf, 0, bflen); final int bilen = 40; // 40-byte BITMAPINFOHEADER final byte[] bi = new byte[bilen]; IOUtils.getInstance().readFully(fs, bi, 0, bilen); // Interperet data. nsize = constructInt(bf, 2); // System.out.println("File type is :"+(char)bf[0]+(char)bf[1]); // System.out.println("Size of file is :"+nsize); nbisize = constructInt(bi, 2); // System.out.println("Size of bitmapinfoheader is :"+nbisize); nwidth = constructInt(bi, 4); // System.out.println("Width is :"+nwidth); nheight = constructInt(bi, 8); // System.out.println("Height is :"+nheight); nplanes = constructShort(bi, 12); //(((int)bi[13]&0xff)<<8) | (int)bi[12]&0xff; // System.out.println("Planes is :"+nplanes); nbitcount = constructShort(bi, 14); //(((int)bi[15]&0xff)<<8) | (int)bi[14]&0xff; // System.out.println("BitCount is :"+nbitcount); // Look for non-zero values to indicate compression ncompression = constructInt(bi, 16); // System.out.println("Compression is :"+ncompression); nsizeimage = constructInt(bi, 20); // System.out.println("SizeImage is :"+nsizeimage); nxpm = constructInt(bi, 24); // System.out.println("X-Pixels per meter is :"+nxpm); nypm = constructInt(bi, 28); // System.out.println("Y-Pixels per meter is :"+nypm); nclrused = constructInt(bi, 32); // System.out.println("Colors used are :"+nclrused); nclrimp = constructInt(bi, 36); // System.out.println("Colors important are :"+nclrimp); } } public static Image read(final FileInputStream fs) { try { final BitmapHeader bh = new BitmapHeader(); bh.read(fs); if (bh.nbitcount == 24) { return (readMap24(fs, bh)); } if (bh.nbitcount == 32) { return (readMap32(fs, bh)); } if (bh.nbitcount == 8) { return (readMap8(fs, bh)); } fs.close(); } catch (IOException e) { // System.out.println("Caught exception in loadbitmap!"); } return (null); } /** * readMap24 internal routine to read the bytes in a 24 bit bitmap * * @param fs file stream * @param bh header struct * @return Image Object, be sure to check for (Image)null !!!! */ protected static Image readMap32(final FileInputStream fs, final BitmapHeader bh) throws IOException { // No Palatte data for 24-bit format but scan lines are // padded out to even 4-byte boundaries. // final int xwidth = bh.nsizeimage / bh.nheight; final int[] ndata = new int[bh.nheight * bh.nwidth]; final byte[] brgb = new byte[bh.nwidth * 4 * bh.nheight]; IOUtils.getInstance().readFully(fs, brgb, 0, bh.nwidth * 4 * bh.nheight); int nindex = 0; for (int j = 0; j < bh.nheight; j++) { for (int i = 0; i < bh.nwidth; i++) { ndata[bh.nwidth * (bh.nheight - j - 1) + i] = constructInt3(brgb, nindex); nindex += 4; } } final Image image = Toolkit.getDefaultToolkit().createImage (new MemoryImageSource(bh.nwidth, bh.nheight, ndata, 0, bh.nwidth)); fs.close(); return (image); } /** * readMap24 internal routine to read the bytes in a 24 bit bitmap * * @param fs file stream * @param bh header struct * @return Image Object, be sure to check for (Image)null !!!! */ protected static Image readMap24(final FileInputStream fs, final BitmapHeader bh) throws IOException { // No Palatte data for 24-bit format but scan lines are // padded out to even 4-byte boundaries. final int npad = (bh.nsizeimage / bh.nheight) - bh.nwidth * 3; final int[] ndata = new int[bh.nheight * bh.nwidth]; final byte[] brgb = new byte[(bh.nwidth + npad) * 3 * bh.nheight]; IOUtils.getInstance().readFully(fs, brgb, 0, (bh.nwidth + npad) * 3 * bh.nheight); int nindex = 0; for (int j = 0; j < bh.nheight; j++) { for (int i = 0; i < bh.nwidth; i++) { ndata[bh.nwidth * (bh.nheight - j - 1) + i] = constructInt3(brgb, nindex); nindex += 3; } nindex += npad; } final Image image = Toolkit.getDefaultToolkit().createImage (new MemoryImageSource(bh.nwidth, bh.nheight, ndata, 0, bh.nwidth)); fs.close(); return (image); } /** * readMap8 internal routine to read the bytes in a 8 bit bitmap * * @param fs file stream * @param bh header struct * @return Image Object, be sure to check for (Image)null !!!! */ protected static Image readMap8(final FileInputStream fs, final BitmapHeader bh) throws IOException { // Have to determine the number of colors, the clrsused // parameter is dominant if it is greater than zero. If // zero, calculate colors based on bitsperpixel. final int nNumColors; if (bh.nclrused > 0) { nNumColors = bh.nclrused; } else { nNumColors = (1 & 0xff) << bh.nbitcount; } // System.out.println("The number of Colors is"+nNumColors); // Some bitmaps do not have the sizeimage field calculated // Ferret out these cases and fix 'em. if (bh.nsizeimage == 0) { bh.nsizeimage = ((((bh.nwidth * bh.nbitcount) + 31) & ~31) >> 3); bh.nsizeimage *= bh.nheight; // System.out.println("nsizeimage (backup) is"+nsizeimage); } // Read the palatte colors. final int[] npalette = new int[nNumColors]; final byte[] bpalette = new byte[nNumColors * 4]; IOUtils.getInstance().readFully(fs, bpalette, 0, nNumColors * 4); int nindex8 = 0; for (int n = 0; n < nNumColors; n++) { npalette[n] = constructInt3(bpalette, nindex8); nindex8 += 4; } // Read the image data (actually indices into the palette) // Scan lines are still padded out to even 4-byte // boundaries. final int npad8 = (bh.nsizeimage / bh.nheight) - bh.nwidth; // System.out.println("nPad is:"+npad8); final int[] ndata8 = new int[bh.nwidth * bh.nheight]; final byte[] bdata = new byte[(bh.nwidth + npad8) * bh.nheight]; IOUtils.getInstance().readFully(fs, bdata, 0, (bh.nwidth + npad8) * bh.nheight); nindex8 = 0; for (int j8 = 0; j8 < bh.nheight; j8++) { for (int i8 = 0; i8 < bh.nwidth; i8++) { ndata8[bh.nwidth * (bh.nheight - j8 - 1) + i8] = npalette[((int) bdata[nindex8] & 0xff)]; nindex8++; } nindex8 += npad8; } final Image image = Toolkit.getDefaultToolkit().createImage (new MemoryImageSource(bh.nwidth, bh.nheight, ndata8, 0, bh.nwidth)); return (image); } /** * load method - see read for details * * @param sdir full path name * @return Image Object, be sure to check for (Image)null !!!! */ public static Image load(final String sdir) { try { final FileInputStream fs = new FileInputStream(sdir); return (read(fs)); } catch (IOException ex) { return (null); } } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/0000755000175000017500000000000011365605266026003 5ustar renerene././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetPolyFillMode.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetPolyFillMode.ja0000644000175000017500000000707511365605266032252 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdSetPolyFillMode extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_POLYFILLMODE = 0; public static final int ALTERNATE = 1; public static final int WINDING = 2; private int fillmode; public MfCmdSetPolyFillMode() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setPolyFillMode(fillmode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetPolyFillMode(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(0); setFillMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_POLYFILLMODE, getFillMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_POLY_FILL_MODE; } public int getFillMode() { return fillmode; } public void setFillMode(final int id) { this.fillmode = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_POLY_FILL_MODE] fillmode="); b.append(getFillMode()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPolygon.java0000644000175000017500000001300011365605266031176 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Polygon; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Polygon function draws a polygon consisting of two or more vertices connected by * straight lines. The polygon is outlined by using the current pen and filled by using * the current brush and polygon fill mode. */ public class MfCmdPolygon extends MfCmd { private int[] points_x; private int[] points_y; private int[] scaled_points_x; private int[] scaled_points_y; private int count; public MfCmdPolygon() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Polygon polygon = new Polygon(getScaledPointsX(), getScaledPointsY(), getPointCount()); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(polygon); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(polygon); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPolygon(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.POLYGON; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[POLYGON] count="); b.append(getPointCount()); final int l = getPointCount(); final int[] points_x = getPointsX(); final int[] points_y = getPointsY(); for (int i = 0; i < l; i++) { if (i != 0) { b.append(','); } b.append(" ("); b.append(points_x[i]); b.append(','); b.append(points_y[i]); b.append(") "); } return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int count = record.getParam(0); final int[] points_x = new int[count]; final int[] points_y = new int[count]; for (int i = 0; i < count; i++) { points_x[i] = record.getParam(1 + 2 * i); points_y[i] = record.getParam(2 + 2 * i); } setPointCount(count); setPoints(points_x, points_y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(getPointCount() * 2 + 1); final int count = getPointCount(); final int[] points_x = getPointsX(); final int[] points_y = getPointsY(); record.setParam(0, count); for (int i = 0; i < count; i++) { record.setParam(1 + 2 * i, points_x[i]); record.setParam(2 + 2 * i, points_y[i]); } return record; } public void setPointCount(final int count) { this.count = count; } public void setPoints(final int[] points_x, final int[] points_y) { this.points_x = points_x; this.points_y = points_y; scaleXChanged(); scaleYChanged(); } public int[] getPointsX() { return points_x; } public int[] getPointsY() { return points_y; } public int[] getScaledPointsX() { return scaled_points_x; } public int[] getScaledPointsY() { return scaled_points_y; } public int getPointCount() { return count; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_points_x = applyScaleX(points_x, scaled_points_x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_points_y = applyScaleY(points_y, scaled_points_y); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdOffsetViewportOrg.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdOffsetViewportOrg.0000644000175000017500000001023611365605266032353 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Moves the current Viewport Origin to the specified position */ public class MfCmdOffsetViewportOrg extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_X = 1; private static final int POS_Y = 0; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdOffsetViewportOrg() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Point p = getScaledDestination(); state.setViewportOrg (state.getViewportOrgX() + p.x, state.getViewportOrgY() + p.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdOffsetViewportOrg(); } public Point getDestination() { return new Point(x, y); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[OFFSET_VIEWPORT] destination="); b.append(getDestination()); return b.toString(); } public void setDestination(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public void setDestination(final Point p) { setDestination(p.x, p.y); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.OFFSET_VIEWPORT_ORG; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setDestination(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Point dest = getDestination(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_Y, dest.y); record.setParam(POS_X, dest.x); return record; } public Point getScaledDestination() { return new Point(scaled_x, scaled_y); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdExcludeClipRect.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdExcludeClipRect.ja0000644000175000017500000000707011365605266032251 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * top, left, right and bottom define the points of the region to be deleted from the * clipping region, the resultant clipping region is the original region minus this * region. */ public class MfCmdExcludeClipRect extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_TOP = 2; private static final int POS_LEFT = 3; private static final int POS_RIGHT = 1; private static final int POS_BOTTOM = 0; private int x; private int y; private int width; private int height; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; public MfCmdExcludeClipRect() { } public void replay(final WmfFile file) { // Not implemented! // no clipping is implemented at all ... } public MfCmd getInstance() { return new MfCmdExcludeClipRect(); } public void setRecord(final MfRecord record) { final int bottom = record.getParam(POS_BOTTOM); final int right = record.getParam(POS_RIGHT); final int top = record.getParam(POS_TOP); final int left = record.getParam(POS_LEFT); setBounds(left, top, right - left, bottom - top); } /** * Writer function */ public MfRecord getRecord() { final Rectangle rc = getBounds(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_BOTTOM, (int) (rc.getY() + rc.getHeight())); record.setParam(POS_RIGHT, (int) (rc.getX() + rc.getWidth())); record.setParam(POS_TOP, (int) (rc.getY())); record.setParam(POS_LEFT, (int) (rc.getX())); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[EXCLUDE_CLIP_RECT] bounds="); b.append(getBounds()); return b.toString(); } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); } protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); } public int getFunction() { return MfType.EXCLUDE_CLIP_RECT; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetViewPortExt.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetViewPortExt.jav0000644000175000017500000001045511365605266032335 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Dimension; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Sets the size of the viewport. The SetViewportOrgEx function specifies which device * point maps to the window origin (0,0). *

* This functionality is similiar to a TranslateTransform. */ public class MfCmdSetViewPortExt extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_HEIGHT = 0; private static final int POS_WIDTH = 1; private int height; private int width; private int scaled_width; private int scaled_height; public MfCmdSetViewPortExt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Dimension dim = getScaledDimension(); state.setViewportExt(dim.width, dim.height); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetViewPortExt(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int height = record.getParam(POS_HEIGHT); final int width = record.getParam(POS_WIDTH); setDimension(width, height); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); final Dimension dim = getDimension(); record.setParam(POS_HEIGHT, dim.height); record.setParam(POS_WIDTH, dim.width); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_VIEWPORT_EXT] dimension="); b.append(getDimension()); return b.toString(); } public Dimension getDimension() { return new Dimension(width, height); } public Dimension getScaledDimension() { return new Dimension(scaled_width, scaled_height); } public void setDimension(final int w, final int h) { this.width = w; this.height = h; scaleXChanged(); scaleYChanged(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_height = getScaledY(height); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_VIEWPORT_EXT; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetStretchBltMode.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetStretchBltMode.0000644000175000017500000000704111365605266032254 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdSetStretchBltMode extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_STRETCHMODE = 0; private int stretchmode; public MfCmdSetStretchBltMode() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setStretchBltMode(stretchmode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetStretchBltMode(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_STRETCHMODE); setStretchMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_STRETCHMODE, getStretchMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_STRETCH_BLT_MODE; } public int getStretchMode() { return stretchmode; } public void setStretchMode(final int id) { this.stretchmode = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_STRECH_BLT_MODE] stretchmode="); b.append(getStretchMode()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetWindowOrg.java0000644000175000017500000001013311365605266032146 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Defines the upper left corner of the Window. The size of the window is defined using * setWindowExt. *

* This is the same function as the SetViewPort.. functions, damn windows! */ public class MfCmdSetWindowOrg extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_Y = 0; private static final int POS_X = 1; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdSetWindowOrg() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Point p = getScaledTarget(); state.setWindowOrg(p.x, p.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetWindowOrg(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setTarget(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); final Point p = getTarget(); record.setParam(POS_X, p.x); record.setParam(POS_Y, p.y); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_WINDOW_ORG] target="); b.append(getTarget()); return b.toString(); } public Point getTarget() { return new Point(x, y); } public void setTarget(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_WINDOW_ORG; } public Point getScaledTarget() { return new Point(scaled_x, scaled_y); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdFloodFill.java0000644000175000017500000001101711365605266031427 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The FloodFill function fills an area of the display surface with the current brush. The * area is assumed to be bounded as specified by the crFill parameter. */ public class MfCmdFloodFill extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_COLOR = 0; private static final int POS_Y = 2; private static final int POS_X = 3; private int x; private int y; private int scaled_x; private int scaled_y; private Color color; public MfCmdFloodFill() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // there is no way of implementing a flood fill operation for Graphics2D. } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdFloodFill(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int c = record.getLongParam(POS_COLOR); final Color color = new GDIColor(c); final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setTarget(x, y); setColor(color); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); final Point target = getTarget(); record.setParam(POS_Y, (int) target.getY()); record.setParam(POS_X, (int) target.getX()); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[FLOOD_FILL] color="); b.append(getColor()); b.append(" target="); b.append(getTarget()); return b.toString(); } public Point getTarget() { return new Point(x, y); } public Point getScaledTarget() { return new Point(scaled_x, scaled_y); } public void setTarget(final Point point) { setTarget(point.x, point.y); } public void setTarget(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public void setColor(final Color c) { this.color = c; } public Color getColor() { return color; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.FLOOD_FILL; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetPixel.java0000644000175000017500000001124311365605266031313 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Draws a single pixel with the given color on the specified position. */ public class MfCmdSetPixel extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_COLOR = 0; private static final int POS_X = 3; private static final int POS_Y = 2; private int x; private int y; private int scaled_x; private int scaled_y; private Color color; public MfCmdSetPixel() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Point p = getScaledTarget(); final Graphics2D g = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); state.prepareDraw(); g.drawLine(p.x, p.y, p.x, p.y); state.postDraw(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetPixel(); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); final Point p = getTarget(); record.setParam(POS_X, p.x); record.setParam(POS_Y, p.y); return record; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int c = record.getLongParam(POS_COLOR); final Color color = new GDIColor(c); final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setTarget(x, y); setColor(color); } public Point getTarget() { return new Point(x, y); } public Point getScaledTarget() { return new Point(scaled_x, scaled_y); } public void setTarget(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public void setTarget(final Point point) { this.x = point.x; this.y = point.y; } public void setColor(final Color c) { this.color = c; } public Color getColor() { return color; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_PIXEL; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_PIXEL] target="); b.append(getTarget()); b.append(" color="); b.append(getColor()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdStretchBlt.java0000644000175000017500000000670611365605266031644 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The StretchBlt function copies a bitmap from a source rectangle into a destination * rectangle, stretching or compressing the bitmap to fit the dimensions of the * destination rectangle, if necessary. The system stretches or compresses the bitmap * according to the stretching mode currently set in the destination device context. *

* This method is not implemented. todo ask wine about this function implementation ... */ public class MfCmdStretchBlt extends MfCmd { public MfCmdStretchBlt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdStretchBlt(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { // System.out.println("Old StretchBlt is not yet implemented."); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[OLD_STRECH_BLT] is not implemented"); return b.toString(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.OLD_STRETCH_BLT; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { throw new RecordCreationException("[OLD_STRETCH_BLT] is not implemented."); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPolyPolygon.java0000644000175000017500000002106311365605266032052 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.geom.GeneralPath; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * PolyPolygon, is a list of polygons, for filled polygons SetPolyFillMode affects how the * polygon is filled. the number of polygons is recorded, followed by the number of points * in each polygon, and then a long sequence of all the points of all the polygons. */ public class MfCmdPolyPolygon extends MfCmd { private Object[] points_x; // contains int[] private Object[] points_y; // contains int[] private Object[] scaled_points_x; // contains int[] private Object[] scaled_points_y; // contains int[] private int polycount; public MfCmdPolyPolygon() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); final GeneralPath genPath = new GeneralPath(); for (int i = 0; i < polycount; i++) { final int[] pointsX = getScaledPointsX(i); final int[] pointsY = getScaledPointsY(i); final Polygon polygon = new Polygon(pointsX, pointsY, pointsX.length); genPath.append(polygon, false); } if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(genPath); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(genPath); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPolyPolygon(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.POLY_POLYGON; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[POLYPOLYGON] polycount="); b.append(getPolygonCount()); b.append('\n'); for (int p = 0; p < getPolygonCount(); p++) { b.append(" Polygon "); b.append(p); final int[] points_x = getPointsX(p); final int[] points_y = getPointsY(p); final int l = points_x.length; for (int i = 0; i < l; i++) { if (i != 0) { b.append(','); } b.append(" ("); b.append(points_x[i]); b.append(','); b.append(points_y[i]); b.append(") "); } b.append('\n'); } return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int numberOfPolygons = record.getParam(0); //Log.debug("Number Of Polygons: " + numberOfPolygons); final int[] count = new int[numberOfPolygons]; final Object[] poly_points_x = new Object[numberOfPolygons]; final Object[] poly_points_y = new Object[numberOfPolygons]; // read the length of each polygon for (int i = 0; i < numberOfPolygons; i++) { final int numberOfPointsInPolygon = record.getParam(1 + i); //Log.debug("Number Of points in polygon: " + numberOfPointsInPolygon); count[i] = numberOfPointsInPolygon; } // getLength? //Log.debug("record.getLength(): " + (record.getLength() / 2)); // for each polygon, read the points ... int readPosition = 1 + numberOfPolygons; for (int i = 0; i < numberOfPolygons; i++) { // Position of the points depends on the number of points // of the previous polygons final int numberOfPoints = count[i]; final int[] points_x = new int[numberOfPoints]; final int[] points_y = new int[numberOfPoints]; // read position is after numPolygonPointsRead + noOfPolygons + 1 (for the first parameter) for (int point = 0; point < numberOfPoints; point += 1) { points_x[point] = record.getParam(readPosition); readPosition += 1; points_y[point] = record.getParam(readPosition); readPosition += 1; } poly_points_x[i] = points_x; poly_points_y[i] = points_y; } setPolygonCount(numberOfPolygons); setPoints(poly_points_x, poly_points_y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final int numberOfPolygons = getPolygonCount(); int pointsTotal = 0; for (int i = 0; i < numberOfPolygons; i++) { pointsTotal += getPointsX(i).length; } final MfRecord record = new MfRecord(1 + numberOfPolygons + pointsTotal * 2); record.setParam(0, numberOfPolygons); int numberOfPointsRead = 0; for (int i = 0; i < numberOfPolygons; i++) { final int[] x_points = getPointsX(i); final int[] y_points = getPointsY(i); final int numberOfPointsInPolygon = x_points.length; record.setParam(1 + i, numberOfPointsInPolygon); final int readPos = numberOfPointsRead * 2 + numberOfPolygons + 1; for (int j = 0; j < numberOfPointsInPolygon; j++) { record.setParam((readPos + 1) + j * 2, x_points[i]); record.setParam((readPos + 2) + j * 2, y_points[i]); } numberOfPointsRead += numberOfPointsInPolygon; } return record; } public void setPoints(final Object[] points_x, final Object[] points_y) { this.points_x = points_x; this.points_y = points_y; scaleXChanged(); scaleYChanged(); } public int[] getPointsX(final int polygon) { return (int[]) points_x[polygon]; } public int[] getPointsY(final int polygon) { return (int[]) points_y[polygon]; } public int[] getScaledPointsX(final int polygon) { return (int[]) scaled_points_x[polygon]; } public int[] getScaledPointsY(final int polygon) { return (int[]) scaled_points_y[polygon]; } public void setPolygonCount(final int count) { this.polycount = count; } public int getPolygonCount() { return polycount; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { if (scaled_points_x == null) { scaled_points_x = new Object[points_x.length]; } if (scaled_points_x.length < points_x.length) { scaled_points_x = new Object[points_x.length]; } for (int i = 0; i < polycount; i++) { scaled_points_x[i] = applyScaleX((int[]) points_x[i], (int[]) scaled_points_x[i]); } } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { if (scaled_points_y == null) { scaled_points_y = new Object[points_y.length]; } if (scaled_points_y.length < points_y.length) { scaled_points_y = new Object[points_y.length]; } for (int i = 0; i < polycount; i++) { scaled_points_y[i] = applyScaleY((int[]) points_y[i], (int[]) scaled_points_y[i]); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdUnknownCommand.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdUnknownCommand.jav0000644000175000017500000000461011365605266032353 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * This function is not in the validity list of Microsofts WindowsMetafile Records. */ public class MfCmdUnknownCommand extends MfCmd { private int function; public MfCmdUnknownCommand() { } public void replay(final WmfFile file) { } public MfCmd getInstance() { return new MfCmdUnknownCommand(); } public void setRecord(final MfRecord record) { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { throw new RecordCreationException("The {Unknown Command} is not writeable"); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[UNKNOWN COMMAND] "); b.append(Integer.toHexString(getFunction())); return b.toString(); } public void setFunction(final int function) { this.function = function; } public int getFunction() { return function; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdEscape.java0000644000175000017500000000655711365605266030772 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The layout of META_ESC is unknown, but it doesnt matter, as it has no effect on on * screen metafile display. *

* This sends MCI-Informations to the device-driver. Java and all non-windows systems have * no use of Windows-Driver-Details at all. *

* Wine just dumps the given data into the file. As we operate in a non native * environment, this record could never be implemented. */ public class MfCmdEscape extends MfCmd { public MfCmdEscape() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[ESCAPE] is not used and will not be implemented"); return b.toString(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdEscape(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { // System.out.println("Escape is not implemented."); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.ESCAPE; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { throw new UnsupportedOperationException("Native functions are not supported"); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdResizePalette.java0000644000175000017500000000660011365605266032337 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The ResizePalette function increases or decreases the size of a logical palette based * on the specified value. */ public class MfCmdResizePalette extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_NEW_PALETTE_SIZE = 0; private int paletteSize; public MfCmdResizePalette() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // Not implemented! } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdResizePalette(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { setPaletteSize(record.getParam(POS_NEW_PALETTE_SIZE)); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setType(getFunction()); record.setParam(POS_NEW_PALETTE_SIZE, getPaletteSize()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.RESIZE_PALETTE; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[RESIZE_PALETTE] is not implemented"); return b.toString(); } /** * Not implemented as no scaling needed for this operation. */ protected void scaleXChanged() { } /** * Not implemented as no scaling needed for this operation. */ protected void scaleYChanged() { } public int getPaletteSize() { return paletteSize; } public void setPaletteSize(final int paletteSize) { this.paletteSize = paletteSize; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdStretchDibits.java0000644000175000017500000001610711365605266032335 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.io.IOException; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.bitmap.DIBReader; /** * The StretchDIBits function copies the color data for a rectangle of pixels in a DIB to * the specified destination rectangle. If the destination rectangle is larger than the * source rectangle, this function stretches the rows and columns of color data to fit the * destination rectangle. If the destination rectangle is smaller than the source * rectangle, this function compresses the rows and columns by using the specified raster * operation. */ public class MfCmdStretchDibits extends MfCmd { // private static final int RECORD_BASE_SIZE = 11; private static final int POS_ROP = 0; private static final int POS_USAGE = 2; private static final int POS_SRC_H = 3; private static final int POS_SRC_W = 4; private static final int POS_SRC_Y = 5; private static final int POS_SRC_X = 6; private static final int POS_DST_H = 7; private static final int POS_DST_W = 8; private static final int POS_DST_Y = 9; private static final int POS_DST_X = 10; private static final int POS_DIB = 11; private int rop; private int srcX; private int srcY; private int srcW; private int srcH; private int destX; private int destY; private int destW; private int destH; private int usage; private int scaled_srcX; private int scaled_srcY; private int scaled_srcW; private int scaled_srcH; private int scaled_destX; private int scaled_destY; private int scaled_destW; private int scaled_destH; private BufferedImage image; public MfCmdStretchDibits() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // not implemented ... } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdStretchDibits(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.STRETCH_DIBITS; } public int getROP() { return rop; } public void setROP(final int rop) { this.rop = rop; } public BufferedImage getImage() { return image; } public void setImage(final BufferedImage image) { this.image = image; } public int getUsage() { return usage; } public void setUsage(final int usage) { this.usage = usage; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int rop = record.getLongParam(POS_ROP); final int usage = record.getParam(POS_USAGE); // This is the only parameter left, so I assume this final int srcH = record.getParam(POS_SRC_H); final int srcW = record.getParam(POS_SRC_W); final int ySrc = record.getParam(POS_SRC_Y); final int xSrc = record.getParam(POS_SRC_X); final int destH = record.getParam(POS_DST_H); final int destW = record.getParam(POS_DST_W); final int yDest = record.getParam(POS_DST_Y); final int xDest = record.getParam(POS_DST_X); try { final DIBReader reader = new DIBReader(); setImage(reader.setRecord(record, POS_DIB)); } catch (IOException ioe) { // failed to load the bitmap .. } // DIB ab pos 11 setROP(rop); setUsage(usage); setSrcRect(xSrc, ySrc, srcH, srcW); setDestRect(xDest, yDest, destH, destW); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { throw new RecordCreationException("StretchDIBits is not implemented"); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[STRETCH_DIBITS] rop="); b.append(getROP()); b.append(" srcRect="); b.append(getSrcRect()); b.append(" destRect="); b.append(getDestRect()); b.append(" usage="); b.append(getUsage()); return b.toString(); } public void setSrcRect(final int x, final int y, final int w, final int h) { this.srcX = x; this.srcY = y; this.srcW = w; this.srcH = h; scaleXChanged(); scaleYChanged(); } public void setDestRect(final int x, final int y, final int w, final int h) { this.destX = x; this.destY = y; this.destW = w; this.destH = h; scaleXChanged(); scaleYChanged(); } public Rectangle getSrcRect() { return new Rectangle(srcX, srcY, srcW, srcH); } public Rectangle getDestRect() { return new Rectangle(destX, destY, destW, destH); } public Rectangle getScaledSrcRect() { return new Rectangle(scaled_srcX, scaled_srcY, scaled_srcW, scaled_srcH); } public Rectangle getScaledDestRect() { return new Rectangle(scaled_destX, scaled_destY, scaled_destW, scaled_destH); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_srcX = getScaledX(srcX); scaled_srcW = getScaledX(srcW); scaled_destX = getScaledX(destX); scaled_destW = getScaledX(destW); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_srcY = getScaledY(srcY); scaled_srcH = getScaledY(srcH); scaled_destY = getScaledY(destY); scaled_destH = getScaledY(destH); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdIntersectClipRect.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdIntersectClipRect.0000644000175000017500000001216111365605266032302 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * top, left, right and bottom define the points of the clipping region, the resultant * clipping region is the intersection of this region and the original region. */ public class MfCmdIntersectClipRect extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_BOTTOM = 3; private static final int POS_RIGHT = 2; private static final int POS_TOP = 1; private static final int POS_LEFT = 0; private int x; private int y; private int width; private int height; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; public MfCmdIntersectClipRect() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Rectangle rect = state.getClipRegion(); final Rectangle2D rec2 = rect.createIntersection(getScaledIntersectClipRect()); state.setClipRegion(new Rectangle((int) rec2.getX(), (int) rec2.getY(), (int) rec2.getWidth(), (int) rec2.getHeight())); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdIntersectClipRect(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.INTERSECT_CLIP_RECT; } public Rectangle getIntersectClipRect() { return new Rectangle(x, y, width, height); } public Rectangle getScaledIntersectClipRect() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[INTERSECT_CLIP_RECT] bounds="); b.append(getIntersectClipRect()); return b.toString(); } public void setIntersectClipRect(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int bottom = record.getParam(POS_BOTTOM); final int right = record.getParam(POS_RIGHT); final int top = record.getParam(POS_TOP); final int left = record.getParam(POS_LEFT); setIntersectClipRect(left, top, right - left, bottom - top); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Rectangle rc = getIntersectClipRect(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_BOTTOM, (int) (rc.getY() + rc.getHeight())); record.setParam(POS_RIGHT, (int) (rc.getX() + rc.getWidth())); record.setParam(POS_TOP, (int) (rc.getY())); record.setParam(POS_LEFT, (int) (rc.getX())); return record; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdFrameRegion.java0000644000175000017500000001336711365605266031765 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The FrameRgn function draws a border around the specified region by using the specified * brush. */ public class MfCmdFrameRegion extends MfCmd { private int width; private int height; private int scaled_width; private int scaled_height; private int brushObjectNr; private int regionObjectNr; public MfCmdFrameRegion() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogBrush brush = file.getBrushObject(brushObjectNr); final MfLogRegion regio = file.getRegionObject(regionObjectNr); final MfDcState state = file.getCurrentState(); state.setLogRegion(regio); state.setLogBrush(brush); final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = scaleRect(regio.getBounds()); if (brush.isVisible()) { final Dimension dim = getScaledDimension(); // upper side final Rectangle2D rect = new Rectangle2D.Double(); rect.setFrame(rec.x, rec.y, rec.width, dim.height); state.preparePaint(); graph.fill(rect); // lower side rect.setFrame(rec.x, rec.y - dim.height, rec.width, dim.height); graph.fill(rect); // east rect.setFrame(rec.x, rec.y, dim.width, rec.height); graph.fill(rect); // west rect.setFrame(rec.width - dim.width, rec.y, dim.width, rec.height); graph.fill(rect); state.postPaint(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdFrameRegion(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.FRAME_REGION; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int height = record.getParam(0); final int width = record.getParam(1); final int regio = record.getParam(2); final int brush = record.getParam(3); setBrush(brush); setRegion(regio); setDimension(width, height); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(4); final Dimension dim = getDimension(); record.setParam(0, dim.height); record.setParam(1, dim.width); record.setParam(2, getRegion()); record.setParam(3, getBrush()); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[FRAME_REGION] region="); b.append(getRegion()); b.append(" brush="); b.append(getBrush()); b.append(" dimension="); b.append(getDimension()); return b.toString(); } public void setDimension(final int width, final int height) { this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } public void setDimension(final Dimension dim) { setDimension(dim.width, dim.height); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_height = getScaledY(height); } public Dimension getDimension() { return new Dimension(width, height); } public Dimension getScaledDimension() { return new Dimension(scaled_width, scaled_height); } public int getBrush() { return brushObjectNr; } public void setBrush(final int brush) { this.brushObjectNr = brush; } public int getRegion() { return regionObjectNr; } public void setRegion(final int region) { regionObjectNr = region; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdTextOut.java0000644000175000017500000001244111365605266031173 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Prints the given string. That record is as weird as everything in windows. First * parameter is the string length, then follows the string and finally the x and y * coordinates (in that order) where to print the string. */ public class MfCmdTextOut extends MfCmd { private int x; private int y; private String text; private int count; private int scaled_x; private int scaled_y; public MfCmdTextOut() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Point p = getScaledDestination(); final int x = p.x; final int y = p.y; final Graphics2D graphics = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); state.prepareDrawText(); graphics.drawString(text, x, y); state.postDrawText(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdTextOut(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.TEXT_OUT; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int count = record.getParam(0); final byte[] text = new byte[count]; for (int i = 0; i < count; i++) { text[i] = (byte) record.getByte(MfRecord.RECORD_HEADER_SIZE + 2 + i); } final String sText = new String(text); final int y = record.getParam((int) (Math.ceil(count / 2) + 1)); final int x = record.getParam((int) (Math.ceil(count / 2) + 2)); setCount(count); setDestination(x, y); setText(sText); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final String text = getText(); final int parCntText = (int) Math.ceil(text.length() / 2); final MfRecord record = new MfRecord(parCntText + 3); record.setParam(0, text.length()); final byte[] textRaw = text.getBytes(); for (int i = 0; i < count; i++) { record.setByte(MfRecord.RECORD_HEADER_SIZE + 2 + i, textRaw[i]); } final Point dest = getDestination(); record.setParam((int) (Math.ceil(count / 2) + 1), dest.y); record.setParam((int) (Math.ceil(count / 2) + 2), dest.x); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[TEXT_OUT] text="); b.append(getText()); b.append(" destination="); b.append(getDestination()); b.append(" count="); b.append(getCount()); return b.toString(); } public void setDestination(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public Point getDestination() { return new Point(x, y); } public void setText(final String text) { this.text = text; } public String getText() { return text; } public int getCount() { return count; } public void setCount(final int count) { this.count = count; } public Point getScaledDestination() { return new Point(scaled_x, scaled_y); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPie.java0000644000175000017500000001667211365605266030306 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Arc2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Pie function draws a pie-shaped wedge bounded by the intersection of an ellipse and * two radials. The pie is outlined by using the current pen and filled by using the * current brush. */ public class MfCmdPie extends MfCmd { private static final int PARAM_X_END_POS = 0; private static final int PARAM_Y_END_POS = 1; private static final int PARAM_X_START_POS = 2; private static final int PARAM_Y_START_POS = 3; private static final int PARAM_BOTTOM_POS = 4; private static final int PARAM_RIGHT_POS = 5; private static final int PARAM_TOP_POS = 6; private static final int PARAM_LEFT_POS = 7; private static final int RECORD_SIZE = 8; private int x; private int y; private int width; private int height; private int xstart; private int ystart; private int xend; private int yend; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; private int scaled_xstart; private int scaled_ystart; private int scaled_xend; private int scaled_yend; public MfCmdPie() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getScaledBounds(); final Point start = getScaledStartingIntersection(); final Point end = getScaledEndingIntersection(); final Arc2D arc = new Arc2D.Double(); arc.setArcType(Arc2D.PIE); arc.setFrame(rec.x, rec.y, rec.width, rec.height); arc.setAngles(start.x, start.y, end.x, end.y); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(arc); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(arc); state.postDraw(); } } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); scaled_xstart = getScaledX(xstart); scaled_xend = getScaledX(xend); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); scaled_ystart = getScaledY(xstart); scaled_yend = getScaledY(xend); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPie(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.PIE; } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[PIE] bounds="); b.append(getBounds()); b.append(" startIntersection="); b.append(getStartingIntersection()); b.append(" endingIntersection="); b.append(getEndingIntersection()); return b.toString(); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } public void setStartingIntersection(final int x, final int y) { xstart = x; ystart = y; scaleXChanged(); scaleYChanged(); } public Point getStartingIntersection() { return new Point(xstart, ystart); } public Point getScaledStartingIntersection() { return new Point(scaled_xstart, scaled_ystart); } public void setEndingIntersection(final int x, final int y) { xend = x; yend = y; scaleXChanged(); scaleYChanged(); } public Point getEndingIntersection() { return new Point(xend, yend); } public Point getScaledEndingIntersection() { return new Point(scaled_xend, scaled_yend); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int xend = record.getParam(PARAM_X_END_POS); final int yend = record.getParam(PARAM_Y_END_POS); final int xstart = record.getParam(PARAM_X_START_POS); final int ystart = record.getParam(PARAM_Y_START_POS); final int bottom = record.getParam(PARAM_BOTTOM_POS); final int right = record.getParam(PARAM_RIGHT_POS); final int top = record.getParam(PARAM_TOP_POS); final int left = record.getParam(PARAM_LEFT_POS); setBounds(left, top, right - left, bottom - top); setStartingIntersection(xstart, ystart); setEndingIntersection(xend, yend); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); final Rectangle bounds = getBounds(); final Point start = getStartingIntersection(); final Point end = getEndingIntersection(); record.setParam(PARAM_LEFT_POS, (int) bounds.getX()); record.setParam(PARAM_TOP_POS, (int) bounds.getY()); record.setParam(PARAM_RIGHT_POS, (int) (bounds.getX() + bounds.getWidth())); record.setParam(PARAM_BOTTOM_POS, (int) (bounds.getY() + bounds.getHeight())); record.setParam(PARAM_Y_START_POS, (int) (start.getY())); record.setParam(PARAM_X_START_POS, (int) (start.getX())); record.setParam(PARAM_Y_END_POS, (int) (end.getY())); record.setParam(PARAM_X_END_POS, (int) (end.getX())); return record; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreateFont.java0000644000175000017500000002432711365605266031617 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Font; import org.pentaho.reporting.libraries.pixie.wmf.MfLogFont; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The CreateFontIndirect function creates a logical font that has the specified * characteristics. The font can subsequently be selected as the current font for any * device context. *

* typedef struct tagLOGFONT { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG * lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE * lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE * lfPitchAndFamily; TCHAR lfFaceName[LF_FACESIZE]; } LOGFONT, *PLOGFONT; */ public final class MfCmdCreateFont extends MfCmd { public static final int CHARSET_ANSI = 0; public static final int CHARSET_DEFAULT = 1; public static final int CHARSET_SYMBOL = 2; public static final int CHARSET_SHIFTJIS = 128; public static final int CHARSET_OEM = 255; private static final int FONT_FACE_MAX = 31; private static final int FIXED_RECORD_SIZE = 9; private static final int POS_HEIGHT = 0; private static final int POS_WIDTH = 1; private static final int POS_ESCAPEMENT = 2; private static final int POS_ORIENTATION = 3; private static final int POS_WEIGHT = 4; private static final int POS_FLAGS1 = 5; private static final int POS_FLAGS2 = 6; private static final int POS_PRECISION = 7; private static final int POS_QUALITY = 8; private static final int POS_FONTFACE = 9; private int height; private int width; private int scaled_height; private int scaled_width; private int escapement; private int orientation; private int weight; private boolean italic; private boolean underline; private boolean strikeout; private int charset; private int outprecision; private int clipprecision; private int quality; private int pitchAndFamily; private String facename; public MfCmdCreateFont() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogFont lfont = new MfLogFont(); lfont.setFace(getFontFace()); lfont.setSize(getScaledHeight()); int style; // should be bold ? if (getWeight() > 650) { style = Font.BOLD; } else { style = Font.PLAIN; } if (isItalic()) { style += Font.ITALIC; } lfont.setStyle(style); lfont.setUnderline(isUnderline()); lfont.setStrikeOut(isStrikeout()); lfont.setRotation(getEscapement() / 10); file.getCurrentState().setLogFont(lfont); file.storeObject(lfont); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreateFont(); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { String fontFace = getFontFace(); if (fontFace.length() > FONT_FACE_MAX) { fontFace = fontFace.substring(0, FONT_FACE_MAX); } final MfRecord record = new MfRecord(FIXED_RECORD_SIZE + fontFace.length()); record.setParam(POS_HEIGHT, getHeight()); record.setParam(POS_WIDTH, getWidth()); record.setParam(POS_ESCAPEMENT, getEscapement()); record.setParam(POS_ORIENTATION, getOrientation()); record.setParam(POS_WEIGHT, getWeight()); record.setParam(POS_FLAGS1, formFlags(isUnderline(), isItalic())); record.setParam(POS_FLAGS2, formFlags(isStrikeout(), false) + getCharset()); record.setParam(POS_PRECISION, getOutputPrecision() << 8 + getClipPrecision()); record.setParam(POS_QUALITY, getQuality() << 8 + getPitchAndFamily()); record.setStringParam(POS_FONTFACE, fontFace); return record; } public void setRecord(final MfRecord record) { int height = record.getParam(POS_HEIGHT); if (height == 0) { // a default height is requested, we use a default height of 10 height = 10; } if (height < 0) { // windows specifiy font mapper matching, ignored. height *= -1; } final int width = record.getParam(POS_WIDTH); final int escape = record.getParam(POS_ESCAPEMENT); final int orientation = record.getParam(POS_ORIENTATION); final int weight = record.getParam(POS_WEIGHT); final int italic = record.getParam(POS_FLAGS1) & 0x00FF; final int underline = record.getParam(POS_FLAGS1) & 0xFF00; final int strikeout = record.getParam(POS_FLAGS2) & 0x00FF; final int charset = record.getParam(POS_FLAGS2) & 0xFF00; final int outprec = record.getParam(POS_PRECISION) & 0x00FF; final int clipprec = record.getParam(POS_PRECISION) & 0xFF00; final int quality = record.getParam(POS_QUALITY) & 0x00FF; final int pitch = record.getParam(POS_QUALITY) & 0xFF00; // A fontname must not exceed the length of 32 including the null-terminator final String facename = record.getStringParam(POS_FONTFACE, 32); setCharset(charset); setClipPrecision(clipprec); setEscapement(escape); setFontFace(facename); setHeight(height); setItalic(italic != 0); setOrientation(orientation); setOutputPrecision(outprec); setPitchAndFamily(pitch); setQuality(quality); setStrikeout(strikeout != 0); setUnderline(underline != 0); setWeight(weight); setWidth(width); } private int formFlags(final boolean f1, final boolean f2) { int retval = 0; if (f1) { retval += 0x0100; } if (f2) { retval += 1; } return (retval); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_FONT_INDIRECT; } public void setFontFace(final String facename) { this.facename = facename; } public String getFontFace() { return facename; } public void setPitchAndFamily(final int pitchAndFamily) { this.pitchAndFamily = pitchAndFamily; } public int getPitchAndFamily() { return pitchAndFamily; } public void setQuality(final int quality) { this.quality = quality; } public int getQuality() { return quality; } public void setClipPrecision(final int clipprecision) { this.clipprecision = clipprecision; } public int getClipPrecision() { return clipprecision; } public void setOutputPrecision(final int outprecision) { this.outprecision = outprecision; } public int getOutputPrecision() { return outprecision; } public void setCharset(final int charset) { this.charset = charset; } public int getCharset() { return charset; } public void setHeight(final int height) { this.height = height; scaleYChanged(); } public int getHeight() { return height; } public int getScaledHeight() { return scaled_height; } public void setWidth(final int width) { this.width = width; scaleXChanged(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_height = getScaledY(height); } public int getWidth() { return width; } public int getScaledWidth() { return scaled_width; } // in 1/10 degrees public void setEscapement(final int escapement) { this.escapement = escapement; } public int getEscapement() { return escapement; } // in 1/10 degrees public void setOrientation(final int orientation) { this.orientation = orientation; } public int getOrientation() { return orientation; } // 200 = narrow // 400 = normal // 700 = bold public void setWeight(final int weight) { this.weight = weight; } public int getWeight() { return weight; } public void setItalic(final boolean italic) { this.italic = italic; } public boolean isItalic() { return this.italic; } public void setUnderline(final boolean ul) { this.underline = ul; } public boolean isUnderline() { return this.underline; } public void setStrikeout(final boolean so) { this.strikeout = so; } public boolean isStrikeout() { return this.strikeout; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_FONT] face="); b.append(getFontFace()); b.append(" height="); b.append(getHeight()); b.append(" width="); b.append(getWidth()); b.append(" weight="); b.append(getWeight()); b.append(" italic="); b.append(isItalic()); b.append(" Strikeout="); b.append(isStrikeout()); b.append(" Underline="); b.append(isUnderline()); b.append(" outprecision="); b.append(getOutputPrecision()); b.append(" escapement="); b.append(getEscapement()); return b.toString(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextJustification.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextJustificati0000644000175000017500000001042511365605266032436 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The SetTextJustification function specifies the amount of space the system should add * to the break characters in a string of text. The space is added when an application * calls the TextOut or ExtTextOut functions. */ public class MfCmdSetTextJustification extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_SPACELENGTH = 0; private static final int POS_BREAKCOUNT = 1; private int extraSpaceLength; private int breakCount; public MfCmdSetTextJustification() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setTextJustification(extraSpaceLength, breakCount); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetTextJustification(); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_TEXT_JUSTIFICATION] breakCount="); b.append(getBreakCount()); b.append(" extraSpaceLength="); b.append(getExtraSpaceLength()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int spaceLength = record.getParam(POS_SPACELENGTH); final int breakCount = record.getParam(POS_BREAKCOUNT); setExtraSpaceLength(spaceLength); setBreakCount(breakCount); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_BREAKCOUNT, getBreakCount()); record.setParam(POS_SPACELENGTH, getExtraSpaceLength()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_TEXT_JUSTIFICATION; } public int getBreakCount() { return breakCount; } public void setBreakCount(final int count) { this.breakCount = count; } public int getExtraSpaceLength() { return extraSpaceLength; } public void setExtraSpaceLength(final int count) { this.extraSpaceLength = count; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmd.java0000644000175000017500000001441111365605266027635 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * This is the base class for all WMF-Records. A WMF record specifies a single command for * drawing a element of the image. */ public abstract class MfCmd { /** * The X-Scale for the command. */ private float scaleX; /** * The Y-Scale for the command. */ private float scaleY; /** * The default constructor, adjusts the scale to 1. */ protected MfCmd() { scaleX = 1; scaleY = 1; } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. * @throws RecordCreationException if an error occured while generating the record. */ public abstract MfRecord getRecord() throws RecordCreationException; /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public abstract void setRecord(MfRecord record); /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public abstract int getFunction(); /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public abstract MfCmd getInstance(); /** * Replays the command on the given WmfFile. * * @param metafile the meta file. */ public abstract void replay(WmfFile metafile); /** * Set the scale for the command. * * @param scaleX the horizontal scale * @param scaleY the vertical scale */ public void setScale(final float scaleX, final float scaleY) { final float oldScaleX = this.scaleX; final float oldScaleY = this.scaleY; this.scaleX = scaleX; this.scaleY = scaleY; if (oldScaleX != scaleX) { scaleXChanged(); } if (oldScaleY != scaleY) { scaleYChanged(); } } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected abstract void scaleXChanged(); /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected abstract void scaleYChanged(); /** * Scales the given rectangle. * * @param r the source rectangle. * @return a new rectangle containing the scaled values. */ protected Rectangle scaleRect(final Rectangle r) { final Rectangle retval = new Rectangle(); retval.x = getScaledX(r.x); retval.y = getScaledY(r.y); retval.width = getScaledWidth(r.width); retval.height = getScaledHeight(r.height); return retval; } /** * Scales the given horizontal length and makes sure that the lenght is at least 1. * * @param length the value that should be scaled. * @return the scaled value. */ protected int getScaledWidth(int length) { if (length == 0) { return 1; } length = (int) (length * scaleX + 0.5f); return (length == 0) ? 1 : length; } /** * Scales the given vertical length and makes sure that the lenght is at least 1. * * @param length the value that should be scaled. * @return the scaled value. */ protected int getScaledHeight(int length) { if (length == 0) { return 1; } length = (int) (length * scaleY + 0.5f); return (length == 0) ? 1 : length; } /** * Applies the new x-scaling to all values in the array n and places the values in the * array dest. Additionally dest is also returned as return value. * * @param n the unscaled source values * @param dest the array to store the scaled values * @return dest. */ protected int[] applyScaleX(final int[] n, int[] dest) { if (dest == null) { dest = new int[n.length]; } else if (dest.length < n.length) { dest = new int[n.length]; } for (int i = 0; i < n.length; i++) { dest[i] = (int) (n[i] * scaleX + 0.5f); } return dest; } /** * Applies the new y-scaling to all values in the array n and places the values in the * array dest. Additionally dest is also returned as return value. * * @param n the unscaled source values * @param dest the array to store the scaled values * @return dest. */ protected int[] applyScaleY(final int[] n, int[] dest) { if (dest == null) { dest = new int[n.length]; } else if (dest.length < n.length) { dest = new int[n.length]; } for (int i = 0; i < n.length; i++) { dest[i] = (int) (n[i] * scaleY + 0.5f); } return dest; } /** * Return integer scaled to output units. * * @param y the unscaled y * @return the scaled y value */ public int getScaledY(final int y) { return (int) (y * scaleY + 0.5f); } /** * Return integer scaled to output units. * * @param x the unscaled x * @return the scaled x value */ public int getScaledX(final int x) { return (int) (x * scaleX + 0.5f); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetPaletteEntries.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetPaletteEntries.0000644000175000017500000001225711365605266032326 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * As with every palette-function: I'm not sure if this is correctly implemented. *

* The SetPaletteEntries function sets RGB (red, green, blue) color values and flags in a * range of entries in a logical palette. */ public final class MfCmdSetPaletteEntries extends MfCmd { private static final int BASE_RECORD_SIZE = 3; private static final int POS_H_PALETTE = 0; private static final int POS_CSTART = 1; private static final int POS_CENTRIES = 2; private int hPalette; private Color[] colors; private int startPos; private static final Color[] COLOR = new Color[0]; public MfCmdSetPaletteEntries() { colors = COLOR; } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // not yet } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetPaletteEntries(); } public Color[] getEntries() { return (Color[]) colors.clone(); } public void setEntries(final Color[] colors) { this.colors = (Color[]) colors.clone(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int hPalette = record.getParam(POS_H_PALETTE); final int cStart = record.getParam(POS_CSTART); final int cEntries = record.getParam(POS_CENTRIES); final Color[] colors = new Color[cEntries]; for (int i = 0; i < cEntries; i++) { final int colorRef = record.getLongParam(2 * i + BASE_RECORD_SIZE); final GDIColor color = new GDIColor(colorRef); colors[i] = color; } setStartPos(cStart); setEntries(colors); setHPalette(hPalette); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final Color[] cEntries = getEntries(); if (cEntries == null) { throw new NullPointerException("No CEntries set"); } final MfRecord record = new MfRecord(2 * cEntries.length + BASE_RECORD_SIZE); record.setParam(POS_H_PALETTE, getHPalette()); record.setParam(POS_CSTART, getStartPos()); record.setParam(POS_CENTRIES, cEntries.length); for (int i = 0; i < cEntries.length; i++) { record.setLongParam(2 * i + BASE_RECORD_SIZE, GDIColor.translateColor(cEntries[i])); } return record; } public int getStartPos() { return startPos; } public void setStartPos(final int startPos) { this.startPos = startPos; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_PALETTE_ENTRIES; } public int getHPalette() { return hPalette; } public void setHPalette(final int hPalette) { this.hPalette = hPalette; } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[SET_PALETTE_ENTRIES] entriesCount="); if (getEntries() == null) { b.append(0); } else { b.append(getEntries().length); } b.append(" hpalette="); b.append(hPalette); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextColor.java0000644000175000017500000000730311365605266032157 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The SetTextColor function sets the text color for the specified device context to the * specified color. */ public class MfCmdSetTextColor extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_COLOR = 0; private Color color; public MfCmdSetTextColor() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setTextColor(color); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetTextColor(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int colref = record.getLongParam(POS_COLOR); setColor(new GDIColor(colref)); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_TEXT_COLOR; } public Color getColor() { return color; } public void setColor(final Color color) { this.color = color; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_TEXT_COLOR] textColor="); b.append(getColor()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdEllipse.java0000644000175000017500000001234211365605266031154 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.Ellipse2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Ellipse function draws an ellipse. The center of the ellipse is the center of the * specified bounding rectangle. The ellipse is outlined by using the current pen and is * filled by using the current brush. */ public class MfCmdEllipse extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_TOP = 2; private static final int POS_LEFT = 3; private static final int POS_RIGHT = 1; private static final int POS_BOTTOM = 0; private int x; private int y; private int width; private int height; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; public MfCmdEllipse() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getScaledBounds(); final Ellipse2D ellipse = new Ellipse2D.Double(); ellipse.setFrame(rec.x, rec.y, rec.width, rec.height); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(ellipse); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(ellipse); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdEllipse(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int bottom = record.getParam(POS_BOTTOM); final int right = record.getParam(POS_RIGHT); final int top = record.getParam(POS_TOP); final int left = record.getParam(POS_LEFT); setBounds(left, top, right - left, bottom - top); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Rectangle rc = getBounds(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_BOTTOM, (int) (rc.getY() + rc.getHeight())); record.setParam(POS_RIGHT, (int) (rc.getX() + rc.getWidth())); record.setParam(POS_TOP, (int) (rc.getY())); record.setParam(POS_LEFT, (int) (rc.getX())); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[ELLIPSE] bounds="); b.append(getBounds()); return b.toString(); } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.ELLIPSE; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreateRegion.java0000644000175000017500000001217311365605266032130 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Currently i have no clue, how this is implemented. *

* From The WINE-Sources: *

*

 * 	The layout of the record looks something like this:
 * 

* rdParm meaning * 0 Always 0? * 1 Always 6? * 2 Looks like a handle? - not constant * 3 0 or 1 ?? * 4 Total number of bytes * 5 No. of separate bands = n [see below] * 6 Largest number of x co-ords in a band * 7-10 Bounding box x1 y1 x2 y2 * 11-... n bands *

* Regions are divided into bands that are uniform in the * y-direction. Each band consists of pairs of on/off x-coords and is * written as * m y0 y1 x1 x2 x3 ... xm m * into successive rdParm[]s. *

* This is probably just a dump of the internal RGNOBJ? *

*

*

 * static BOOL MF_Play_MetaCreateRegion( METARECORD *mr, HRGN hrgn )
 * {
 * WORD band, pair;
 * WORD *start, *end;
 * INT16 y0, y1;
 * HRGN hrgn2 = CreateRectRgn( 0, 0, 0, 0 );
 * 

* for(band = 0, start = &(mr->rdParm[11]); * band < mr->rdParm[5]; * band++, start = end + 1) * { * if(*start / 2 != (*start + 1) / 2) * { * WARN("Delimiter not even.\n"); * DeleteObject( hrgn2 ); * return FALSE; * } *

* end = start + *start + 3; * if(end > (WORD *)mr + mr->rdSize) * { * WARN("End points outside record.\n"); * DeleteObject( hrgn2 ); * return FALSE; * } *

* if(*start != *end) * { * WARN("Mismatched delimiters.\n"); * DeleteObject( hrgn2 ); * return FALSE; * } *

* y0 = *(INT16 *)(start + 1); * y1 = *(INT16 *)(start + 2); * for(pair = 0; pair < *start / 2; pair++) * { * SetRectRgn( hrgn2, *(INT16 *)(start + 3 + 2*pair), y0, * (INT16 *)(start + 4 + 2*pair), y1 ); * CombineRgn(hrgn, hrgn, hrgn2, RGN_OR); * } * } * DeleteObject( hrgn2 ); * return TRUE; * } *

*

*/ public class MfCmdCreateRegion extends MfCmd { private int regionX; private int regionY; private int regionWidth; private int regionHeight; private Rectangle[] rects; public MfCmdCreateRegion() { } public void setRecord(final MfRecord record) { // System.out.println("Create Region is not implemented."); } /** * Writer function */ public MfRecord getRecord() { final MfRecord record = new MfRecord(0); record.setParam(0, 0); record.setParam(1, 6); record.setParam(2, 0x1234); record.setParam(3, 0); record.setParam(4, 0); // Length record.setParam(5, 0); // Bands record.setParam(6, 0); // Max-Bands record.setParam(7, regionX); record.setParam(8, regionY); record.setParam(9, regionX + regionWidth); record.setParam(10, regionY + regionHeight); // some more data ... a array of rectangles (16bit x 4) // which makes up the defined region // the rectangles are sorted and seem to be packed in some way // todo: Not complete .. return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_REGION] "); b.append(" no internals known (see WINE for details)"); return b.toString(); } public int getFunction() { return MfType.CREATE_REGION; } public void replay(final WmfFile file) { } public MfCmd getInstance() { return new MfCmdCreateRegion(); } protected void scaleXChanged() { } protected void scaleYChanged() { } public int getRegionX() { return regionX; } public void setRegionX(final int regionX) { this.regionX = regionX; } public int getRegionY() { return regionY; } public void setRegionY(final int regionY) { this.regionY = regionY; } public int getRegionWidth() { return regionWidth; } public void setRegionWidth(final int regionWidth) { this.regionWidth = regionWidth; } public int getRegionHeight() { return regionHeight; } public void setRegionHeight(final int regionHeight) { this.regionHeight = regionHeight; } public Rectangle[] getRects() { return rects; } public void setRects(final Rectangle[] rects) { this.rects = rects; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPatBlt.java0000644000175000017500000001344311365605266030750 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.ROPConstants; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdPatBlt extends MfCmd { private static final int RECORD_SIZE = 6; private static final int POS_ROP = 0; private static final int POS_HEIGHT = 2; private static final int POS_WIDTH = 3; private static final int POS_Y = 4; private static final int POS_X = 5; private int rop; private int height; private int width; private int x; private int y; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; public MfCmdPatBlt() { } public void replay(final WmfFile file) { switch (rop) { case ROPConstants.PATCOPY: { final MfDcState state = file.getCurrentState(); state.preparePaint(); final Graphics2D g2 = (Graphics2D) file.getGraphics2D().create(); g2.setPaintMode(); g2.fill(getScaledBounds()); state.postPaint(); break; } case ROPConstants.PATINVERT: { final MfDcState state = file.getCurrentState(); state.preparePaint(); final Graphics2D g2 = (Graphics2D) file.getGraphics2D().create(); g2.setXORMode(g2.getColor()); g2.fill(getScaledBounds()); state.postPaint(); break; } case ROPConstants.DSTINVERT: { final Graphics2D g2 = (Graphics2D) file.getGraphics2D().create(); g2.setXORMode(Color.white); g2.fill(getScaledBounds()); break; } case ROPConstants.BLACKNESS: { // todo implement me when Palettes are implemented break; } case ROPConstants.WHITENESS: { // todo implement me when Palettes are implemented break; } } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPatBlt(); } public int getROP() { return rop; } public void setROP(final int rop) { this.rop = rop; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int rop = record.getLongParam(POS_ROP); final int height = record.getParam(POS_HEIGHT); final int width = record.getParam(POS_WIDTH); final int top = record.getParam(POS_X); final int left = record.getParam(POS_Y); setBounds(left, top, width, height); setROP(rop); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_ROP, getROP()); final Rectangle bounds = getBounds(); record.setParam(POS_HEIGHT, bounds.height); record.setParam(POS_WIDTH, bounds.width); record.setParam(POS_Y, bounds.y); record.setParam(POS_X, bounds.x); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[PAT_BLT] rop="); b.append(getROP()); b.append(" bounds="); b.append(getBounds()); return b.toString(); } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.PAT_BLT; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetBkMode.java0000644000175000017500000000666311365605266031405 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdSetBkMode extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_BKMODE = 0; private int bkmode; public MfCmdSetBkMode() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setBkMode(bkmode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetBkMode(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_BKMODE); setBkMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_BKMODE, getBkMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_BK_MODE; } public int getBkMode() { return bkmode; } public void setBkMode(final int id) { this.bkmode = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_BK_MODE] bkmode="); b.append(getBkMode()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdRectangle.java0000644000175000017500000001200611365605266031460 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Rectangle function draws a rectangle. The rectangle is outlined by using the * current pen and filled by using the current brush. */ public class MfCmdRectangle extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_TOP = 2; private static final int POS_LEFT = 3; private static final int POS_RIGHT = 1; private static final int POS_BOTTOM = 0; private int x; private int y; private int width; private int height; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; public MfCmdRectangle() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getScaledBounds(); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(rec); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(rec); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdRectangle(); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[RECTANGLE] bounds="); b.append(getBounds()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int bottom = record.getParam(POS_BOTTOM); final int right = record.getParam(POS_RIGHT); final int top = record.getParam(POS_TOP); final int left = record.getParam(POS_LEFT); setBounds(left, top, right - left, bottom - top); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Rectangle rc = getBounds(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_BOTTOM, (int) (rc.getY() + rc.getHeight())); record.setParam(POS_RIGHT, (int) (rc.getX() + rc.getWidth())); record.setParam(POS_TOP, (int) (rc.getY())); record.setParam(POS_LEFT, (int) (rc.getX())); return record; } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.RECTANGLE; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetMapperFlags.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetMapperFlags.jav0000644000175000017500000000737711365605266032307 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * This records is ignored, as it is used to map fonts into the given aspect ratio. This * affects only BitMap-fonts, as TrueTypeFonts are always able to scale to any aspect * ratio. *

* In java all fonts are considered true-type. */ public class MfCmdSetMapperFlags extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_MAPFLAGS = 0; private int mapperflags; public MfCmdSetMapperFlags() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setMapperFlag(mapperflags); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetMapperFlags(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getLongParam(POS_MAPFLAGS); setMapperFlags(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_MAPFLAGS, getMapperFlags()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_MAPPER_FLAGS; } public int getMapperFlags() { return mapperflags; } public void setMapperFlags(final int id) { this.mapperflags = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[MAPPERFLAGS] mapperflags="); b.append(getMapperFlags()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSelectClipRegion.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSelectClipRegion.j0000644000175000017500000000755511365605266032274 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.WmfObject; public class MfCmdSelectClipRegion extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_OBJECT_ID = 0; private int objectId; public MfCmdSelectClipRegion() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final WmfObject object = file.getObject(objectId); if (object == null) { throw new IllegalStateException("No Such Object defined: " + objectId); } switch (object.getType()) { case WmfObject.OBJ_REGION: file.getCurrentState().setLogRegion((MfLogRegion) object); break; default: throw new IllegalStateException("Object is no region"); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSelectClipRegion(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_OBJECT_ID); setObjectId(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_OBJECT_ID, getObjectId()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SELECT_CLIP_REGION; } public int getObjectId() { return objectId; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SELECT_CLIPREGION] object="); b.append(getObjectId()); return b.toString(); } public void setObjectId(final int id) { this.objectId = id; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreatePen.java0000644000175000017500000001142111365605266031422 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfLogPen; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The CreatePenIndirect function creates a logical cosmetic pen that has the style, * width, and color specified in a structure. *

*

 * typedef struct tagLOGPEN {
 * UINT     lopnStyle;
 * POINT    lopnWidth;
 * COLORREF lopnColor;
 * } LOGPEN, *PLOGPEN;
 * 
*/ public class MfCmdCreatePen extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_STYLE = 0; private static final int POS_WIDTH = 1; private static final int POS_COLOR = 2; private int style; private Color color; private int width; private int scaled_width; public MfCmdCreatePen() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogPen lpen = new MfLogPen(); lpen.setStyle(getStyle()); lpen.setColor(getColor()); lpen.setWidth(getScaledWidth()); file.getCurrentState().setLogPen(lpen); file.storeObject(lpen); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreatePen(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_PEN_INDIRECT; } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_STYLE, getStyle()); record.setParam(POS_WIDTH, getWidth()); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); return record; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int style = record.getParam(POS_STYLE); final int width = record.getParam(POS_WIDTH); final int color = record.getLongParam(POS_COLOR); setStyle(style); setWidth(width); setColor(new GDIColor(color)); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_PEN] style="); b.append(getStyle()); b.append(" width="); b.append(getWidth()); b.append(" color="); b.append(getColor()); return b.toString(); } public int getStyle() { return style; } public void setStyle(final int style) { this.style = style; } public int getScaledWidth() { return scaled_width; } public int getWidth() { return width; } public void setWidth(final int width) { this.width = width; scaleXChanged(); } public Color getColor() { return color; } public void setColor(final Color c) { this.color = c; } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_width = getScaledX(width); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdMoveTo.java0000644000175000017500000001007011365605266030764 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The cursor is set to the destination point. */ public class MfCmdMoveTo extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_X = 1; private static final int POS_Y = 0; private int destX; private int destY; private int scaled_destX; private int scaled_destY; public MfCmdMoveTo() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Point p = getScaledDestination(); state.setCurPos(p.x, p.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdMoveTo(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.MOVE_TO; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[MOVE_TO] destination="); b.append(getDestination()); return b.toString(); } public void setDestination(final int x, final int y) { destX = x; destY = y; scaleXChanged(); scaleYChanged(); } public void setDestination(final Point p) { setDestination(p.x, p.y); } public Point getDestination() { return new Point(destX, destY); } public Point getScaledDestination() { return new Point(scaled_destX, scaled_destY); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setDestination(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Point dest = getDestination(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_Y, dest.y); record.setParam(POS_X, dest.x); return record; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_destX = getScaledX(destX); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_destY = getScaledY(destY); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/CommandFactory.java0000644000175000017500000001235311365605266031560 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.util.HashMap; /** * Manages the available WmfCommands and allows a generic command instantiation. */ public class CommandFactory { private static CommandFactory commandFactory; public static synchronized CommandFactory getInstance() { if (commandFactory == null) { commandFactory = new CommandFactory(); } return commandFactory; } public CommandFactory() { } /** * A global collection of all known record types. */ private HashMap recordTypes; /** * Registers all known command types to the standard factory. */ public void registerAllKnownTypes() { if (recordTypes != null) { return; } recordTypes = new HashMap(); registerCommand(new MfCmdAnimatePalette()); registerCommand(new MfCmdArc()); registerCommand(new MfCmdDibBitBlt()); registerCommand(new MfCmdChord()); registerCommand(new MfCmdCreateBrush()); registerCommand(new MfCmdCreateDibPatternBrush()); registerCommand(new MfCmdCreateFont()); registerCommand(new MfCmdCreatePen()); registerCommand(new MfCmdCreatePalette()); registerCommand(new MfCmdCreatePatternBrush()); registerCommand(new MfCmdCreateRegion()); registerCommand(new MfCmdDeleteObject()); registerCommand(new MfCmdEllipse()); registerCommand(new MfCmdEscape()); registerCommand(new MfCmdExcludeClipRect()); registerCommand(new MfCmdExtFloodFill()); registerCommand(new MfCmdExtTextOut()); registerCommand(new MfCmdFillRegion()); registerCommand(new MfCmdFrameRegion()); registerCommand(new MfCmdFloodFill()); registerCommand(new MfCmdInvertRegion()); registerCommand(new MfCmdIntersectClipRect()); registerCommand(new MfCmdLineTo()); registerCommand(new MfCmdMoveTo()); registerCommand(new MfCmdOffsetClipRgn()); registerCommand(new MfCmdOffsetViewportOrg()); registerCommand(new MfCmdOffsetWindowOrg()); registerCommand(new MfCmdBitBlt()); registerCommand(new MfCmdStretchBlt()); registerCommand(new MfCmdPatBlt()); registerCommand(new MfCmdPaintRgn()); registerCommand(new MfCmdPie()); registerCommand(new MfCmdPolyPolygon()); registerCommand(new MfCmdPolygon()); registerCommand(new MfCmdPolyline()); registerCommand(new MfCmdRealisePalette()); registerCommand(new MfCmdRectangle()); registerCommand(new MfCmdRestoreDc()); registerCommand(new MfCmdResizePalette()); registerCommand(new MfCmdRoundRect()); registerCommand(new MfCmdSaveDc()); registerCommand(new MfCmdScaleWindowExt()); registerCommand(new MfCmdScaleViewportExt()); registerCommand(new MfCmdSelectClipRegion()); registerCommand(new MfCmdSelectObject()); registerCommand(new MfCmdSelectPalette()); registerCommand(new MfCmdSetBkMode()); registerCommand(new MfCmdSetBkColor()); registerCommand(new MfCmdSetDibitsToDevice()); registerCommand(new MfCmdSetMapperFlags()); registerCommand(new MfCmdSetMapMode()); registerCommand(new MfCmdSetPaletteEntries()); registerCommand(new MfCmdSetPolyFillMode()); registerCommand(new MfCmdSetPixel()); registerCommand(new MfCmdSetRop2()); registerCommand(new MfCmdSetStretchBltMode()); registerCommand(new MfCmdSetTextCharExtra()); registerCommand(new MfCmdSetTextAlign()); registerCommand(new MfCmdSetTextColor()); registerCommand(new MfCmdSetTextJustification()); registerCommand(new MfCmdSetViewPortExt()); registerCommand(new MfCmdSetViewPortOrg()); registerCommand(new MfCmdSetWindowExt()); registerCommand(new MfCmdSetWindowOrg()); registerCommand(new MfCmdDibStretchBlt()); registerCommand(new MfCmdStretchDibits()); registerCommand(new MfCmdTextOut()); } private void registerCommand(final MfCmd command) { if (recordTypes.get(new Integer(command.getFunction())) != null) { throw new IllegalArgumentException("Already registered"); } recordTypes.put(new Integer(command.getFunction()), command); } public MfCmd getCommand(final int function) { if (recordTypes == null) { registerAllKnownTypes(); } final MfCmd cmd = (MfCmd) recordTypes.get(new Integer(function)); if (cmd == null) { final MfCmdUnknownCommand ucmd = new MfCmdUnknownCommand(); ucmd.setFunction(function); return ucmd; } return cmd.getInstance(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreatePatternBrush.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreatePatternBrush0000644000175000017500000001152011365605266032401 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.image.BufferedImage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.bitmap.DIBReader; /** * The CreatePatternBrush function creates a logical brush with the specified bitmap * pattern. The bitmap can be a DIB section bitmap, which is created by the * CreateDIBSection function, or it can be a device-dependent bitmap. *

* No DIB related function is yet fully implemented... *

* todo */ public class MfCmdCreatePatternBrush extends MfCmd { private static final Log logger = LogFactory.getLog(MfCmdCreatePatternBrush.class); // private static final int POS_BITMAP_WIDTH = 0; // private static final int POS_BITMAP_HEIGHT = 1; // private static final int POS_BYTES_PER_LINE = 2; // // ColorPlanes on byte pos 6 and bits per pixel on pos 7 // private static final int POS_COLOR_PLANES = 3; // private static final int POS_BITS_PER_PIXEL = 3; // // ?? 32 bit value ... // private static final int POS_POINTER_BITVALUES = 4; // private static final int POS_BITPATTERN = 6; private BufferedImage image; public MfCmdCreatePatternBrush() { } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { try { final DIBReader reader = new DIBReader(); setImage(reader.setRecord(record)); } catch (Exception e) { logger.warn("Failed to update CreatePatternBrush-Record", e); } } public BufferedImage getImage() { return image; } public void setImage(final BufferedImage image) { if (image == null) { throw new NullPointerException(); } this.image = image; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_PATTERN_BRUSH; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_PATTERN_BRUSH] "); b.append(" no internals known (not seen in the wild)"); return b.toString(); } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogBrush lbrush = new MfLogBrush(); lbrush.setStyle(MfLogBrush.BS_DIBPATTERN); lbrush.setBitmap(image); file.getCurrentState().setLogBrush(lbrush); file.storeObject(lbrush); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreatePatternBrush(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. * @throws RecordCreationException always, as this method is not implemented. */ public MfRecord getRecord() throws RecordCreationException { throw new RecordCreationException("This method is not implemented"); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdOffsetClipRgn.java0000644000175000017500000001053411365605266032265 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Moves the current Clipping Region (@see CreateRegion) to the specified position, * starting with the current region. This will result in a relative move operation. The * specified values are no absolute values. */ public class MfCmdOffsetClipRgn extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_X = 1; private static final int POS_Y = 0; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdOffsetClipRgn() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Rectangle clipRect = state.getClipRegion(); final Point p = getScaledDestination(); clipRect.x += p.x; clipRect.y += p.y; state.setClipRegion(clipRect); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdOffsetClipRgn(); } public Point getDestination() { return new Point(x, y); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[OFFSET_CLIP_RECT] destination="); b.append(getDestination()); return b.toString(); } public void setDestination(final Point p) { setDestination(p.x, p.y); } public void setDestination(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.OFFSET_CLIP_RGN; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setDestination(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Point dest = getDestination(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_Y, dest.y); record.setParam(POS_X, dest.x); return record; } public Point getScaledDestination() { return new Point(scaled_x, scaled_y); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextAlign.java0000644000175000017500000000773011365605266032137 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The SetTextAlign function sets the text-alignment flags for the specified device * context. *

* Specifies the text alignment by using a mask of the values in the following list. Only * one flag can be chosen from those that affect horizontal and vertical alignment. In * addition, only one of the two flags that alter the current position can be chosen. *

* The default values are TA_LEFT, TA_TOP, and TA_NOUPDATECP */ public class MfCmdSetTextAlign extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_TEXT_ALIGNMENT = 0; private int textAlignMode; public MfCmdSetTextAlign() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setTextAlign(textAlignMode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetTextAlign(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_TEXT_ALIGNMENT); setTextAlignMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_TEXT_ALIGNMENT, getTextAlignMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_TEXT_ALIGN; } public int getTextAlignMode() { return textAlignMode; } public void setTextAlignMode(final int id) { this.textAlignMode = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_TEXT_ALIGN] textAlign="); b.append(getTextAlignMode()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetMapMode.java0000644000175000017500000000740111365605266031555 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The SetMapMode function sets the mapping mode of the specified device context. The * mapping mode defines the unit of measure used to transform page-space units into * device-space units, and also defines the orientation of the device's x and y axes. * * @see org.pentaho.reporting.libraries.pixie.wmf.MappingConstants */ public class MfCmdSetMapMode extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_MAPMODE = 0; private int mapmode; public MfCmdSetMapMode() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setMapMode(mapmode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetMapMode(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(0); setMapMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_MAPMODE, getMapMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_MAP_MODE; } public int getMapMode() { return mapmode; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[MAPMODE] mapmode="); b.append(getMapMode()); return b.toString(); } public void setMapMode(final int id) { this.mapmode = id; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdBitBlt.java0000644000175000017500000001534011365605266030740 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * This function is not in the validity list of Microsofts WindowsMetafile Records. *

*/ public class MfCmdBitBlt extends MfCmd { private static final int POS_ROP = 0; private static final int POS_Y_SOURCE_ORIGIN = 1; private static final int POS_X_SOURCE_ORIGIN = 2; private static final int POS_DESTINATION_Y_EXT = 3; private static final int POS_DESTINATION_X_EXT = 4; private static final int POS_Y_DESTINATION_ORIGIN = 5; private static final int POS_X_DESTINATION_ORIGIN = 6; private static final int POS_BITMAP_WIDTH = 7; private static final int POS_BITMAP_HEIGHT = 8; private static final int POS_BYTES_PER_RASTER_LINE = 9; private static final int POS_COLOR_PLANES_BITMAP = 10; private static final int POS_ADJACENT_COLOR_BITS = 11; private static final int POS_DEVICE_DEPENDENT_BITMAP_BITS = 12; private int rop; private int sourceY; private int sourceX; private int destXExt; private int destYExt; private int destXOrigin; private int destYOrigin; private int bitmapWidth; private int bitmapHeight; private int bytesPerRasterLine; private int colorPlanesBitmap; private int adjacentColorBits; private byte[] deviceDependentBitmap; public MfCmdBitBlt() { } public void replay(final WmfFile file) { // this command is not implemented ... } public MfCmd getInstance() { return new MfCmdBitBlt(); } public void setRecord(final MfRecord record) { setRop(record.getParam(POS_ROP)); setSourceX(record.getParam(POS_Y_SOURCE_ORIGIN)); setSourceY(record.getParam(POS_X_SOURCE_ORIGIN)); setDestXExt(record.getParam(POS_DESTINATION_X_EXT)); setDestYExt(record.getParam(POS_DESTINATION_Y_EXT)); setDestXOrigin(record.getParam(POS_X_DESTINATION_ORIGIN)); setDestYOrigin(record.getParam(POS_Y_DESTINATION_ORIGIN)); setBitmapWidth(record.getParam(POS_BITMAP_WIDTH)); setBitmapHeight(record.getParam(POS_BITMAP_HEIGHT)); setBytesPerRasterLine(record.getParam(POS_BYTES_PER_RASTER_LINE)); setColorPlanesBitmap(record.getParam(POS_COLOR_PLANES_BITMAP)); setAdjacentColorBits(record.getParam(POS_ADJACENT_COLOR_BITS)); // todo read the bitmap data from the record ... } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[OLD_BIT_BLT]"); return b.toString(); } public int getFunction() { return MfType.OLD_BIT_BLT; } protected void scaleXChanged() { } protected void scaleYChanged() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { // todo this is not yet correctly implemented ... final MfRecord record = new MfRecord(12 + (deviceDependentBitmap.length / 4)); record.setParam(POS_ROP, getRop()); record.setParam(POS_Y_SOURCE_ORIGIN, getSourceX()); record.setParam(POS_X_SOURCE_ORIGIN, getSourceY()); record.setParam(POS_DESTINATION_X_EXT, getDestXExt()); record.setParam(POS_DESTINATION_Y_EXT, getDestYExt()); record.setParam(POS_X_DESTINATION_ORIGIN, getDestXOrigin()); record.setParam(POS_Y_DESTINATION_ORIGIN, getDestYOrigin()); record.setParam(POS_BITMAP_WIDTH, getBitmapWidth()); record.setParam(POS_BITMAP_HEIGHT, getBitmapHeight()); record.setParam(POS_BYTES_PER_RASTER_LINE, getBytesPerRasterLine()); record.setParam(POS_COLOR_PLANES_BITMAP, getColorPlanesBitmap()); record.setParam(POS_ADJACENT_COLOR_BITS, getAdjacentColorBits()); // todo: Write the bitmap data ... return record; } public int getAdjacentColorBits() { return adjacentColorBits; } public void setAdjacentColorBits(final int adjacentColorBits) { this.adjacentColorBits = adjacentColorBits; } public int getBitmapHeight() { return bitmapHeight; } public void setBitmapHeight(final int bitmapHeight) { this.bitmapHeight = bitmapHeight; } public int getBitmapWidth() { return bitmapWidth; } public void setBitmapWidth(final int bitmapWidth) { this.bitmapWidth = bitmapWidth; } public int getBytesPerRasterLine() { return bytesPerRasterLine; } public void setBytesPerRasterLine(final int bytesPerRasterLine) { this.bytesPerRasterLine = bytesPerRasterLine; } public int getColorPlanesBitmap() { return colorPlanesBitmap; } public void setColorPlanesBitmap(final int colorPlanesBitmap) { this.colorPlanesBitmap = colorPlanesBitmap; } public int getDestXExt() { return destXExt; } public void setDestXExt(final int destXExt) { this.destXExt = destXExt; } public int getDestXOrigin() { return destXOrigin; } public void setDestXOrigin(final int destXOrigin) { this.destXOrigin = destXOrigin; } public int getDestYExt() { return destYExt; } public void setDestYExt(final int destYExt) { this.destYExt = destYExt; } public int getDestYOrigin() { return destYOrigin; } public void setDestYOrigin(final int destYOrigin) { this.destYOrigin = destYOrigin; } public byte[] getDeviceDependentBitmap() { return deviceDependentBitmap; } public void setDeviceDependentBitmap(final byte[] deviceDependentBitmap) { this.deviceDependentBitmap = deviceDependentBitmap; } public int getRop() { return rop; } public void setRop(final int rop) { this.rop = rop; } public int getSourceX() { return sourceX; } public void setSourceX(final int sourceX) { this.sourceX = sourceX; } public int getSourceY() { return sourceY; } public void setSourceY(final int sourceY) { this.sourceY = sourceY; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdFillRegion.java0000644000175000017500000001112411365605266031606 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The FillRgn function fills a region by using the specified brush. */ public class MfCmdFillRegion extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_REGION = 0; private static final int POS_BRUSH = 1; private int brushObjectNr; private int regionObjectNr; public MfCmdFillRegion() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogBrush brush = file.getBrushObject(brushObjectNr); final MfLogRegion regio = file.getRegionObject(regionObjectNr); final MfDcState state = file.getCurrentState(); state.setLogRegion(regio); state.setLogBrush(brush); final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = scaleRect(regio.getBounds()); final Rectangle2D rect = new Rectangle2D.Double(); rect.setFrame(rec.x, rec.y, rec.width, rec.height); if (brush.isVisible()) { state.preparePaint(); graph.fill(rect); state.postPaint(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdFillRegion(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int regio = record.getParam(POS_REGION); final int brush = record.getParam(POS_BRUSH); setBrush(brush); setRegion(regio); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_REGION, getRegion()); record.setParam(POS_BRUSH, getBrush()); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[FILL_REGION] brush="); b.append(getBrush()); b.append(" region="); b.append(getRegion()); return b.toString(); } public int getBrush() { return brushObjectNr; } public void setBrush(final int brush) { this.brushObjectNr = brush; } public int getRegion() { return regionObjectNr; } public void setRegion(final int region) { regionObjectNr = region; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.FILL_REGION; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdInvertRegion.java0000644000175000017500000000722411365605266032175 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import java.awt.Graphics2D; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Inverts the colors in the specified region */ public class MfCmdInvertRegion extends MfCmd { private int region; public MfCmdInvertRegion() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // by filling with XOR? final Graphics2D g2 = (Graphics2D) file.getGraphics2D().create(); g2.setXORMode(Color.white); final MfLogRegion reg = file.getRegionObject(getRegion()); g2.fill(reg.getBounds()); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdInvertRegion(); } private static final int RECORD_SIZE = 1; private static final int POS_REGION = 0; /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { region = record.getParam(POS_REGION); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_REGION, getRegion()); return record; } public void setRegion(final int region) { this.region = region; } public int getRegion() { return region; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[INVERT_REGION] region="); b.append(getRegion()); return b.toString(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.INVERT_REGION; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdDeleteObject.java0000644000175000017500000000650411365605266032113 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Removes an object from the object list. An wmf-object is either a Pen, a palette, a * brush, a font or a region. */ public class MfCmdDeleteObject extends MfCmd { private int objectId; public MfCmdDeleteObject() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { file.deleteObject(objectId); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdDeleteObject(); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[DELETE_OBJECT] object="); b.append(getObjectId()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(0); setObjectId(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(1); record.setParam(0, getObjectId()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.DELETE_OBJECT; } public int getObjectId() { return objectId; } public void setObjectId(final int id) { this.objectId = id; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdDibBitBlt.java0000644000175000017500000002072011365605266031355 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.io.IOException; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.ROPConstants; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.bitmap.DIBReader; /** * BitBlockTransfer - Copies PixelData of a rectangle to another position *

*

 * BOOL BitBlt(
 * HDC hdcDest, // handle to destination DC
 * int nXDest,  // x-coord of destination upper-left corner
 * int nYDest,  // y-coord of destination upper-left corner
 * int nWidth,  // width of destination rectangle
 * int nHeight, // height of destination rectangle
 * HDC hdcSrc,  // handle to source DC
 * int nXSrc,   // x-coordinate of source upper-left corner
 * int nYSrc,   // y-coordinate of source upper-left corner
 * DWORD dwRop  // raster operation code
 * );
 * 
*/ public class MfCmdDibBitBlt extends MfCmd { private static final int RECORD_SIZE_SIMPLE = 9; private static final int RECORD_BASE_SIZE_EXT = 8; private static final int POS_OPERATION = 0; private static final int POS_SRC_Y = 2; private static final int POS_SRC_X = 3; private static final int SIMPLE_POS_HEIGHT = 5; private static final int SIMPLE_POS_WIDTH = 6; private static final int SIMPLE_POS_DST_Y = 7; private static final int SIMPLE_POS_DST_X = 8; private static final int EXT_POS_HEIGHT = 4; private static final int EXT_POS_WIDTH = 5; private static final int EXT_POS_DST_Y = 6; private static final int EXT_POS_DST_X = 7; private BufferedImage image; private int scaled_destX; private int scaled_destY; private int scaled_destWidth; private int scaled_destHeight; private int scaled_sourceX; private int scaled_sourceY; private int destX; private int destY; private int destWidth; private int destHeight; private int sourceX; private int sourceY; private int operation; public MfCmdDibBitBlt() { } public BufferedImage getImage() { return image; } public void setImage(final BufferedImage image) { this.image = image; } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // is not implemented, as we don't have access to the raster data. } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[BIT_BLT] records="); b.append(getOperation()); b.append(" source="); b.append(getOrigin()); b.append(" destination="); b.append(getDestination()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_sourceX = getScaledX(sourceX); scaled_destX = getScaledX(destX); scaled_destWidth = getScaledX(destWidth); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_sourceY = getScaledY(sourceY); scaled_destY = getScaledY(destY); scaled_destHeight = getScaledY(destHeight); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdDibBitBlt(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.BIT_BLT; } public void setOrigin(final int x, final int y) { sourceX = x; sourceY = y; scaleXChanged(); scaleYChanged(); } public Point getOrigin() { return new Point(sourceX, sourceY); } public Rectangle getSource() { return new Rectangle(sourceX, sourceY, destWidth, destHeight); } public Point getScaledOrigin() { return new Point(scaled_sourceX, scaled_sourceY); } public Rectangle getScaledSource() { return new Rectangle(scaled_sourceX, scaled_sourceY, scaled_destWidth, scaled_destHeight); } public void setDestination(final int x, final int y, final int w, final int h) { destX = x; destY = y; destWidth = w; destHeight = h; scaleXChanged(); scaleYChanged(); } public Rectangle getDestination() { return new Rectangle(destX, destY, destWidth, destHeight); } public Rectangle getScaledDestination() { return new Rectangle(scaled_destX, scaled_destY, scaled_destWidth, scaled_destHeight); } public void setOperation(final int op) { operation = op; } public int getOperation() { return operation; } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { if (image == null) { // the simple form, the complex form would need a DIB implementation. final MfRecord record = new MfRecord(RECORD_SIZE_SIMPLE); record.setLongParam(POS_OPERATION, getOperation()); final Rectangle source = getSource(); record.setParam(POS_SRC_Y, (int) source.getY()); record.setParam(POS_SRC_X, (int) source.getX()); // Ignore the handle to the device context final Rectangle dest = getDestination(); record.setParam(4, 0); // the handle to the device context ... a stored DIB?. record.setParam(SIMPLE_POS_HEIGHT, (int) dest.getHeight()); record.setParam(SIMPLE_POS_WIDTH, (int) dest.getWidth()); record.setParam(SIMPLE_POS_DST_Y, (int) dest.getY()); record.setParam(SIMPLE_POS_DST_X, (int) dest.getX()); return record; } // todo implement the complex form throw new RecordCreationException("The extended Format of DibBitBlt is not supported"); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int rop = record.getLongParam(POS_OPERATION); final int sy = record.getParam(POS_SRC_Y); final int sx = record.getParam(POS_SRC_X); setOperation(rop); setOrigin(sx, sy); if (record.getLength() == (MfRecord.RECORD_HEADER_SIZE + 8 * 2)) { // Simple form final int dh = record.getParam(SIMPLE_POS_HEIGHT); final int dw = record.getParam(SIMPLE_POS_WIDTH); final int dy = record.getParam(SIMPLE_POS_DST_Y); final int dx = record.getParam(SIMPLE_POS_DST_X); setDestination(dx, dy, dw, dh); } else { // Complex form final int dh = record.getParam(EXT_POS_HEIGHT); final int dw = record.getParam(EXT_POS_WIDTH); final int dy = record.getParam(EXT_POS_DST_Y); final int dx = record.getParam(EXT_POS_DST_X); setDestination(dx, dy, dw, dh); try { // The sourceDib follows on Position 8 til the end if this is not the simple // form. final DIBReader reader = new DIBReader(); setImage(reader.setRecord(record, RECORD_BASE_SIZE_EXT)); } catch (IOException ioe) { // failed to load the bitmap .. } } } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetRop2.java0000644000175000017500000000665611365605266031070 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdSetRop2 extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_ROP2 = 0; private int drawmode; public MfCmdSetRop2() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setROP(drawmode); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetRop2(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_ROP2); setDrawMode(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_ROP2, getDrawMode()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_ROP2; } public int getDrawMode() { return drawmode; } public void setDrawMode(final int id) { this.drawmode = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_ROP2] drawmode="); b.append(getDrawMode()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdExtTextOut.java0000644000175000017500000002322111365605266031652 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.BasicStroke; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.BrushConstants; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfLogFont; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.TextConstants; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The ExtTextOut function draws text using the currently selected font, background color, * and text color. You can optionally provide dimensions to be used for clipping, * opaquing, or both. *

* META_EXTTEXTOUT

NEAREST API CALL

*
#include <windows.h>
 * BOOL32 ExtTextOutA
 * (
 * HDC32 hdc,
 * INT32 x,
 * INT32 y,
 * UINT32 flags,
 * const RECT32 *lprect,
 * LPCSTR str,
 * UINT32 count,
 * const INT32 *lpDx
 * );
 * 
*/ public class MfCmdExtTextOut extends MfCmd { private static final int POS_Y = 0; private static final int POS_X = 1; private static final int POS_CHAR_COUNT = 2; private static final int POS_FLAGS = 3; private static final int POS_CLIP_X = 4; private static final int POS_CLIP_Y = 5; private static final int POS_CLIP_W = 6; private static final int POS_CLIP_H = 7; private static final int RECORD_BASE_SIZE_CLIPPED = 8; private static final int RECORD_BASE_SIZE_STANDARD = 4; public static final int ETO_OPAQUE = 0x0002; public static final int ETO_CLIPPED = 0x0004; public static final int ETO_GLYPH_INDEX = 0x0010; public static final int ETO_RTLREADING = 0x0080; public static final int ETO_IGNORELANGUAGE = 0x1000; private int flags; private int x; private int y; private int cx; private int cy; private int cw; private int ch; private int scaled_x; private int scaled_y; private int scaled_cx; private int scaled_cy; private int scaled_cw; private int scaled_ch; private String text; public MfCmdExtTextOut() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graphics = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); final MfLogFont lFont = state.getLogFont(); state.prepareDrawText(); final FontMetrics metrics = graphics.getFontMetrics(); final int textWidth = metrics.stringWidth(text); final Point p = getScaledOrigin(); final int x = p.x + calcDeltaX(state.getVerticalTextAlignment(), textWidth); int y = p.y + calcDeltaY(state.getHorizontalTextAlignment(), metrics); if (isOpaque() || state.getBkMode() != BrushConstants.TRANSPARENT) { final Rectangle background = new Rectangle(x, y - metrics.getAscent(), textWidth, metrics.getHeight()); graphics.setColor(state.getBkColor()); graphics.fill(background); graphics.setColor(state.getTextColor()); } // System.out.println("X: " + x + " Y: " + p.y + " " + calcDeltaY(state.getHorizontalTextAlignment(), metrics)); final Graphics2D g2 = (Graphics2D) graphics.create(); g2.drawString(text, x, y); if (lFont.isUnderline()) { // Underline. y += metrics.getDescent() / 8 + 1; //state.prepareDraw(); g2.setStroke(new BasicStroke(metrics.getHeight() / 14)); g2.drawLine(x, y, x + textWidth, y); //state.postDraw(); } if (lFont.isStrikeOut()) { // Underline. //state.prepareDraw(); y -= metrics.getAscent() / 2.5 + 1; g2.setStroke(new BasicStroke(metrics.getHeight() / 14)); g2.drawLine(x, y, x + textWidth, y); //state.postDraw(); } state.postDrawText(); } protected int calcDeltaX(final int valign, final int textWidth) { if (valign == TextConstants.TA_LEFT) { return 0; } else if (valign == TextConstants.TA_CENTER) { return textWidth / -2; } else { return textWidth * -1; } } protected int calcDeltaY(final int halign, final FontMetrics fm) { if (halign == TextConstants.TA_TOP) { return (fm.getAscent()); } else if (halign == TextConstants.TA_BOTTOM) { return (fm.getDescent()); } else { return 0; } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdExtTextOut(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.EXT_TEXT_OUT; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); final int count = record.getParam(POS_CHAR_COUNT); final int flag = record.getParam(POS_FLAGS); final int stringOffset; int cx = 0; int cy = 0; int cw = 0; int ch = 0; if ((flag & ETO_CLIPPED) == ETO_CLIPPED) { cx = record.getParam(POS_CLIP_X); cy = record.getParam(POS_CLIP_Y); cw = record.getParam(POS_CLIP_W); ch = record.getParam(POS_CLIP_H); stringOffset = RECORD_BASE_SIZE_CLIPPED; } else { stringOffset = RECORD_BASE_SIZE_STANDARD; } final String text = record.getStringParam(stringOffset, count); setOrigin(x, y); setText(text); setClippingRect(cx, cy, cw, ch); setFlags(flag); } /** * Creates a new record based on the data stored in the MfCommand. This writer does not * write a char-spacing record. * * @return the created record. */ public MfRecord getRecord() { final String text = getText(); final int flag = getFlags(); final int parcnt; if ((flag & ETO_CLIPPED) == ETO_CLIPPED) { parcnt = RECORD_BASE_SIZE_CLIPPED; } else { parcnt = RECORD_BASE_SIZE_STANDARD; } final int recordLength = (int) (Math.ceil(text.length() / 2) * 2) + parcnt; final MfRecord record = new MfRecord(recordLength); final Point origin = getOrigin(); record.setParam(POS_Y, (int) origin.getY()); record.setParam(POS_X, (int) origin.getX()); record.setParam(POS_CHAR_COUNT, text.length()); record.setParam(POS_FLAGS, flag); if ((flag & ETO_CLIPPED) == ETO_CLIPPED) { final Rectangle rect = getClippingRect(); record.setParam(POS_CLIP_X, rect.x); record.setParam(POS_CLIP_Y, rect.y); record.setParam(POS_CLIP_W, rect.width); record.setParam(POS_CLIP_H, rect.height); } record.setStringParam(parcnt, text); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[EXT_TEXT_OUT] text="); b.append(getText()); b.append(" origin="); b.append(getOrigin()); b.append(" clippingRect="); b.append(getClippingRect()); b.append(" flags="); b.append(getFlags()); return b.toString(); } public void setOrigin(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public Point getOrigin() { return new Point(x, y); } public Point getScaledOrigin() { return new Point(scaled_x, scaled_y); } public boolean isClipped() { return (flags & ETO_CLIPPED) == ETO_CLIPPED; } public boolean isOpaque() { return (flags & ETO_OPAQUE) == ETO_OPAQUE; } public int getFlags() { return flags; } public void setFlags(final int flags) { this.flags = flags; } public void setClippingRect(final int cx, final int cy, final int cw, final int ch) { this.cx = cx; this.cy = cy; this.cw = cw; this.ch = ch; scaleXChanged(); scaleYChanged(); } public Rectangle getClippingRect() { return new Rectangle(cx, cy, cw, ch); } public Rectangle getScaledClippingRect() { return new Rectangle(scaled_cx, scaled_cy, scaled_cw, scaled_ch); } public void setText(final String text) { this.text = text; } public String getText() { return text; } protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_cx = getScaledX(cx); scaled_cw = getScaledX(cw); } protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_cy = getScaledY(cy); scaled_ch = getScaledY(ch); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPolyline.java0000644000175000017500000001354011365605266031353 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.geom.Line2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Polyline function draws a series of line segments by connecting the points in the * specified array. *

* The polyline does not use the current cursor position as starting point of the first * line. The starting point is defined by the first coordinate of the point-array. */ public class MfCmdPolyline extends MfCmd { private int[] points_x; private int[] points_y; private int[] scaled_points_x; private int[] scaled_points_y; private int count; public MfCmdPolyline() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); int cx = state.getCurPosX(); int cy = state.getCurPosY(); final int[] points_x = getScaledPointsX(); final int[] points_y = getScaledPointsY(); if (state.getLogPen().isVisible()) { state.prepareDraw(); cx = points_x[0]; cy = points_y[0]; final Line2D.Double line = new Line2D.Double(); for (int i = 1; i < count; i++) { final int destX = points_x[i]; final int destY = points_y[i]; line.setLine(cx, cy, destX, destY); graph.draw(line); cx = destX; cy = destY; } state.postDraw(); } state.setCurPos(cx, cy); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPolyline(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.POLYLINE; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[POLYLINE] count="); b.append(getPointCount()); final int l = getPointCount(); final int[] points_x = getPointsX(); final int[] points_y = getPointsY(); for (int i = 0; i < l; i++) { if (i != 0) { b.append(','); } b.append(" ("); b.append(points_x[i]); b.append(','); b.append(points_y[i]); b.append(") "); } return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int count = record.getParam(0); final int[] points_x = new int[count]; final int[] points_y = new int[count]; for (int i = 0; i < count; i++) { points_x[i] = record.getParam(1 + 2 * i); points_y[i] = record.getParam(2 + 2 * i); } setPointCount(count); setPoints(points_x, points_y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(getPointCount() * 2 + 1); final int count = getPointCount(); final int[] points_x = getPointsX(); final int[] points_y = getPointsY(); record.setParam(0, count); for (int i = 0; i < count; i++) { record.setParam(1 + 2 * i, points_x[i]); record.setParam(2 + 2 * i, points_y[i]); } return record; } public void setPointCount(final int count) { this.count = count; } public void setPoints(final int[] points_x, final int[] points_y) { this.points_x = points_x; this.points_y = points_y; scaleXChanged(); scaleYChanged(); } public int[] getPointsX() { return points_x; } public int[] getPointsY() { return points_y; } public int getPointCount() { return count; } public int[] getScaledPointsX() { return scaled_points_x; } public int[] getScaledPointsY() { return scaled_points_y; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_points_x = applyScaleX(points_x, scaled_points_x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_points_y = applyScaleY(points_y, scaled_points_y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSelectObject.java0000644000175000017500000001111411365605266032121 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfLogFont; import org.pentaho.reporting.libraries.pixie.wmf.MfLogPalette; import org.pentaho.reporting.libraries.pixie.wmf.MfLogPen; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.WmfObject; /** * Activates the specified Object. The object must be previously defined for the device * context by using the correct create*() method. */ public class MfCmdSelectObject extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_OBJECT_ID = 0; private int objectId; public MfCmdSelectObject() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final WmfObject object = file.getObject(objectId); if (object == null) { throw new NullPointerException("Object " + objectId + " is not defined"); } switch (object.getType()) { case WmfObject.OBJ_BRUSH: file.getCurrentState().setLogBrush((MfLogBrush) object); break; case WmfObject.OBJ_FONT: file.getCurrentState().setLogFont((MfLogFont) object); break; case WmfObject.OBJ_PALETTE: file.getCurrentState().setLogPalette((MfLogPalette) object); break; case WmfObject.OBJ_PEN: file.getCurrentState().setLogPen((MfLogPen) object); break; case WmfObject.OBJ_REGION: file.getCurrentState().setLogRegion((MfLogRegion) object); break; } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSelectObject(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_OBJECT_ID); setObjectId(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_OBJECT_ID, getObjectId()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SELECT_OBJECT; } public int getObjectId() { return objectId; } public void setObjectId(final int id) { this.objectId = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SELECT_OBJECT] object="); b.append(getObjectId()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSaveDc.java0000644000175000017500000000611511365605266030725 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Saves the DeviceContext. The device context contains the current viewport, clipping and * scaling as well as the current color, brush and font, etc. *

* This operation has no parameters. */ public class MfCmdSaveDc extends MfCmd { public MfCmdSaveDc() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { file.saveDCState(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSaveDc(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { return new MfRecord(0); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SAVE_DC; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SAVE_DC]"); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdRoundRect.java0000644000175000017500000001450711365605266031471 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.RoundRectangle2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The RoundRect function draws a rectangle with rounded corners. The rectangle is * outlined by using the current pen and filled by using the current brush. */ public class MfCmdRoundRect extends MfCmd { private static final int RECORD_SIZE = 6; private static final int POS_TOP = 4; private static final int POS_LEFT = 5; private static final int POS_RIGHT = 3; private static final int POS_BOTTOM = 2; private static final int POS_ROUND_WIDTH = 1; private static final int POS_ROUND_HEIGHT = 0; private int x; private int y; private int width; private int height; private int roundWidth; private int roundHeight; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; private int scaled_roundWidth; private int scaled_roundHeight; public MfCmdRoundRect() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getScaledBounds(); final Dimension dim = getScaledRoundingDim(); final RoundRectangle2D shape = new RoundRectangle2D.Double(); shape.setRoundRect(rec.x, rec.y, rec.width, rec.height, dim.width, dim.height); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(shape); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(shape); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdRoundRect(); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[ROUND_RECTANGLE] bounds="); b.append(getBounds()); b.append(" roundingDim="); b.append(getRoundingDim()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int rHeight = record.getParam(POS_ROUND_HEIGHT); final int rWidth = record.getParam(POS_ROUND_WIDTH); final int bottom = record.getParam(POS_BOTTOM); final int right = record.getParam(POS_RIGHT); final int top = record.getParam(POS_TOP); final int left = record.getParam(POS_LEFT); setBounds(left, top, right - left, bottom - top); setRoundingDim(rWidth, rHeight); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); final Dimension rDim = getRoundingDim(); record.setParam(POS_ROUND_HEIGHT, rDim.height); record.setParam(POS_ROUND_WIDTH, rDim.width); final Rectangle bounds = getBounds(); record.setParam(POS_BOTTOM, bounds.height + bounds.y); record.setParam(POS_RIGHT, bounds.width + bounds.x); record.setParam(POS_TOP, bounds.y); record.setParam(POS_LEFT, bounds.x); return record; } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } public void setRoundingDim(final int w, final int h) { this.roundWidth = w; this.roundHeight = h; scaleXChanged(); scaleYChanged(); } public Dimension getRoundingDim() { return new Dimension(roundWidth, roundHeight); } public Dimension getScaledRoundingDim() { return new Dimension(scaled_roundWidth, scaled_roundHeight); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); scaled_roundWidth = getScaledX(roundWidth); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); scaled_roundHeight = getScaledY(roundHeight); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.ROUND_RECT; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdDibStretchBlt.java0000644000175000017500000001462611365605266032263 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.io.IOException; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.bitmap.DIBReader; /** * The StretchBlt function copies a bitmap from a source rectangle into a destination * rectangle, stretching or compressing the bitmap to fit the dimensions of the * destination rectangle, if necessary. The system stretches or compresses the bitmap * according to the stretching mode currently set in the destination device context. *

* RasterOperations are ignored .. */ public class MfCmdDibStretchBlt extends MfCmd { // private static final int RECORD_BASE_SIZE = 10; private static final int POS_DIB = 10; private static final int POS_OPERATION = 0; private static final int POS_SRC_HEIGHT = 2; private static final int POS_SRC_WIDTH = 3; private static final int POS_SRC_Y = 4; private static final int POS_SRC_X = 5; private static final int POS_DST_HEIGHT = 6; private static final int POS_DST_WIDTH = 7; private static final int POS_DST_Y = 8; private static final int POS_DST_X = 9; private BufferedImage image; private int rop; private int srcX; private int srcY; private int srcW; private int srcH; private int destX; private int destY; private int destW; private int destH; private int scaled_destX; private int scaled_destY; private int scaled_destW; private int scaled_destH; public MfCmdDibStretchBlt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { file.getGraphics2D().drawImage(image, srcX, srcY, srcW, srcH, scaled_destX, scaled_destY, scaled_destW, scaled_destH, null); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdDibStretchBlt(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.STRETCH_BLT; } public int getROP() { return rop; } public void setROP(final int rop) { this.rop = rop; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int rop = record.getLongParam(POS_OPERATION); final int ySrc = record.getParam(POS_SRC_Y); final int xSrc = record.getParam(POS_SRC_X); final int srcH = record.getParam(POS_SRC_HEIGHT); final int srcW = record.getParam(POS_SRC_WIDTH); final int destH = record.getParam(POS_DST_HEIGHT); final int destW = record.getParam(POS_DST_WIDTH); final int yDest = record.getParam(POS_DST_Y); final int xDest = record.getParam(POS_DST_X); try { final DIBReader reader = new DIBReader(); setImage(reader.setRecord(record, POS_DIB)); } catch (IOException ioe) { // failed to load the bitmap .. } setROP(rop); setSrcRect(xSrc, ySrc, srcH, srcW); setDestRect(xDest, yDest, destH, destW); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { throw new RecordCreationException("StretchBlt is not supported"); } public BufferedImage getImage() { return image; } public void setImage(final BufferedImage image) { this.image = image; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[STRETCH_BLT] rop="); b.append(getROP()); b.append(" srcRect="); b.append(getSrcRect()); b.append(" destRect="); b.append(getDestRect()); return b.toString(); } public void setSrcRect(final int x, final int y, final int w, final int h) { this.srcX = x; this.srcY = y; this.srcW = w; this.srcH = h; scaleXChanged(); scaleYChanged(); } public void setDestRect(final int x, final int y, final int w, final int h) { this.destX = x; this.destY = y; this.destW = w; this.destH = h; scaleXChanged(); scaleYChanged(); } public Rectangle getSrcRect() { return new Rectangle(srcX, srcY, srcW, srcH); } public Rectangle getDestRect() { return new Rectangle(destX, destY, destW, destH); } public Rectangle getScaledDestRect() { return new Rectangle(scaled_destX, scaled_destY, scaled_destW, scaled_destH); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_destX = getScaledX(destX); scaled_destW = getScaledX(destW); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_destY = getScaledY(destY); scaled_destH = getScaledY(destH); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetBkColor.java0000644000175000017500000000707611365605266031576 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdSetBkColor extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_COLOR = 0; private Color color; public MfCmdSetBkColor() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setBkColor(color); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetBkColor(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int colref = record.getLongParam(POS_COLOR); setColor(new GDIColor(colref)); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_BK_COLOR; } public Color getColor() { return color; } public void setColor(final Color color) { this.color = color; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_BK_COLOR] color="); b.append(getColor()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdExtFloodFill.java0000644000175000017500000000726511365605266032122 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdExtFloodFill extends MfCmd { /* ExtFloodFill style flags */ public static final int FLOODFILLBORDER = 0; public static final int FLOODFILLSURFACE = 1; private int filltype; private Color color; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdExtFloodFill() { } public void replay(final WmfFile file) { // there is no way to implement flood fill for G2Objects ... } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[EXT_FLOOD_FILL] filltype="); b.append(getFillType()); b.append(" color="); b.append(getColor()); b.append(" target="); b.append(getTarget()); return b.toString(); } public MfCmd getInstance() { return new MfCmdExtFloodFill(); } private static final int RECORD_SIZE = 5; private static final int POS_FILLTYPE = 0; private static final int POS_COLOR = 1; private static final int POS_Y = 3; private static final int POS_X = 4; public void setRecord(final MfRecord record) { final int filltype = record.getParam(POS_FILLTYPE); final int c = record.getLongParam(POS_COLOR); final Color color = new GDIColor(c); final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setTarget(x, y); setColor(color); setFillType(filltype); } /** * Writer function */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_FILLTYPE, getFillType()); record.setLongParam(POS_COLOR, GDIColor.translateColor(getColor())); final Point target = getTarget(); record.setParam(POS_Y, (int) target.getY()); record.setParam(POS_X, (int) target.getX()); return record; } public void setFillType(final int filltype) { this.filltype = filltype; } public int getFillType() { return filltype; } public int getFunction() { return MfType.EXT_FLOOD_FILL; } public Point getTarget() { return new Point(x, y); } public Point getScaledTarget() { return new Point(scaled_x, scaled_y); } public void setTarget(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public void setColor(final Color c) { this.color = c; } public Color getColor() { return color; } protected void scaleXChanged() { scaled_x = getScaledX(x); } protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetWindowExt.java0000644000175000017500000001017411365605266032164 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Dimension; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Sets the size of the window. */ public class MfCmdSetWindowExt extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_HEIGHT = 0; private static final int POS_WIDTH = 1; private int height; private int width; private int scaled_width; private int scaled_height; public MfCmdSetWindowExt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Dimension dim = getScaledDimension(); state.setWindowExt(dim.width, dim.height); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetWindowExt(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int height = record.getParam(POS_HEIGHT); final int width = record.getParam(POS_WIDTH); setDimension(width, height); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); final Dimension dim = getDimension(); record.setParam(POS_HEIGHT, dim.height); record.setParam(POS_WIDTH, dim.width); return record; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_WINDOW_EXT] dimension="); b.append(getDimension()); return b.toString(); } public Dimension getDimension() { return new Dimension(width, height); } public Dimension getScaledDimension() { return new Dimension(scaled_width, scaled_height); } public void setDimension(final int w, final int h) { this.width = w; this.height = h; scaleXChanged(); scaleYChanged(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_width = getScaledX(width); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_height = getScaledY(height); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_WINDOW_EXT; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdChord.java0000644000175000017500000001762511365605266030627 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Arc2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The exact same as an arc, only the arc is closed, and may be filled with a brush. *

* The points (nLeftRect, nTopRect) and (nRightRect, nBottomRect) specify the bounding * rectangle. An ellipse formed by the specified bounding rectangle defines the curve of * the arc. The arc extends in the current drawing direction from the point where it * intersects the radial from the center of the bounding rectangle to the (nXStartArc, * nYStartArc) point. The arc ends where it intersects the radial from the center of the * bounding rectangle to the (nXEndArc, nYEndArc) point. If the starting point and ending * point are the same, a complete ellipse is drawn. */ public class MfCmdChord extends MfCmd { private static final int PARAM_X_END_POS = 0; private static final int PARAM_Y_END_POS = 1; private static final int PARAM_X_START_POS = 2; private static final int PARAM_Y_START_POS = 3; private static final int PARAM_BOTTOM_POS = 4; private static final int PARAM_RIGHT_POS = 5; private static final int PARAM_TOP_POS = 6; private static final int PARAM_LEFT_POS = 7; private static final int RECORD_SIZE = 8; private int x; private int y; private int width; private int height; private int xstart; private int ystart; private int xend; private int yend; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; private int scaled_xstart; private int scaled_ystart; private int scaled_xend; private int scaled_yend; public MfCmdChord() { } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); scaled_xstart = getScaledX(xstart); scaled_xend = getScaledX(xend); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); scaled_ystart = getScaledY(xstart); scaled_yend = getScaledY(xend); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CHORD; } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getBounds(); final Point start = getStartingIntersection(); final Point end = getEndingIntersection(); final Arc2D arc = new Arc2D.Double(); arc.setArcType(Arc2D.CHORD); arc.setFrame(rec.x, rec.y, rec.width, rec.height); arc.setAngles(start.x, start.y, end.x, end.y); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(arc); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(arc); state.postDraw(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdChord(); } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } public void setStartingIntersection(final int x, final int y) { xstart = x; ystart = y; scaleXChanged(); scaleYChanged(); } public Point getStartingIntersection() { return new Point(xstart, ystart); } public Point getScaledStartingIntersection() { return new Point(scaled_xstart, scaled_ystart); } public void setEndingIntersection(final int x, final int y) { xend = x; yend = y; scaleXChanged(); scaleYChanged(); } public Point getEndingIntersection() { return new Point(xend, yend); } public Point getScaledEndingIntersection() { return new Point(scaled_xend, scaled_yend); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int xend = record.getParam(PARAM_X_END_POS); final int yend = record.getParam(PARAM_Y_END_POS); final int xstart = record.getParam(PARAM_X_START_POS); final int ystart = record.getParam(PARAM_Y_START_POS); final int bottom = record.getParam(PARAM_BOTTOM_POS); final int right = record.getParam(PARAM_RIGHT_POS); final int top = record.getParam(PARAM_TOP_POS); final int left = record.getParam(PARAM_LEFT_POS); setBounds(left, top, right - left, bottom - top); setStartingIntersection(xstart, ystart); setEndingIntersection(xend, yend); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); final Rectangle bounds = getBounds(); final Point start = getStartingIntersection(); final Point end = getEndingIntersection(); record.setParam(PARAM_LEFT_POS, (int) bounds.getX()); record.setParam(PARAM_TOP_POS, (int) bounds.getY()); record.setParam(PARAM_RIGHT_POS, (int) (bounds.getX() + bounds.getWidth())); record.setParam(PARAM_BOTTOM_POS, (int) (bounds.getY() + bounds.getHeight())); record.setParam(PARAM_Y_START_POS, (int) (start.getY())); record.setParam(PARAM_X_START_POS, (int) (start.getX())); record.setParam(PARAM_Y_END_POS, (int) (end.getY())); record.setParam(PARAM_X_END_POS, (int) (end.getX())); return record; } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[CHORD] bounds="); b.append(getBounds()); b.append(" startIntersection="); b.append(getStartingIntersection()); b.append(" endingIntersection="); b.append(getEndingIntersection()); return b.toString(); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSelectPalette.java0000644000175000017500000000771211365605266032322 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfLogPalette; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.WmfObject; /** * Activates the specified Palette Object. The object must be previously defined for the * device context by using createPalette(). */ public class MfCmdSelectPalette extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_OBJECT_ID = 0; private int objectId; public MfCmdSelectPalette() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final WmfObject object = file.getObject(objectId); if (object == null) { throw new NullPointerException(); } switch (object.getType()) { case WmfObject.OBJ_PALETTE: file.getCurrentState().setLogPalette((MfLogPalette) object); break; default: throw new IllegalStateException("Object is no palette"); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSelectPalette(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_OBJECT_ID); setObjectId(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_OBJECT_ID, getObjectId()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SELECT_PALETTE; } public int getObjectId() { return objectId; } public void setObjectId(final int id) { this.objectId = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SELECT_PALETTE] object="); b.append(getObjectId()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/RecordCreationException.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/RecordCreationException0000644000175000017500000000257011365605266032514 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; public class RecordCreationException extends Exception { private static final long serialVersionUID = -7596557720287315169L; /** * Constructs an Exception with no specified detail message. */ public RecordCreationException() { } /** * Constructs an Exception with the specified detail message. * * @param s the detail message. */ public RecordCreationException(final String s) { super(s); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdOffsetWindowOrg.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdOffsetWindowOrg.ja0000644000175000017500000001020211365605266032307 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Moves the current Window Region to the specified position */ public class MfCmdOffsetWindowOrg extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_X = 1; private static final int POS_Y = 0; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdOffsetWindowOrg() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Point p = getScaledDestination(); state.setWindowOrg (state.getWindowOrgX() + p.x, state.getWindowOrgY() + p.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdOffsetWindowOrg(); } public Point getDestination() { return new Point(x, y); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[OFFSET_WINDOWORG] destination="); b.append(getDestination()); return b.toString(); } public void setDestination(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public void setDestination(final Point p) { setDestination(p.x, p.y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Point dest = getDestination(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_Y, dest.y); record.setParam(POS_X, dest.x); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.OFFSET_WINDOW_ORG; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setDestination(x, y); } public Point getScaledDestination() { return new Point(scaled_x, scaled_y); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreateDibPatternBrush.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreateDibPatternBr0000644000175000017500000001043311365605266032302 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.image.BufferedImage; import java.io.IOException; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; import org.pentaho.reporting.libraries.pixie.wmf.bitmap.DIBReader; // This structure should include a bitmap. This implementation does // not know of any bitmaps right now, so this records is ignored. // todo ... public class MfCmdCreateDibPatternBrush extends MfCmd { private static final int POS_BITMAP_TYPE = 0; private static final int POS_PALETTE_TYPE = 1; private static final int POS_BITMAP_INFO_STRUCT = 2; // bitmap data follows the bitmap header ... private BufferedImage image; public MfCmdCreateDibPatternBrush() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { /** * Requires a DIB-Writer, this is not yet supported */ throw new RecordCreationException("CreateDIBPatternBrush is not yet supported"); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { try { final DIBReader reader = new DIBReader(); setImage(reader.setRecord(record)); } catch (IOException ioe) { // failed to load the bitmap .. } } public BufferedImage getImage() { return image; } public void setImage(final BufferedImage image) { if (image == null) { throw new NullPointerException(); } this.image = image; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_DIB_PATTERN_BRUSH] "); b.append(" no internals known "); return b.toString(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_DIB_PATTERN_BRUSH; } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogBrush lbrush = new MfLogBrush(); lbrush.setStyle(MfLogBrush.BS_DIBPATTERN); lbrush.setBitmap(image); file.getCurrentState().setLogBrush(lbrush); file.storeObject(lbrush); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreateDibPatternBrush(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. Not used here. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. Not used here. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdScaleWindowExt.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdScaleWindowExt.jav0000644000175000017500000001074311365605266032321 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; public class MfCmdScaleWindowExt extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_Y_DENOM = 0; private static final int POS_X_DENOM = 2; private static final int POS_Y_NUM = 1; private static final int POS_X_NUM = 3; private int yNum; private int yDenom; private int xNum; private int xDenom; public MfCmdScaleWindowExt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { file.getGraphics2D().scale ((double) getXNum() / (double) getXDenom(), (double) getYNum() / (double) getYDenom()); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_X_DENOM, getXDenom()); record.setParam(POS_X_NUM, getXNum()); record.setParam(POS_Y_DENOM, getYDenom()); record.setParam(POS_Y_NUM, getYNum()); return record; } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdScaleWindowExt(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SCALE_WINDOW_EXT; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SCALE_WINDOW] scaleX="); b.append(getXNum()); b.append('/'); b.append(getXDenom()); b.append(" scaley="); b.append(getYNum()); b.append('/'); b.append(getYDenom()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int yD = record.getParam(0); final int yN = record.getParam(1); final int xD = record.getParam(2); final int xN = record.getParam(3); setXScale(xN, xD); setYScale(yN, yD); } public void setXScale(final int xNum, final int xDenom) { this.xNum = xNum; this.xDenom = xDenom; } public void setYScale(final int yNum, final int yDenom) { this.yNum = yNum; this.yDenom = yDenom; } public double getXScale() { return (double) xNum / xDenom; } public int getXNum() { return xNum; } public int getXDenom() { return xDenom; } public double getYScale() { return (double) yNum / yDenom; } public int getYNum() { return yNum; } public int getYDenom() { return yDenom; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdPaintRgn.java0000644000175000017500000000771611365605266031312 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Rectangle; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfLogRegion; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Fills the region with the currently selected brush. */ public class MfCmdPaintRgn extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_REGION = 0; private int region; public MfCmdPaintRgn() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogRegion regio = file.getRegionObject(region); final MfDcState state = file.getCurrentState(); state.setLogRegion(regio); final MfLogBrush brush = state.getLogBrush(); final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = scaleRect(regio.getBounds()); if (brush.isVisible()) { state.preparePaint(); graph.fill(rec); state.postPaint(); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdPaintRgn(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { region = record.getParam(POS_REGION); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_REGION, getRegion()); return record; } public void setRegion(final int region) { this.region = region; } public int getRegion() { return region; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.PAINTREGION; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[PAINT_REGION] region="); b.append(getRegion()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. Not used. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetViewPortOrg.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetViewPortOrg.jav0000644000175000017500000001035211365605266032320 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Point; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Defines the upper left corner of the viewport. The size of the viewport is defined * using setViewportExt. *

* SetViewportOrgEx specifies which device point maps to the logical point (0,0). It has * the effect of shifting the axes so that the logical point (0,0) no longer refers to the * upper-left corner. */ public class MfCmdSetViewPortOrg extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_Y = 0; private static final int POS_X = 1; private int x; private int y; private int scaled_x; private int scaled_y; public MfCmdSetViewPortOrg() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); final Point p = getScaledTarget(); state.setViewportOrg(p.x, p.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetViewPortOrg(); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_VIEWPORT_ORG] target="); b.append(getTarget()); return b.toString(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setTarget(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); final Point p = getTarget(); record.setParam(POS_X, p.x); record.setParam(POS_Y, p.y); return record; } public Point getTarget() { return new Point(x, y); } public void setTarget(final int x, final int y) { this.x = x; this.y = y; scaleXChanged(); scaleYChanged(); } public Point getScaledTarget() { return new Point(scaled_x, scaled_y); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_VIEWPORT_ORG; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreatePalette.java0000644000175000017500000001154011365605266032300 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfLogPalette; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Palette function not supported */ public class MfCmdCreatePalette extends MfCmd { private static final int POS_HPALETTE = 0; private static final int POS_CENTRIES = 1; private static final int POS_START_ENTRIES = 2; private int hPalette; private Color[] colors; public MfCmdCreatePalette() { } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_PALETTE; } /** * Returns the number of colors defined for the AnimatePalette command. * * @return the number of colors or 0 if no colors are defined. */ public int getEntriesCount() { if (colors == null) { return 0; } return colors.length; } /** * Creates a new record based on the data stored in the MfCommand. This function may * or may not work, there is not much HQ documentation about metafiles available in the * net. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final int cEntries = getEntriesCount(); if (cEntries == 0) { throw new RecordCreationException("Empty CreatePaletteRecord is not valid"); } final MfRecord record = new MfRecord(2 + cEntries * 2); record.setParam(POS_HPALETTE, getHPalette()); record.setParam(POS_CENTRIES, cEntries); for (int i = 0; i < cEntries; i++) { final Color c = colors[i]; // a long parameter is 2 words long record.setLongParam(i * 2 + POS_START_ENTRIES, GDIColor.translateColor(c)); } return record; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* This method is not implemented, as a Palette implementation is still missing. * * @param record the record. */ public void setRecord(final MfRecord record) { // the handle to the palette object ignored final int hPalette = record.getParam(POS_HPALETTE); setHPalette(hPalette); // the number of defined entries ... final int cEntries = record.getParam(POS_CENTRIES); final Color[] colors = new Color[cEntries]; for (int i = 0; i < cEntries; i++) { final int cr = record.getLongParam(i * 2 + POS_START_ENTRIES); final GDIColor color = new GDIColor(cr); colors[i] = color; } setEntries(colors); } public void replay(final WmfFile file) { // no real implementation, as palettes are not yet fully supported ... final MfLogPalette pal = new MfLogPalette(); file.getCurrentState().setLogPalette(pal); file.storeObject(pal); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[CREATE_PALETTE] "); b.append(" no internals known "); return b.toString(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreatePalette(); } /** * Not implemented as no scaling needed for this operation. */ protected void scaleXChanged() { } /** * Not implemented as no scaling needed for this operation. */ protected void scaleYChanged() { } public int getHPalette() { return hPalette; } public void setHPalette(final int hPalette) { this.hPalette = hPalette; } public Color[] getEntries() { return colors; } public void setEntries(final Color[] colors) { this.colors = colors; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdAnimatePalette.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdAnimatePalette.jav0000644000175000017500000001515011365605266032313 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The AnimatePalette function replaces entries in the specified logical palette. *

*

 * BOOL AnimatePalette(
 *  HPALETTE hpal,           // handle to logical palette
 *  UINT iStartIndex,        // first entry in logical palette
 *  UINT cEntries,           // number of entries
 *  CONST PALETTEENTRY *ppe  // first replacement
 * );
 * 
*

* This function is not implemented. However, you can use this implementation to create a * valid record. * * * * *
offset length in bytesmeaning
0x0 4 RecordSize (variable)
0x4 2 record type (0x0436)
0x6 2 first palette entry to be animated
0x8 2 number of animated entries
0xan*4 palette entry array with (1 byte red, 1 byte green, 1 byte blue, 1 * byte flags)
*/ public final class MfCmdAnimatePalette extends MfCmd { /** * the position of the first entry within the palette that should be animated. */ private static final int POS_START_ANIMATE_COLOR = 0; private static final int POS_CENTRIES = 1; private static final int POS_START_ENTRIES = 2; private int posStartAnimate; private Color[] colors; /** * DefaultConstructor. */ public MfCmdAnimatePalette() { } /** * Returns the number of colors defined for the AnimatePalette command. * * @return the number of colors or 0 if no colors are defined. */ public int getEntriesCount() { if (colors == null) { return 0; } return colors.length; } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final int cEntries = getEntriesCount(); if (cEntries == 0) { throw new RecordCreationException("Empty AnimatePaletteRecord is not valid"); } final MfRecord record = new MfRecord(2 + cEntries * 2); record.setParam(POS_START_ANIMATE_COLOR, getPosStartAnimate()); record.setParam(POS_CENTRIES, cEntries); for (int i = 0; i < cEntries; i++) { final Color c = colors[i]; // a long parameter is 2 words long record.setLongParam(i * 2 + POS_START_ENTRIES, GDIColor.translateColor(c)); } return record; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* This method is not implemented, as a Palette implementation is still missing. * * @param record the record. */ public void setRecord(final MfRecord record) { // the handle to the palette object final int hPalette = record.getParam(POS_START_ANIMATE_COLOR); setPosStartAnimate(hPalette); // the number of defined entries ... final int cEntries = record.getParam(POS_CENTRIES); final Color[] colors = new Color[cEntries]; for (int i = 0; i < cEntries; i++) { final int cr = record.getLongParam(i * 2 + POS_START_ENTRIES); final GDIColor color = new GDIColor(cr); colors[i] = color; } this.colors = colors; } /** * Reads the function identifiert .Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return MfType.ANIMATE_PALETTE. */ public int getFunction() { return MfType.ANIMATE_PALETTE; } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { // do nothing // System.out.println ("Animate Palette is not implemented"); } /** * Returns a string representation of this command. * * @return the command as string. */ public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[ANIMATE_PALETTE] posStartAnimate="); b.append(getPosStartAnimate()); b.append(" entriesCount="); b.append(getEntriesCount()); return b.toString(); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdAnimatePalette(); } /** * Returns the position of the first color that should be animated in the current * palette. * * @return the position of the color. */ public int getPosStartAnimate() { return posStartAnimate; } /** * Defines the position of the first color that should be animated in the current * palette. * * @param hPalette the index of the color, not negative. */ public void setPosStartAnimate(final int hPalette) { if (posStartAnimate < 0) { throw new IndexOutOfBoundsException("Palette indices must be positive."); } this.posStartAnimate = hPalette; } /** * Returns the colors defined for this command. * * @return the colors */ public Color[] getEntries() { return colors; } /** * Defines the colors that should be animated. * * @param colors the colors. */ public void setEntries(final Color[] colors) { this.colors = colors; } /** * Not implemented as no scaling needed for this operation. */ protected void scaleXChanged() { } /** * Not implemented as no scaling needed for this operation. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdRestoreDc.java0000644000175000017500000000777211365605266031464 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The RestoreDC function restores a device context (DC) to the specified state. The DC is * restored by popping state information off a stack created by earlier calls to the * SaveDC function. *

* BOOL RestoreDC( HDC hdc, // handle to DC int nSavedDC // restore state * ); *

* Parameters nSavedDC [in] Specifies the saved state to be restored. If this parameter is * positive, nSavedDC represents a specific instance of the state to be restored. If this * parameter is negative, nSavedDC represents an instance relative to the current state. * For example, 0x01 restores the most recently saved state. */ public class MfCmdRestoreDc extends MfCmd { private int dcId; public MfCmdRestoreDc() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { if (dcId == 0) { return; } if (dcId > 0) { file.restoreDCState(dcId); } else { file.restoreDCState(file.getStateCount() - dcId); } } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdRestoreDc(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(0); setNSavedDC(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(1); record.setParam(0, getNSavedDC()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.RESTORE_DC; } public int getNSavedDC() { return dcId; } public void setNSavedDC(final int id) { this.dcId = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[RESTORE_DC] nSavedDC="); b.append(getNSavedDC()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextCharExtra.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetTextCharExtra.j0000644000175000017500000000740711365605266032277 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The SetTextCharacterExtra function sets the intercharacter spacing. Intercharacter * spacing is added to each character, including break characters, when the system writes * a line of text. */ public class MfCmdSetTextCharExtra extends MfCmd { private static final int RECORD_SIZE = 1; private static final int POS_TEXT_CHAR_EXTRA = 0; private int textCharExtra; public MfCmdSetTextCharExtra() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfDcState state = file.getCurrentState(); state.setTextCharExtra(textCharExtra); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetTextCharExtra(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int id = record.getParam(POS_TEXT_CHAR_EXTRA); setTextCharExtra(id); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_TEXT_CHAR_EXTRA, getTextCharExtra()); return record; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_TEXT_CHAR_EXTRA; } public int getTextCharExtra() { return textCharExtra; } public void setTextCharExtra(final int id) { this.textCharExtra = id; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_TEXT_CHAR_EXTRA] textCharExtra="); b.append(getTextCharExtra()); return b.toString(); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdRealisePalette.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdRealisePalette.jav0000644000175000017500000000614311365605266032323 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Synchronizes the Metafile-Palette with the device-dependent palette This is not used * here, as java uses 24-Bit TrueColors to display colors. *

* The record itself is empty. */ public class MfCmdRealisePalette extends MfCmd { public MfCmdRealisePalette() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdRealisePalette(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { return new MfRecord(0); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[REALISE_PALETTE] is not implemented"); return b.toString(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.REALISE_PALETTE; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetDibitsToDevice.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdSetDibitsToDevice.0000644000175000017500000000737411365605266032243 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; // This structure should include a bitmap. This implementation does // not know of any bitmaps right now, so this records is ignored. public class MfCmdSetDibitsToDevice extends MfCmd { private static final int POS_FLAG_COLOR_PALETTE = 0; private static final int POS_SCANLINE_COUNT = 1; private static final int POS_FIRST_SCANLINE = 2; private static final int POS_SOURCE_Y_DIB = 3; private static final int POS_SOURCE_X_DIB = 4; private static final int POS_DIB_HEIGHT = 5; private static final int POS_DIB_WIDTH = 6; private static final int POS_ORIGIN_DEST_RECT_Y = 7; private static final int POS_ORIGIN_DEST_RECT_X = 8; private static final int POS_BITMAP_HEADER = 9; // the bit map data follows the header. // the record has a variable size ... public MfCmdSetDibitsToDevice() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdSetDibitsToDevice(); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { // System.out.println("SetDibitsToDevice is not implemented."); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SET_DIBITS_TO_DEVICE] <>"); return b.toString(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SET_DIBITS_TO_DEVICE; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { throw new UnsupportedOperationException("Native functions are not supported"); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdArc.java0000644000175000017500000001766611365605266030302 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Arc2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The Arc function draws an elliptical arc. *

* The points (nLeftRect, nTopRect) and (nRightRect, nBottomRect) specify the bounding * rectangle. An ellipse formed by the specified bounding rectangle defines the curve of * the arc. The arc extends in the current drawing direction from the point where it * intersects the radial from the center of the bounding rectangle to the (nXStartArc, * nYStartArc) point. The arc ends where it intersects the radial from the center of the * bounding rectangle to the (nXEndArc, nYEndArc) point. If the starting point and ending * point are the same, a complete ellipse is drawn. *

* The arc is drawn using the current pen; it is not filled. */ public class MfCmdArc extends MfCmd { private static final int PARAM_X_END_POS = 0; private static final int PARAM_Y_END_POS = 1; private static final int PARAM_X_START_POS = 2; private static final int PARAM_Y_START_POS = 3; private static final int PARAM_BOTTOM_POS = 4; private static final int PARAM_RIGHT_POS = 5; private static final int PARAM_TOP_POS = 6; private static final int PARAM_LEFT_POS = 7; private static final int RECORD_SIZE = 8; private int x; private int y; private int width; private int height; private int xstart; private int ystart; private int xend; private int yend; private int scaled_x; private int scaled_y; private int scaled_width; private int scaled_height; private int scaled_xstart; private int scaled_ystart; private int scaled_xend; private int scaled_yend; public MfCmdArc() { } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_x = getScaledX(x); scaled_width = getScaledX(width); scaled_xstart = getScaledX(xstart); scaled_xend = getScaledX(xend); } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_y = getScaledY(y); scaled_height = getScaledY(height); scaled_ystart = getScaledY(xstart); scaled_yend = getScaledY(xend); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdArc(); } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final Rectangle rec = getScaledBounds(); final Point start = getScaledStartingIntersection(); final Point end = getScaledEndingIntersection(); final Arc2D arc = new Arc2D.Double(); arc.setArcType(Arc2D.OPEN); arc.setFrame(rec.x, rec.y, rec.width, rec.height); arc.setAngles(start.x, start.y, end.x, end.y); final MfDcState state = file.getCurrentState(); if (state.getLogBrush().isVisible()) { state.preparePaint(); graph.fill(arc); state.postPaint(); } if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(arc); state.postDraw(); } } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.ARC; } public Rectangle getBounds() { return new Rectangle(x, y, width, height); } public Rectangle getScaledBounds() { return new Rectangle(scaled_x, scaled_y, scaled_width, scaled_height); } public void setBounds(final int x, final int y, final int width, final int height) { this.x = x; this.y = y; this.width = width; this.height = height; scaleXChanged(); scaleYChanged(); } public void setStartingIntersection(final int x, final int y) { xstart = x; ystart = y; scaleXChanged(); scaleYChanged(); } public Point getStartingIntersection() { return new Point(xstart, ystart); } public Point getScaledStartingIntersection() { return new Point(scaled_xstart, scaled_ystart); } public void setEndingIntersection(final int x, final int y) { xend = x; yend = y; scaleXChanged(); scaleYChanged(); } public Point getEndingIntersection() { return new Point(xend, yend); } public Point getScaledEndingIntersection() { return new Point(scaled_xend, scaled_yend); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int xend = record.getParam(PARAM_X_END_POS); final int yend = record.getParam(PARAM_Y_END_POS); final int xstart = record.getParam(PARAM_X_START_POS); final int ystart = record.getParam(PARAM_Y_START_POS); final int bottom = record.getParam(PARAM_BOTTOM_POS); final int right = record.getParam(PARAM_RIGHT_POS); final int top = record.getParam(PARAM_TOP_POS); final int left = record.getParam(PARAM_LEFT_POS); setBounds(left, top, right - left, bottom - top); setStartingIntersection(xstart, ystart); setEndingIntersection(xend, yend); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); final Rectangle bounds = getBounds(); final Point start = getStartingIntersection(); final Point end = getEndingIntersection(); record.setParam(PARAM_LEFT_POS, (int) bounds.getX()); record.setParam(PARAM_TOP_POS, (int) bounds.getY()); record.setParam(PARAM_RIGHT_POS, (int) (bounds.getX() + bounds.getWidth())); record.setParam(PARAM_BOTTOM_POS, (int) (bounds.getY() + bounds.getHeight())); record.setParam(PARAM_Y_START_POS, (int) (start.getY())); record.setParam(PARAM_X_START_POS, (int) (start.getX())); record.setParam(PARAM_Y_END_POS, (int) (end.getY())); record.setParam(PARAM_X_END_POS, (int) (end.getX())); return record; } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[ARC] bounds="); b.append(getBounds()); b.append(" startIntersection="); b.append(getStartingIntersection()); b.append(" endingIntersection="); b.append(getEndingIntersection()); return b.toString(); } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdCreateBrush.java0000644000175000017500000001400111365605266031760 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Color; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.reporting.libraries.pixie.wmf.BrushConstants; import org.pentaho.reporting.libraries.pixie.wmf.GDIColor; import org.pentaho.reporting.libraries.pixie.wmf.MfLogBrush; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The CreateBrushIndirect function creates a logical brush that has the specified style, * color, and pattern. *

* The style is one of the BS_* constants defined in {@link org.pentaho.reporting.libraries.pixie.wmf.BrushConstants}. * The hatch is one of the HS_* constants defined in {@link org.pentaho.reporting.libraries.pixie.wmf.BrushConstants}. *

* The record size is variable. First parameter defines the style, n next parameters * define the color table for the brush and the last parameter defines the hatch. *

* todo reimplement this record type for all brushes.. */ public class MfCmdCreateBrush extends MfCmd { private static final Log logger = LogFactory.getLog(MfCmdCreateBrush.class); private static final int PARAM_STYLE = 0; private static final int PARAM_COLOR = 1; private static final int PARAM_HATCH = 3; private static final int RECORD_SIZE = 4; private int style; private Color color; private int hatch; public MfCmdCreateBrush() { } public String toString() { final StringBuffer b = new StringBuffer(100); b.append("[CREATE_BRUSH] style="); b.append(getStyle()); b.append(" color="); b.append(getColor()); b.append(" hatch="); b.append(getHatch()); return b.toString(); } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final MfLogBrush lbrush = new MfLogBrush(); lbrush.setStyle(getStyle()); lbrush.setColor(getColor()); lbrush.setHatchedStyle(getHatch()); file.getCurrentState().setLogBrush(lbrush); file.storeObject(lbrush); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdCreateBrush(); } public void setStyle(final int style) { this.style = style; } public int getStyle() { return style; } public void setHatch(final int hatch) { if (hatch != BrushConstants.BS_DIBPATTERN && hatch != BrushConstants.BS_DIBPATTERN8X8 && hatch != BrushConstants.BS_DIBPATTERNPT && hatch != BrushConstants.BS_HATCHED && hatch != BrushConstants.BS_HOLLOW && hatch != BrushConstants.BS_INDEXED && hatch != BrushConstants.BS_MONOPATTERN && // hatch != BrushConstants.BS_NULL && // BS_NULL is the same as BS_HOLLOW hatch != BrushConstants.BS_PATTERN && hatch != BrushConstants.BS_PATTERN8X8 && hatch != BrushConstants.BS_SOLID) { throw new IllegalArgumentException("The specified pattern is invalid"); } this.hatch = hatch; } public int getHatch() { return hatch; } public void setColor(final Color c) { this.color = c; } public Color getColor() { return color; } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.CREATE_BRUSH_INDIRECT; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { if (record.getLength() != 14) { logger.warn("Unknown type of CreateBrushIndirect encountered."); } final int style = record.getParam(PARAM_STYLE); final int color = record.getLongParam(PARAM_COLOR); final int hatch = record.getParam(PARAM_HATCH); setStyle(style); setColor(new GDIColor(color)); setHatch(hatch); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(PARAM_STYLE, getStyle()); record.setLongParam(PARAM_COLOR, GDIColor.translateColor(getColor())); record.setParam(PARAM_HATCH, getHatch()); return record; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. This method is not used. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. The method is not used. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdLineTo.java0000644000175000017500000001103211365605266030744 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Line2D; import org.pentaho.reporting.libraries.pixie.wmf.MfDcState; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * The LineTo function draws a line from the current position up to, but not including, * the specified point. The cursor is set to the destination after drawing. */ public class MfCmdLineTo extends MfCmd { private static final int RECORD_SIZE = 2; private static final int POS_X = 1; private static final int POS_Y = 0; private int destX; private int destY; private int scaled_destX; private int scaled_destY; public MfCmdLineTo() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { final Graphics2D graph = file.getGraphics2D(); final MfDcState state = file.getCurrentState(); final int cx = state.getCurPosX(); final int cy = state.getCurPosY(); final Point destP = getScaledDestination(); if (state.getLogPen().isVisible()) { state.prepareDraw(); graph.draw(new Line2D.Double(cx, cy, destP.x, destP.y)); state.postDraw(); } state.setCurPos(destP.x, destP.y); } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdLineTo(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.LINE_TO; } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[LINE_TO] destination="); b.append(getDestination()); return b.toString(); } public void setDestination(final Point p) { setDestination(p.x, p.y); } public void setDestination(final int x, final int y) { destX = x; destY = y; scaleXChanged(); scaleYChanged(); } public Point getDestination() { return new Point(destX, destY); } public Point getScaledDestination() { return new Point(scaled_destX, scaled_destY); } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int y = record.getParam(POS_Y); final int x = record.getParam(POS_X); setDestination(x, y); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() { final Point dest = getDestination(); final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_Y, dest.y); record.setParam(POS_X, dest.x); return record; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { scaled_destX = getScaledX(destX); } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { scaled_destY = getScaledY(destY); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdScaleViewportExt.javalibpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/records/MfCmdScaleViewportExt.j0000644000175000017500000001107211365605266032336 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf.records; import org.pentaho.reporting.libraries.pixie.wmf.MfRecord; import org.pentaho.reporting.libraries.pixie.wmf.MfType; import org.pentaho.reporting.libraries.pixie.wmf.WmfFile; /** * Scales the current view port. */ public class MfCmdScaleViewportExt extends MfCmd { private static final int RECORD_SIZE = 4; private static final int POS_Y_DENOM = 0; private static final int POS_X_DENOM = 2; private static final int POS_Y_NUM = 1; private static final int POS_X_NUM = 3; private int yNum; private int yDenom; private int xNum; private int xDenom; public MfCmdScaleViewportExt() { } /** * Replays the command on the given WmfFile. * * @param file the meta file. */ public void replay(final WmfFile file) { file.getGraphics2D().scale ((double) getXNum() / (double) getXDenom(), (double) getYNum() / (double) getYDenom()); } /** * Creates a new record based on the data stored in the MfCommand. * * @return the created record. */ public MfRecord getRecord() throws RecordCreationException { final MfRecord record = new MfRecord(RECORD_SIZE); record.setParam(POS_X_DENOM, getXDenom()); record.setParam(POS_X_NUM, getXNum()); record.setParam(POS_Y_DENOM, getYDenom()); record.setParam(POS_Y_NUM, getYNum()); return record; } /** * Creates a empty unintialized copy of this command implementation. * * @return a new instance of the command. */ public MfCmd getInstance() { return new MfCmdScaleViewportExt(); } /** * Reads the function identifier. Every record type is identified by a function number * corresponding to one of the Windows GDI functions used. * * @return the function identifier. */ public int getFunction() { return MfType.SCALE_VIEWPORT_EXT; } /** * Reads the command data from the given record and adjusts the internal parameters * according to the data parsed. *

* After the raw record was read from the datasource, the record is parsed by the * concrete implementation. * * @param record the raw data that makes up the record. */ public void setRecord(final MfRecord record) { final int yD = record.getParam(POS_Y_DENOM); final int yN = record.getParam(POS_Y_NUM); final int xD = record.getParam(POS_X_DENOM); final int xN = record.getParam(POS_X_NUM); setXScale(xN, xD); setYScale(yN, yD); } public String toString() { final StringBuffer b = new StringBuffer(); b.append("[SCALE_VIEWPORT] scaleX="); b.append(getXNum()); b.append('/'); b.append(getXDenom()); b.append(" scaley="); b.append(getYNum()); b.append('/'); b.append(getYDenom()); return b.toString(); } public void setXScale(final int xNum, final int xDenom) { this.xNum = xNum; this.xDenom = xDenom; } public void setYScale(final int yNum, final int yDenom) { this.yNum = yNum; this.yDenom = yDenom; } public double getXScale() { return (double) xNum / xDenom; } public int getXNum() { return xNum; } public int getXDenom() { return xDenom; } public double getYScale() { return (double) yNum / yDenom; } public int getYNum() { return yNum; } public int getYDenom() { return yDenom; } /** * A callback function to inform the object, that the x scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleXChanged() { } /** * A callback function to inform the object, that the y scale has changed and the * internal coordinate values have to be adjusted. */ protected void scaleYChanged() { } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/WmfImageProducer.java0000644000175000017500000000746211365605266030416 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.ImageConsumer; import java.awt.image.ImageProducer; import java.io.IOException; import java.net.URL; import java.util.ArrayList; /** * Implements the ImageProducer interface for the MetaFiles */ public class WmfImageProducer implements ImageProducer { private WmfFile metafile; private ArrayList consumers; public WmfImageProducer(final String inName, final int width, final int height) throws IOException { consumers = new ArrayList(); metafile = new WmfFile(inName, width, height); // metafile.replay (); } public WmfImageProducer(final URL inName, final int width, final int height) throws IOException { consumers = new ArrayList(); metafile = new WmfFile(inName, width, height); // metafile.replay (); } public WmfImageProducer(final URL inName) throws IOException { consumers = new ArrayList(); metafile = new WmfFile(inName); // metafile.replay (); } public synchronized void addConsumer(final ImageConsumer ic) { if (isConsumer(ic)) { return; } consumers.add(ic); } public synchronized boolean isConsumer(final ImageConsumer ic) { return consumers.contains(ic); } public synchronized void removeConsumer(final ImageConsumer ic) { consumers.remove(ic); } public synchronized void requestTopDownLeftRightResend(final ImageConsumer ic) { startProduction(ic); } public synchronized void startProduction(final ImageConsumer pic) { if (pic != null) { addConsumer(pic); } final ImageConsumer[] cons = (ImageConsumer[]) consumers.toArray(new ImageConsumer[consumers.size()]); final BufferedImage image = metafile.replay(); final int w = image.getWidth(); final int h = image.getHeight(); final ColorModel model = image.getColorModel(); for (int i = 0; i < cons.length; i++) { final ImageConsumer ic = cons[i]; ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT); ic.setHints(ImageConsumer.SINGLEFRAME); ic.setHints(ImageConsumer.SINGLEPASS); ic.setHints(ImageConsumer.COMPLETESCANLINES); ic.setDimensions(w, h); ic.setColorModel(model); } final int LINES = 10; int[] pixels = new int[w * LINES]; for (int i = 0; i < h; i += LINES) { final int rows; if ((i + LINES) > h) { rows = h - i; } else { rows = LINES; } pixels = image.getRGB(0, i, w, rows, pixels, 0, w); for (int j = 0; j < cons.length; j++) { final ImageConsumer ic = cons[j]; ic.setPixels(0, i, w, rows, model, pixels, 0, w); } } for (int i = 0; i < cons.length; i++) { final ImageConsumer ic = cons[i]; ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } if (pic != null) { removeConsumer(pic); } } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfLogFont.java0000644000175000017500000000503211365605266027040 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Font; import java.awt.geom.AffineTransform; /** * A Windows metafile logical font object. */ public class MfLogFont implements WmfObject { private String face; private int size; private int style; private boolean strikeout; private boolean underline; private double rotation; /** * Construct from a metafile record. */ public MfLogFont() { } public void setFace(final String face) { this.face = face; } /** * The name of the font face. */ public String getFace() { return face; } public void setSize(final int size) { this.size = size; } /** * The size, in logical units. */ public int getSize() { return size; } /** * The font style. */ public int getStyle() { return style; } public void setStyle(final int style) { this.style = style; } /** * True if this is an underlined font. */ public boolean isUnderline() { return underline; } public void setUnderline(final boolean underline) { this.underline = underline; } public boolean isStrikeOut() { return strikeout; } public void setStrikeOut(final boolean b) { this.strikeout = b; } public Font createFont() { final Font retfont = new Font(getFace(), getStyle(), getSize()); final double rot = StrictMath.sin(Math.toRadians(-rotation)); return retfont.deriveFont(AffineTransform.getRotateInstance(rot)); } public int getType() { return OBJ_FONT; } public double getRotation() { return rotation; } public void setRotation(final double d) { this.rotation = d; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/WmfObject.java0000644000175000017500000000232011365605266027062 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * Defines a generic WmfObject. */ public interface WmfObject { public static final int OBJ_PEN = 1; public static final int OBJ_BRUSH = 2; public static final int OBJ_PALETTE = 3; public static final int OBJ_FONT = 4; public static final int OBJ_REGION = 5; public int getType(); } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/MfLogBrush.java0000644000175000017500000002163511365605266027224 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Color; import java.awt.Paint; import java.awt.Rectangle; import java.awt.TexturePaint; import java.awt.image.BufferedImage; /** * A Windows metafile logical brush object. */ public class MfLogBrush implements WmfObject { private static final boolean WHITE = false; private static final boolean BLACK = true; private static final boolean[] IMG_HS_HORIZONTAL = { WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, }; private static final boolean[] IMG_HS_VERTICAL = { WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, }; private static final boolean[] IMG_HS_FDIAGONAL = { BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, }; private static final boolean[] IMG_HS_BDIAGONAL = { BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, }; private static final boolean[] IMG_HS_CROSS = { WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, }; private static final boolean[] IMG_HS_DIAGCROSS = { BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, BLACK, BLACK, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, BLACK, BLACK, WHITE, WHITE, BLACK, BLACK, WHITE, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, BLACK, BLACK, BLACK, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, BLACK, }; public static final int COLOR_FULL_ALPHA = 0x00FFFFFF; // Brush styles. public static final int BS_SOLID = 0; public static final int BS_NULL = 1; public static final int BS_HATCHED = 2; public static final int BS_PATTERN = 3; public static final int BS_INDEXED = 4; public static final int BS_DIBPATTERN = 5; // Hatch styles. public static final int HS_HORIZONTAL = 0; public static final int HS_VERTICAL = 1; public static final int HS_FDIAGONAL = 2; public static final int HS_BDIAGONAL = 3; public static final int HS_CROSS = 4; public static final int HS_DIAGCROSS = 5; private int style; private Color color; private Color bgColor; private int hatch; private Paint lastPaint; private BufferedImage bitmap; /** * The default brush for a new DC. */ public MfLogBrush() { style = BS_SOLID; color = Color.white; bgColor = new Color(COLOR_FULL_ALPHA); hatch = HS_HORIZONTAL; } public boolean isVisible() { return getStyle() != BS_NULL; } public int getType() { return OBJ_BRUSH; } /** * The style of this brush. */ public int getStyle() { return style; } public void setStyle(final int style) { this.style = style; } /** * Return the color of the current brush, or null. */ public Color getColor() { return color; } public void setColor(final Color color) { this.color = color; lastPaint = null; } /** * The hatch style of this brush. */ public int getHatchedStyle() { return hatch; } public void setHatchedStyle(final int hstyle) { this.hatch = hstyle; lastPaint = null; } public Paint getPaint() { if (lastPaint != null) { return lastPaint; } switch (getStyle()) { case BS_SOLID: lastPaint = getColor(); break; case BS_NULL: lastPaint = new GDIColor(COLOR_FULL_ALPHA); break; case BS_HATCHED: { final BufferedImage image = createHatchStyle(); lastPaint = new TexturePaint(image, new Rectangle(0, 0, image.getWidth(), image.getHeight())); break; } case BS_DIBPATTERN: { if (bitmap == null) { lastPaint = new GDIColor(COLOR_FULL_ALPHA); } else { lastPaint = new TexturePaint(bitmap, new Rectangle(0, 0, bitmap.getWidth(), bitmap.getHeight())); } break; } default: { // Unknown Paint Mode lastPaint = new GDIColor(COLOR_FULL_ALPHA); } } return lastPaint; } private BufferedImage createHatchStyle() { final int style = getHatchedStyle(); final BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_INT_ARGB); switch (style) { case HS_HORIZONTAL: image.setRGB(0, 0, 8, 8, transform(IMG_HS_HORIZONTAL), 0, 8); break; case HS_VERTICAL: image.setRGB(0, 0, 8, 8, transform(IMG_HS_VERTICAL), 0, 8); break; case HS_FDIAGONAL: image.setRGB(0, 0, 8, 8, transform(IMG_HS_FDIAGONAL), 0, 8); break; case HS_BDIAGONAL: image.setRGB(0, 0, 8, 8, transform(IMG_HS_BDIAGONAL), 0, 8); break; case HS_CROSS: image.setRGB(0, 0, 8, 8, transform(IMG_HS_CROSS), 0, 8); break; case HS_DIAGCROSS: image.setRGB(0, 0, 8, 8, transform(IMG_HS_DIAGCROSS), 0, 8); break; default: throw new IllegalArgumentException(); } return image; } public int[] transform(final boolean[] data) { final int color = getColor().getRGB(); final int bgColor = getBackgroundColor().getRGB(); final int[] retval = new int[data.length]; for (int i = 0; i < retval.length; i++) { if (data[i] == true) { retval[i] = color; } else { retval[i] = bgColor; } } return retval; } public void setBackgroundColor(final Color bg) { this.bgColor = bg; lastPaint = null; } public Color getBackgroundColor() { return bgColor; } public void setBitmap(final BufferedImage bitmap) { this.bitmap = bitmap; } public BufferedImage getBitmap() { return bitmap; } } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/ROPConstants.java0000644000175000017500000000661011365605266027545 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; /** * The ROPConstants were defined in the Windows-API and are used do define the various * RasterOperations (ROP). We don't support RasterOperations... */ public interface ROPConstants { public static final int SRCCOPY = 0x00CC0020; /* dest = source */ public static final int SRCPAINT = 0x00EE0086; /* dest = source OR dest */ public static final int SRCAND = 0x008800C6; /* dest = source AND dest */ public static final int SRCINVERT = 0x00660046; /* dest = source XOR dest */ public static final int SRCERASE = 0x00440328; /* dest = source AND (NOT dest ) */ public static final int NOTSRCCOPY = 0x00330008; /* dest = (NOT source) */ public static final int NOTSRCERASE = 0x001100A6; /* dest = (NOT src) AND (NOT dest) */ public static final int MERGECOPY = 0x00C000CA; /* dest = (source AND pattern) */ public static final int MERGEPAINT = 0x00BB0226; /* dest = (NOT source) OR dest */ public static final int PATCOPY = 0x00F00021; /* dest = pattern */ public static final int PATPAINT = 0x00FB0A09; /* dest = DPSnoo */ public static final int PATINVERT = 0x005A0049; /* dest = pattern XOR dest */ public static final int DSTINVERT = 0x00550009; /* dest = (NOT dest) */ public static final int BLACKNESS = 0x00000042; /* dest = BLACK */ public static final int WHITENESS = 0x00FF0062; /* dest = WHITE */ /* Binary raster ops */ public static final int R2_BLACK = 1; /* 0 */ public static final int R2_NOTMERGEPEN = 2; /* DPon */ public static final int R2_MASKNOTPEN = 3; /* DPna */ public static final int R2_NOTCOPYPEN = 4; /* PN */ public static final int R2_MASKPENNOT = 5; /* PDna */ public static final int R2_NOT = 6; /* Dn */ public static final int R2_XORPEN = 7; /* DPx */ public static final int R2_NOTMASKPEN = 8; /* DPan */ public static final int R2_MASKPEN = 9; /* DPa */ public static final int R2_NOTXORPEN = 10; /* DPxn */ public static final int R2_NOP = 11; /* D */ public static final int R2_MERGENOTPEN = 12; /* DPno */ public static final int R2_COPYPEN = 13; /* P */ public static final int R2_MERGEPENNOT = 14; /* PDno */ public static final int R2_MERGEPEN = 15; /* DPo */ public static final int R2_WHITE = 16; /* 1 */ public static final int R2_LAST = 16; } libpixie-java-1.1.6/source/org/pentaho/reporting/libraries/pixie/wmf/WmfFile.java0000644000175000017500000003562711365605266026553 0ustar renerene/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2000 - 2009 Pentaho Corporation, Object Refinery Limited and Contributors. All rights reserved. */ package org.pentaho.reporting.libraries.pixie.wmf; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.reporting.libraries.pixie.wmf.records.CommandFactory; import org.pentaho.reporting.libraries.pixie.wmf.records.MfCmd; import org.pentaho.reporting.libraries.pixie.wmf.records.MfCmdSetWindowExt; import org.pentaho.reporting.libraries.pixie.wmf.records.MfCmdSetWindowOrg; import org.pentaho.reporting.libraries.base.util.FastStack; /** * Parses and replays the WmfFile. */ public class WmfFile { private static final Log logger = LogFactory.getLog(WmfFile.class); public static final int QUALITY_NO = 0; // Can't convert. public static final int QUALITY_MAYBE = 1; // Might be able to convert. public static final int QUALITY_YES = 2; // Can convert. // Maximal picture size is 1200x1200. A average wmf file scales easily // to 20000 and more, so we have to limit the pixel image's size. private static final int MAX_PICTURE_SIZE = getMaxPictureSize(); private static int getMaxPictureSize() { return 1200; } private WmfObject[] objects; private FastStack dcStack; private MfPalette palette; //private String inName; private InputStream in; private MfHeader header; private int fileSize; private int filePos; private ArrayList records; private Graphics2D graphics; private int maxWidth; private int maxHeight; private int imageWidth; private int imageHeight; private int minX; private int minY; private int imageX; private int imageY; /** * Initialize metafile for reading from an URL. Width and height will be computed automatically. * * @param input the URL from where to read. * @throws IOException if any other error occured. */ public WmfFile(final URL input) throws IOException { this(input, -1, -1); } /** * Initialize metafile for reading from file. Width and height will be computed automatically. * * @param input the name of the file from where to read. * @throws IOException if any other error occured. */ public WmfFile(final String input) throws IOException { this(input, -1, -1); } /** * Initialize metafile for reading from an URL. * * @param imageWidth the target width of the image or -1 for automatic mode. * @param imageHeight the target height of the image or -1 for automatic mode. * @param input the URL from where to read. * @throws IOException if any other error occured. */ public WmfFile(final URL input, final int imageWidth, final int imageHeight) throws IOException { this(new BufferedInputStream(input.openStream()), imageWidth, imageHeight); } /** * Initialize metafile for reading from filename. * * @param imageWidth the target width of the image or -1 for automatic mode. * @param imageHeight the target height of the image or -1 for automatic mode. * @param inName the file name from where to read. * @throws FileNotFoundException if the file was not found. * @throws IOException if any other error occured. */ public WmfFile(final String inName, final int imageWidth, final int imageHeight) throws FileNotFoundException, IOException { this(new BufferedInputStream(new FileInputStream(inName)), imageWidth, imageHeight); } /** * Initialize metafile for reading from the given input stream. * * @param imageWidth the target width of the image or -1 for automatic mode. * @param imageHeight the target height of the image or -1 for automatic mode. * @param in the stream from where to read. * @throws IOException if any other error occured. */ public WmfFile(final InputStream in, final int imageWidth, final int imageHeight) throws IOException { this.in = in; this.imageWidth = imageWidth; this.imageHeight = imageHeight; records = new ArrayList(); dcStack = new FastStack(100); palette = new MfPalette(); readHeader(); parseRecords(); resetStates(); } public Dimension getImageSize() { return new Dimension(maxWidth, maxHeight); } private void resetStates() { Arrays.fill(objects, null); dcStack.clear(); dcStack.push(new MfDcState(this)); } public MfPalette getPalette() { return palette; } /** * Return Placeable and Windows headers that were read earlier. * * @return the meta-file header. */ public MfHeader getHeader() { return header; } public Graphics2D getGraphics2D() { return graphics; } /** * Check class invariant. */ private void assertValid() { if (filePos < 0 || filePos > fileSize) { throw new IllegalStateException("WmfFile is not valid"); } } /** * Read Placeable and Windows headers. */ private MfHeader readHeader() throws IOException { header = new MfHeader(); header.read(in); if (header.isValid()) { fileSize = header.getFileSize(); objects = new WmfObject[header.getObjectsSize()]; filePos = header.getHeaderSize(); return header; } else { throw new IOException("The given file is not a real metafile"); } } /** * Fetch a record. * * @return the next record read or null, if the end-of-file has been reached. * @throws IOException if an IO-Error occurs. */ private MfRecord readNextRecord() throws IOException { if (filePos >= fileSize) { return null; } assertValid(); final MfRecord record = new MfRecord(in); filePos += record.getLength(); return record; } /** * Read and interpret the body of the metafile. * * @throws IOException if an IO-Error occurs. */ private void parseRecords() throws IOException { minX = Integer.MAX_VALUE; minY = Integer.MAX_VALUE; maxWidth = 0; maxHeight = 0; final CommandFactory cmdFactory = CommandFactory.getInstance(); MfRecord mf; while ((mf = readNextRecord()) != null) { final MfCmd cmd = cmdFactory.getCommand(mf.getType()); if (cmd == null) { logger.info("Failed to parse record " + mf.getType()); } else { cmd.setRecord(mf); if (cmd.getFunction() == MfType.SET_WINDOW_ORG) { final MfCmdSetWindowOrg worg = (MfCmdSetWindowOrg) cmd; final Point p = worg.getTarget(); minX = Math.min(p.x, minX); minY = Math.min(p.y, minY); } else if (cmd.getFunction() == MfType.SET_WINDOW_EXT) { final MfCmdSetWindowExt worg = (MfCmdSetWindowExt) cmd; final Dimension d = worg.getDimension(); maxWidth = Math.max(maxWidth, d.width); maxHeight = Math.max(maxHeight, d.height); } records.add(cmd); } } in.close(); in = null; // make sure that we don't have invalid values in case no // setWindow records were found ... if (minX == Integer.MAX_VALUE) { minX = 0; } if (minY == Integer.MAX_VALUE) { minY = 0; } //System.out.println(records.size() + " records read"); //System.out.println("Image Extends: " + maxWidth + " " + maxHeight); if (imageWidth < 1 || imageHeight < 1) { scaleToFit(MAX_PICTURE_SIZE, MAX_PICTURE_SIZE); } else { scaleToFit(imageWidth, imageHeight); } } /** * Scales the WMF-image to the given width and height while preserving the aspect ration. * * @param fitWidth the target width. * @param fitHeight the target height. */ public void scaleToFit(final float fitWidth, final float fitHeight) { final float percentX = (fitWidth * 100) / maxWidth; final float percentY = (fitHeight * 100) / maxHeight; scalePercent(percentX < percentY ? percentX : percentY); } /** * Scale the image to a certain percentage. * * @param percent the scaling percentage */ public void scalePercent(final float percent) { scalePercent(percent, percent); } /** * Scale the width and height of an image to a certain percentage. * * @param percentX the scaling percentage of the width * @param percentY the scaling percentage of the height */ public void scalePercent(final float percentX, final float percentY) { imageWidth = (int) ((maxWidth * percentX) / 100f); imageHeight = (int) ((maxHeight * percentY) / 100f); imageX = (int) ((minX * percentX) / 100f); imageY = (int) ((minY * percentY) / 100f); } public static void main(final String[] args) throws Exception { final WmfFile wmf = new WmfFile("./head/pixie/res/a0.wmf", 800, 600); wmf.replay(); // System.out.println(wmf.imageWidth + ", " + wmf.imageHeight); } public MfDcState getCurrentState() { return (MfDcState) dcStack.peek(); } // pushes a state on the stack public void saveDCState() { final MfDcState currentState = getCurrentState(); dcStack.push(new MfDcState(currentState)); } public int getStateCount() { return dcStack.size(); } /** * Restores a state. The stateCount specifies the number of states to discard * to find the correct one. * * @param stateCount the state count. */ public void restoreDCState(final int stateCount) { if ((stateCount > 0) == false) { throw new IllegalArgumentException(); } // this is contrary to Caolans description of the WMF file format, but // Batik also ignores the stateCount parameter. dcStack.pop(); getCurrentState().restoredState(); } /** * Return the next free slot from the objects table. * * @return the next new free slot in the objects-registry */ protected int findFreeSlot() { for (int slot = 0; slot < objects.length; slot++) { if (objects[slot] == null) { return slot; } } throw new IllegalStateException("No free slot"); } public void storeObject(final WmfObject o) { final int idx = findFreeSlot(); objects[idx] = o; } public void deleteObject(final int slot) { if ((slot < 0) || (slot >= objects.length)) { throw new IllegalArgumentException("Range violation"); } objects[slot] = null; } public WmfObject getObject(final int slot) { if ((slot < 0) || (slot >= objects.length)) { throw new IllegalStateException("Range violation"); } return objects[slot]; } public MfLogBrush getBrushObject(final int slot) { final WmfObject obj = getObject(slot); if (obj.getType() == WmfObject.OBJ_BRUSH) { return (MfLogBrush) obj; } throw new IllegalStateException("Object " + slot + " was no brush"); } public MfLogPen getPenObject(final int slot) { final WmfObject obj = getObject(slot); if (obj.getType() == WmfObject.OBJ_PEN) { return (MfLogPen) obj; } throw new IllegalStateException("Object " + slot + " was no pen"); } public MfLogRegion getRegionObject(final int slot) { final WmfObject obj = getObject(slot); if (obj.getType() == WmfObject.OBJ_REGION) { return (MfLogRegion) obj; } throw new IllegalStateException("Object " + slot + " was no region"); } public synchronized BufferedImage replay() { return replay(imageWidth, imageHeight); } public synchronized BufferedImage replay(final int imageX, final int imageY) { final BufferedImage image = new BufferedImage(imageX, imageY, BufferedImage.TYPE_INT_ARGB); final Graphics2D graphics = image.createGraphics(); // clear the image area ... graphics.setPaint(new Color(0, 0, 0, 0)); graphics.fill(new Rectangle(0, 0, imageX, imageY)); draw(graphics, new Rectangle2D.Float(0, 0, imageX, imageY)); graphics.dispose(); return image; } public synchronized void draw(final Graphics2D graphics, final Rectangle2D bounds) { // this adjusts imageWidth and imageHeight scaleToFit((float) bounds.getWidth(), (float) bounds.getHeight()); // adjust translation if needed ... graphics.translate(bounds.getX(), bounds.getY()); // adjust to the image origin graphics.translate(-imageX, -imageY); this.graphics = graphics; for (int i = 0; i < records.size(); i++) { try { final MfCmd command = (MfCmd) records.get(i); command.setScale((float) imageWidth / (float) maxWidth, (float) imageHeight / (float) maxHeight); command.replay(this); } catch (Exception e) { logger.warn("Error while processing image record #" + i, e); } } resetStates(); } /** * Returns the preferred size of the drawable. If the drawable is aspect ratio aware, these bounds should be used to * compute the preferred aspect ratio for this drawable. * * @return the preferred size. */ public Dimension getPreferredSize() { return new Dimension(imageWidth, imageHeight); } /** * Returns true, if this drawable will preserve an aspect ratio during the drawing. * * @return true, if an aspect ratio is preserved, false otherwise. */ public boolean isPreserveAspectRatio() { return true; } public String toString() { final StringBuffer bo = new StringBuffer(500); bo.append("WmfFile={width="); bo.append(imageWidth); bo.append(", height="); bo.append(imageHeight); bo.append(", recordCount="); bo.append(records.size()); bo.append(", records={\n"); for (int i = 0; i < records.size(); i++) { final MfCmd cmd = (MfCmd) records.get(i); bo.append(i); bo.append(','); bo.append(cmd.toString()); bo.append('\n'); } bo.append("}\n"); return bo.toString(); } } libpixie-java-1.1.6/licence-LGPL.txt0000644000175000017500000006347611365605266015640 0ustar renerene GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libpixie-java-1.1.6/README.txt0000644000175000017500000000550111365605266014420 0ustar renerene-------------------------------------------------------------- Pixie - A free WMF rendering library Version 0.99.0 -------------------------------------------------------------- 30 May 2008. (C)opyright, 2000-2005, by Object Refinery Limited and Contributors. (C)opyright, 2006-2007, by Pentaho Corporation and Contributors. 1. INTRODUCTION ----------------- Pixie is a WMF-File reading library originally written by David R. Harris as converter for the Pixie-ImageViewer. Pixie was long time dead and is now resurrected as WMF-Reader and ImageProducer for Java 1.2.2 or higher. Pixie lacks the support for most BitMap-Formats but everything else is working fine. Write-Support will be implemented somewhere in the future, classes for the writesupport are mostly dummies at the moment. Pixie is licensed, free of charge, under the terms of the GNU Lesser General Public Licence. A copy of the licence is included in the download. The latest version of this class library can be obtained from: http://reporting.pentaho.org/pixie/ If you have any comments, suggestions or bugs to report, please post a message in the JFreeReport forum. 2. CONTRIBUTORS ----------------- We whish to thank the original developer of the gnu.bhresearch package, from where the initial version of this code was forked. 3. REQUIREMENTS --------------- Pixie needs at least JDK 1.2.2 for its core functionality. 4. SUPPORT ---------- Free support is available via the Pentaho forum, follow the link from the home page. Please note that questions are answered by volunteers, so there is no guaranteed response time or level of service. Please avoid e-mailing the developers directly for support questions. If you post a message in the forum, then everyone can see the question, and everyone can see the answer. The forums can be found at http://forums.pentaho.org/ 5. REPORTING BUGS ----------------- If you find bugs in Pixie, we'd like to hear about it so that we can improve future releases of Pixie. Please post a bug report to the JIRA bug-tracker at Pentaho.org: http://jira.pentaho.org/ Please be sure to provide as much information as you can. We need to know the version of Pixie that you are using, the JDK version, and the steps required to replicate the bug. Include any other information that you think is relevant. 6. ANT ------ We use an open source build tool called Ant to build Pixie. An Ant script (tested using Ant 1.7.0) is included in the distribution: /build.xml You can find out more about Ant at: http://ant.apache.org/ Ant is licensed under the terms of the Apache Software License (a popular open source software license). 7. OTHER FEEDBACK ----------------- For other feedback and comments, please post a message on the Pentaho forums. The Forum is available at http://forums.pentaho.org/ libpixie-java-1.1.6/test-lib/0000755000175000017500000000000011365605330014434 5ustar renerenelibpixie-java-1.1.6/maven-project.xml0000644000175000017500000000410711365605266016217 0ustar renerene 3 pixie Pixie jfree 0.8.4 JFree.org http://www.jfree.org/ 2001 Pixie is a library for reading WMF files. Pixie is a library for reading WMF files. http://www.jfree.org/jfreereport/pixie/ http://sourceforge.net/tracker/?group_id=51669 scm:cvs:pserver:anonymous@cvs.sourceforge.net:/cvsroot/jfreereport:pixie http://cvs.sourceforge.net/viewcvs.py/jfreereport/pixie JFreeReport Developer List jfreereport-developers-request@lists.sourceforge.net?subject=subscribe jfreereport-developers-request@lists.sourceforge.net?subject=unsubscribe http://sourceforge.net/mailarchive/forum.php?forum=jfreereport-developers GNU Lesser General Public Licence http://www.gnu.org/licenses/lgpl.txt repo jfree jcommon 1.0.0-pre2 http://www.jfree.org/jcommon/ libpixie-java-1.1.6/pixie.iml0000644000175000017500000001655611365605264014555 0ustar renerene libpixie-java-1.1.6/ChangeLog.txt0000644000175000017500000000550711365605266015320 0ustar renerene--------------- 1. WHAT's NEW --------------- A list of changes in recent versions: 0.99.0: (30-May-2008) * Jumped to Version Number 1.0 as this library is as feature complete as it will get. * Switched from JCommon to LibBase. All version information is now contained in the manifest. The Project-Info implementation reads the version numbers from the Jar's Manifest or the compiler-output-directory. * Without JCommon the WmfFile-class no longer implements the Drawable interface directly. Drawable is now considered a calling convention and therefore the 'draw(Graphics2D,Rectangle2D)' method will remain intact and will now be called using Java-Reflection. * Removed JCommon and replaced it with LibBase. All versioning information now comes from the jar's manifest file. 0.8.10: (02-Nov-2007) * Upgraded to jcommon-1.0.12 0.8.9: (16-Oct-2007) * Automatic fixes as reported by IntelliJ-IDEA's inspections * Updated the copyright header on all java-files 0.8.8: (24-Sep-2007) * All releases are now built with JDK 1.4. However, we are still compatible with JDK 1.2.2 and all releases run and compile under that release. * [Bug] The strikethrough and underline positions were invalid. Max-Height was invalid, as the iText descent was returned as negative number. 0.8.7: (30-Jul-2007) * The WmfFile class now implements the ExtendedDrawable interface and therefore provides hints on the natural aspect ratio of the file. The preferred size returned by the WmfFile is computed from the operations defined in the file; it may or may not reflect the real aspect ratio of the image. ------------------------------------------------------------------------------- 20-Apr-2006 : The WmfFile did not use/obey to the initial image size given in the constructor. 17-Apr-2006 : The classes from package org.jfree.pixie.g2recorder have been removed. Updated JCommon to the latest stable version. 04-Mar-2005 : Another BugFix release for JFreeReport 0.8.5; The classes from package org.jfree.pixie.g2recorder are no longer included in the release, until they have been completed. 21-Oct-2004 : BugFixes .. 19-Jan-2004 : Some final changes and discontinued for now. Implementing the writing support seems useless in a free world, where SVG is available. Some minor fixes were made in the WMF-Reading, it is still not complete (and as there is no useable documentation available, I doubt it ever will be complete). Use SVG instead. 29-Aug-2002 : Downport to JDK1.2.2 : Altered WmfImageProducer to use less memory on producing. libpixie-java-1.1.6/devresource/0000755000175000017500000000000011365605264015245 5ustar renerenelibpixie-java-1.1.6/devresource/META-INF/0000755000175000017500000000000011365605264016405 5ustar renerenelibpixie-java-1.1.6/devresource/META-INF/MANIFEST.MF0000644000175000017500000000032611365605264020040 0ustar renereneImplementation-Title: LibPixie Implementation-Vendor: Pentaho Corporation Implementation-ProductID: libpixie Release-Major-Number: 1 Release-Minor-Number: 0 Release-Milestone-Number: 0 Release-Candidate-Token: dev libpixie-java-1.1.6/dev-lib/0000755000175000017500000000000011365605272014240 5ustar renerenelibpixie-java-1.1.6/.classpath0000644000175000017500000000141311365605266014703 0ustar renerene libpixie-java-1.1.6/ivysettings.xml0000644000175000017500000000174311365605264016036 0ustar renerene libpixie-java-1.1.6/lib/0000755000175000017500000000000011636135325013462 5ustar renerenelibpixie-java-1.1.6/examples/0000755000175000017500000000000011365605266014537 5ustar renerenelibpixie-java-1.1.6/examples/anim0002.wmf0000644000175000017500000002641611365605266016511 0ustar renerene×ÍÆš» û^T |l û»   ÿÿÿÿ.ú-ü²²²-z$;L–Ñ+,¥^‚”2î¢_ý÷¬ó+É6GQׇ1™½l)¬?çzç°VáR¬æý«W·aFðS—wè»#ÛB¥äÉG?¯¸òïcï§ æó;Ÿº§•ƒDæl ’!váµ_ýCÇ€òBÿöo} S6L–L–üÿÌ-ð.$Ú)»@¨`‰ Ø¢5œÇ™f¨½ÊäãòÂ*¬+áI6f`9í)Ú)Ú)ü-ð0$Æ ¾¼Ãú²Â5¿‚Ò¤êbñ2ÿýÞ Ïð÷êóÜÑÕä½úçù۬ƠƠ:$¸Š°º¿å¬ÿµ+ªP¸bª…¶¢°¼Åäàáæ¤Ñ¸ä„áfÃlêLá*ñüÞóúÏý¡ùeݤ¸Š¸Š$ Á†ÉoêirüˆëvÚxØ”Á†Á†$ Á:×&ó)ñ?ÿWÆgÆGÁ:Á:"$ê3ê Î9ŽfX“+£ ª˜AxW6¦øûñ/ê3ê3&$+#@>|…¸ÌÌ÷Ø3Ï3Âú£Éw>Q$9 ,$ £Zš~—Ý“+™r©Ã£P£ £Å£Z£Z&$"]"¬ MÝ÷ù÷FˆËîÑâñÏ'ù,­"]"]üÿå²-ð$ +ßi¹y-÷[¢‹h­?Bf+ß+ßüÿÌ-ð8$jÏÔó\2,!E_$ˆý4*­Úp<ì<®Ö@hrCYІkf®ŽˆƒÐï3‡v2ƒíjÏjÏüœ‚k-ð$$rRR) ©âô¤_†ËbK(€  Ðôd9é‡-rrüååå-ðN$%ÿé¸å•ý«"¡"“L›{•̸®”ê±3ݸwÖY·¸Ý›ÄîêÐÞ ðóê 0:3=S'i8ˆ2’Rp¨#É4 µìÿéÿéüå3-ð$UYh?=Ñ\Ѓ‰UYUY$Áüêì!cJëÁÁ$ ¼5ð+2WŽë¹Æš¼5¼5üÿÌ-ðX$*l[¯iÇaÜKö8`Nz[ LÃLk0}Pt{}²ŠÝ¥ß®ù¥&eŒ8&pàŸ²ÅŸìŸ°×NÊ]¨q¤Œ¬µÂµ—s{A]U&ãp×’ê@¸³llüѽ½-ð\$,-íSìt"Tmˆ°|Ók'—JvwÀˆÕ‡x#¯¢@ÍÁWî?îim>U[]q|p¡X|8yœÏ‡•œ|GOLbèBÅW*MZ­M‰Z6X -í-íü£””-ðD$ öé'ù?H:L`0¬æ&M'v"à<þ:96|c~t¬{Ò«ÆØß÷17üÜ YÙ²å4ì™'E  Äöéöéüœ‚k-ð,$yJé›ov-ÓXGCYE&‹S´=ËuåœÏDsîÏ&Z·ÐcyJyJüÿÌ-ð4$:7)T/Œnj†í©qÊÈï3fX¾È$êÖLšnô­6.ɪ^?0æ![!:7:7üœ‚k-ðX$*È*)8FZ*Z7™8ÓQýK<KqS£IÕ`ve™§œàÄ"íWÞ“âÒ¡»j‡oONù½ {Ü?ïÚ´Çý¡ébªXÕ,Ýû±ÓßÁӓŇâkÈÈü-ðˆ$BoC%0A0R@[>~3Ž7¬M½SÛHåVfk/dGqo‚~‹¦}¾‚ܕ襗E¡d´fÆ‹¿·ÔÖîÝþõ!?*;IgZgIQI;W14 éÓžò{ëOë'Ö Ò×Ò®¿Ÿ¶s¶\¶4¥¥î±å±Ò ¿“—¥‡‡gv1‹(ª0§oo6$™Þ9#ŸHw~ÉÒ áfdѶMªŸ“uýö_9“bË‘ŠT1.ä'ž(™™.$—´5ÊRÆd±u‡iŒ‡±…ѓתÍ˪Û××6à+ŸÖ‚&€!MÒ#——$ ™ÐÄÖæå?õF/8BÊ8××½ç£ò™Ð™Ð&$³MINÅ^k‘–i=bP”K¶ÊÂÄ´â¤çàuÍb±c³M³M4$ÄÌÃÅôÜTü¯_â GöQw i/ðª„HýïxÓRÚYä0óóìéßÁÜÄÌÄÌ $ÖCP>ôEcJƒ„ƒ¢·õ›‹qûZÙXÖCÖC$$ùÊ4³w³±ƒ¾¢í©Z1 - Dþ=è$ÓÚùÊùÊ"$D,s& (K   4Ã4ãTÕ‰j…qloMZ.D,D, $z“¨Ó¨ÖÍ'Þ|ã×åbîçÅÛzz&$0–r¦³ÆëëzLÆv&°'úRö·ì§Õd¯0–0–.$…aõ—MÛÄI+©¢ƒ@ÙYuvšœh†E½Â`SäºUGçã›…a…a$3Od\²‹¼§ˆ€\l3O3O$ °«°ÇÑÊöí ѯޚ°«°«$ àðÇ à à($‚†©&-®6–;¥D›I·R¶EÈD¾4Ô4É%貂‚H$"pj&u<Q?¦jMP]dDbNo/oBƒ],”@ !«9½%É0Õ#à_ùsÏ’Íw¸£½’¥­©£•¹“·ŠÏòŽÆYppD$ ¤Ì»ÒçÕîèÏãÏù½îDZ´¢°9–:Üó_e NVB-E"4?54#J-Ed'_Zå ¤ ¤$ çBJhb¤S+<ù9çBçB6$´A²r¬žŒÜ¬«¬Ú¾¶½ÆÍ­Ù·ç›ó­ Sf\ýrôhé}ßsÏxÆ<¾´´@$¨BBWy]~qd|lˆ\—g£R®^¶V¿`ËJÑUî´#Æ%¾Ò ÐøâòáãîÝêÏ÷Ìﺸø’¨B¨BH$"XA[!E!P238DG%P<^d6z%†6"˜¡ ¯ý½ÍôÒæiá^¿‹°|žŒ•‹‚•rbž[‘K¯D™(XX²$W ÞÂ<pgœ{³{ÜeýI9K`fp–eÂMØKvBty—{»‰Ì«Ç»â»©<á:Úaòuj+SYç‹°Àó‰žÕ0êJÏJ§h“••¯ÅÖºû‘ Z@øÜ!¼ ¸q¡€je'Gü9ËB÷çì«Å‹¬{À`ÕGÅ¢æ„ÙyË”´²²Éd¬H••ü§ôÄýã–Ò_Ì8ã('6j@L5( ×  Þ Þ$F^ŽŸÜ»ïË&ÛJÄi¬­ÇÁ×ë× Ç'ÀeÞ^÷uüœâÅì, C.7UguuQ–QÁeÁþ¡¡õŠ}ûg^îAòAÐ'Ù'ÂÉ5…#‰8Y[%;6þïëÂú¿ –ã¦ü†çaêV1î&óúüÝîÚ±3œ.ˆ<q<J^^($à¼.£C˜SXºh¶†v¡zlÈ1K 66ô'Üàà4$fZ‰G})†²ïôä±Ð–§®{Ò†“}c‡R–v©ˆÐyè™#AmTph…ff\$,‘0}MB\Q)XçCØ%Ý?¡GhAK%>G÷H»7¥›LsWNO*I9$îü0òWùho>l[UŒe£oÁiíWt*€Ik¢bÃzÛvõhVF‘0‘0*$ŠÑ© ,b—1ÿIžfu-£óÎQˆÑ¹Lôó$’\VzqÕŠÑŠÑ$$¢³ËÛ…! \F„÷nã¶Ø ÇæÂÒµ³ý¢¢$ =Mý„à²Øï/ ð ù­=M=M0${ø¸ó”³ m€Šœ‘uÑŽÉrù_JvFC_úSít¸e¦qg™MuH{ø{ø$uÛ°ÎÑLÓÓ÷ÞuÛuÛ$ —›œ·ŠØ¦°Ì°¬§——›—›$©SÆj¬l©S©Süÿå²-ð$ ¤ègÃW6Ùe. Eq#Ho¤è¤èüÿÌ-ð8$fØüýt ž6¯ ‹i«’Ó=¦¶öy”õ”!"ßr^Mw“Jtj¸B’LÙàZ<M÷fØfØüœ‚k-ð$$^~\§ˆÃ³îþ,hJÕn …1P0ÚÜn—óI6^^üååå-ðN$%Ñóî;% @,/,=V5…;Õ¸<ô=ó!€úcÂó¥ øæÙòàüæ*¾¾:–G}1gAH;>[_²­>Ä¿ä™ÑóÑóüå3-ð${bhHCGÿe@“{b{b$±ÊÔóä+Ím†õ±Ê±Ê$ ?ß#±4ž`»˜å £??üÿÌ-ðX$*c™t¹gÑoæ…˜i„t©ƒÍƒ!e:SZ\…S¼Eç+é"+0k•˜0`ê1» ¨ä¨Ë¹·á‚Ós²_®DµÌ¡]…g{0ÍìÍzøœæI¼c™c™üѽ½-ð\$,£÷|õ\ Q,Q^c‘QºTÝd$C19TCYÉHÞIW-!.J%`âHâr¼w’_ug_…`«x…˜‚Ϧ‘;¦TPUnòŽÎy4ƒ$v¶ƒ“v?x£÷£÷ü£””-ðD$ Ùó©‘#ˆD„j µ±ïª »W©€®é”–Bš†mˆ[µUÛ%ÐøéÙ:˜ÔæÇb÷¼ë>ä˵£©OÄ* !ÙóÙóüœ‚k-ð,$WTç¤a Z¢ÝxQc‹ˆª•}¾’Õ[î4Ù@M]÷/vÁmWTWTüÿÌ-ð4$– A§ ]¡ •b tJ ÷& { Òáox‹Ò¬ô@àƒ Ì¤bý#?¢Ó&h‘:é*t *– A– Aüœ‚k-ðX$* &¦2·AŠd¦d™£—Ý~…F…{}¬‡Þp&Zo7±4é ,ãaòîÜ/Åf‘aY‚Çǰ„ôIÎàã ÑÓ«çl& bû5ò ÝñËüœ ‘îu & &ü-ðˆ$Ba  /  K  \ e’ ˆ —™ µ‚ Ç} åˆ ïz j e 8l Q_ yN ‡E ¯S ÈN æ; ò+ 9 N/ n p ” ÀüàâçÒ Û+ÂI¦E‡quq‡Z‡Ey;œ¶ó»Ü˨ޅåYå1úþàþ¸ ¨ } f >+ + ø ï Ü0 É=  + ‘I qZ ;E 2& 9) a a 6$7 ñ—-1RÎRÓþ)0ë·plÌ?W&©=‹[Úi—œnÕÌ›F^Ÿ7ì02 27 7 .$9 ( > \ n I sC ‘ ÿø´ Õ& åøášê¤©ú‹ªНWþ-9 (9 ($ 7 Ú ßêï‘ÿŠ8˜L Aø$ø  ñ- û7 Ú7 Ú&$ V‡X heš:r“k€ž…¿ Ë ½î®é—ð~ k m V V4$ Ö¿ÍQÏÜæ|!iÿÇs¡ú&ˆÓùXÝ~äw&ì9ÝÝõçé æ Ö Ö $úM€HÜNmTMM«ÎÀÛ¤¿”ÂzÕc÷búMúM$$×Óœ½Y½Ï»MÇ.ö'"u Ÿ)£Œ“ñ¬ÜËã×Ó×Ó"$Œ5]0°2…Ä)²> >í^û’f_v`Wu7Œ5Œ5 $V§¹§=§¹²ý²ùÖ©èSíùïnøÈð äV§V§&$  ^¯Ðåõ¸VV €Ç0 ©~ÿ ä)ßl¸    .$KkÛ¡ƒä S¤².&ÐŒãw&[€5¥hŠ ºÆi}î_ˆñí¥KkKk$Ylf”±HŠtuYY$ ´ ÑÿÓÚöÅÛϸò¤ ´ ´$0éOú  0é0é($M J!'0C7"@:E+N5S\ON=ü=/è&M M H$"`f0[FI*sƒYsnŒk‚x¡xsš£ž©¯µ—ǫӠެêq]Ù>×YÂ-Ç>®#²-Ÿ“™Þ— b``D$ Å­·ÕÐÄÐÜéÞâòìø %.  C:Dô‹ÝhÂoÇW±_¼L£N®>‘?œ-†7‹&l1q!vïÅ­Å­$ éL·Thl,ˆQ]¥E×CéLéL6$À½¼^µ2•ôµ%µöÈÆ ×#ãñ5ü#C}"it^þhòRé]ØWÏ”ÈÀ½À½@$(LCL3`WgRzl†d‘t¡i­~¸rÀzÉpÔ†Û{÷, /þîûïíâçæØÙÖáÄÐÁØœ(L(LH$"w u+‹+€<BŒP«Y”g±nš„«š˜®¡ÐªÆ¹ÓǾÖÜÛÐðgërÈEºS¨DŸEŒ;|Ck2e?T!N71w w ²$WÄç @F`‰i¥U¼Uåj‡—Upp`Ÿj̃á…Z#@L@}W¡UÄGÖ%Ñë'FïDökÞ~¼s¥\wðE¹™Ý’µ§¾Þ ô†Ù†°h;ž!ÎúÄÕ›ÆdÏIØ ô+{/‰fo©PÔBKÙÍñä´ ”$„jûQ .ïLãWÕ<¾¼n$Q:):)þ í þiBí2Ë0´@´tU›2ÉùÄçÄç$F´g—Щô§ù0õS s$· Êùõù 1oòhÙÔ¦îÏä$¾¤8™_i[[9[o//ÿFRirøûÙ©â©ËÂÒ›­“—c²d«DÉ?»Ò#»øÉõ´ÌÕÈÇŸí¯ÔéŠËjå`Ë:â0Ë ÝÔçâã¾»¥¢’”{”T´g´g($Êé¹Å¢¬¢}§xÃhÀJ€/@„dÒŸ'¿UÄ@šþ©æÊéÊé4$j§v“‰‡§É»áþ뺠)¸UÛIœSlI[9€'’ƒèšÎ¢­‰w|zhŽj§j§\$,?:SVŽe3xñá«æ‘«‰qU«H‰‡Ä˜®±¤„}yW€4‡—¬ ÐâÁŸüyhaGde{•k¬aËg÷y)\3PRe¬nÍVåZþh'zP?:?:*$FÚ' 06n¡Ÿ‡¨j~£¬Áü[GÚUÛü¬œt_V_ÞFÚFÚ$$. Õõ¯»eÂOÐØwíÀøª ïÜ(. . $ “VÒð»÷'á9Ç!à×·“V“V0$Uü<0wP“4›[ÚAÓ^q'†€ŠLq}ö\Ák¯_q7V[RUU$[å ×ÊÚ„Í=ÝØç[å[å$ 9¥4ÁFá* Ö µ( 9¥9¥$'\ t$u'\'\libpixie-java-1.1.6/examples/fjftest.wmf0000644000175000017500000000376611365605266016733 0ustar renerene×ÍÆšr*Â#¾JoQè˜F ؆ ­-L  ÿÿÿ .­-L ú8ÿ"-üÿÿ-ÐÐèè ú}ÿ"-ðü€ÿ- úúpˆ¸ èü€-ð ú€"-ðN$%„o­QÙ=28/h6•FÀ_åmà Œì   «H ­x ¦¨ –Õ }ÿ [$ çs¿‘’¥c±3³¬Öœ¬ƒ†`ýßöËÉÀš½jÅ;Õ î㽄o ú*€"-ðüÿÿ-ðx¨ ú*ÿ€"-ðd$0š ] Tí U aL w —³ Àè ò ,Œ ¸÷ _^¼ò ÌGœn_€~¨uêf$ SV : ž ø² м ¥º w® F˜ x à O «  t ã> ¡ W› °5 ñÖ ‡ DL s% °  h &, ì@ ºY ‘w rš ] ú§@Â"-ð °ø*ˆø*°0` ú}@Â"-ðü€- ü! ( (X $Ä XWd6 ò%Rò%1dÄ X$ Ä X} ÕWd "6 ò%Ä "$Rò%û"1d ÕÄ Xüÿÿ- úS@Â"-ð"$L x¸ °X<ôhŒ ø„X„È@„ô˜èl Ä L` L L $ Ä" ”*Œ \+0*4)° ( Ä" úR@Â"-ð†$Áƒ«œâ¼2ä™E¨}K»ÿýÂD“pÙV(EÌ5s3â)€/¹G Pi  ô² ÖÌÆÕÊQÕÅå2ý–ñC@r„ª¼ëç6‹áE-wq±«ôÞ< Š0ÚO%¤9Ò”é±öÀÁ³-“GaeÀµÅ“[¤»à Fh Ò´ ú Q8!DU!=o!Bž!N´!_Ç!ç!Ñÿ!"y"Ù"? "¥ú! ß!k»!Ä!V!37!Q!kð €É ‘  ›t  F Ÿ ˜âŠ«tsV71ù¸Ët‹-BäI(÷5K“å âÎ IÏ Æå X þS ¶©€YŠA5°5[?RÛm¯²{Ûpo1v[†„œ©¸ÉÙâÿõ'þRüï­ÖÛ­u3+Vßižoii>X<ùëó¹õ€ÿ&|cõ²x t⩾ޣ’H|”­©ÝÌ ÿ2CWšx“ÏÂiîÕ<+N5_7p2€&Ÿß¼˜ÙBô+Àejƒ#£ãС__·r+ úT ãl Î} »ˆ ªŒ ›‰ Ž} ƒi {K rðugƒ«'ÿÿ¡__·r+ úT ãl Î} »ˆ ªŒ ›‰ Ž} libpixie-java-1.1.6/examples/Eg.wmf0000644000175000017500000006073411365605266015617 0ustar renerene×ÍÆš(# ` ã0¾  . ÿÿÿ  (# úÿÿÿ"-ü´-$!ŒHŠ!üÿÿÿ-ðüµ-$!Q(÷¹ÀŒHŠ!-ðü¶-$ Qša›**ø§¹À(÷Q-ðü ·-$ šÿÈŒ]›/25§*ø›*aš-ðü ¸-$$ÿŒ *‹ó¿ f¢AÄ52›/]ŒÈÿ-ðü¹-($ŒQ7‡–PuîôÃ}|SÄ¢A f¿‹ó *Œ-ðüº-.$Q€  ^ß°ªwwIégöîÔ·ãS|}ôÃuî–P7‡Q-ðü»-6$€ ¹ #  Uh ‘2 Øþ*͆žít^MÚ*_ ïòtã·îÔgöéwIw°ª^ß € -ðü¼-D$ ¹ ‹I‹NT_zç  ² Ñ~ L R £ïþÅcŸÓ|M]ÐC^-õtïò_ Ú*^Mít†ž*ÍØþ‘2 Uh #  ¹ -ðü¼-J$#I‹Æ‹ËYÛ&öô à L” †f Ë; uìÙÊG«¿AyÌha[–õ^-ÐCM]Ó|cŸþÅ£ïR L Ñ~  ² zç _NTI‹-ðü ½-J$#Æ‹D‹I]Y/t˜Õ È© € FY ”5íOõ¼Ú2ò±;£Îš)–a[ÌhAy¿G«ÙÊuìË; †f L” à öô Û&ËYÆ‹-ðü##¾-J$#D‹Â‹Ça×8ñæ D¿ }š Àx We:Æ 1 ¥ö#è«Þ;Ù½)Κ;£²±2üÚOõí”5FY € È© ˜Õ tY/I]D‹-ðü&&¿-L$$‹@‹EfU@n’ø ÀÕ ø´ :– †zÜa<K¥8*•©@Q½;Ù«Þ#è¥ö1 Æ e: WÀx }š D¿ æ ñ×8Ça‹-ðü))À-N$%@‹½‹ÂjÑIë) ;ë rÎ ³´ þœS‡±vg‹\VˆTWª^åQ@©•*¥8<KÜa†z:– ø´ ÀÕ ’ø nU@Ef@‹-ðü--Á-N$%½‹;‹@oORh6‹ · îé .Ó x¿Ë®(¡Ž–þvø‚–¡|åª^WˆTV‹\g±vS‡þœ³´ rÎ ;ë  ë)ÑIÂj½‹-ðü00Â-N$%;‹¹‹¾sÍ[åC, 3 i ¨ñ ñâCÕžÌÅqÃçÄgÊïÕ€ä |¡‚–øvþŽ–(¡Ë®x¿.Ó îé · ‹ h6OR@o;‹-ðü33Ã-P$&¹‹7‹<wJccP„> ¯- ä " j »ü÷xõäöYüÖ\ë& ?«  €äïÕgÊçÄqÃÅžÌCÕñâ¨ñ i 3 , åCÍ[¾s¹‹-ðü66Ä-R$'7‹´‹¹|Çlß]O *B ^7 ›. â' 2#Š"ì$V)É2D@ÈRU ié …D « ?ë&\ÖYüäöxõ÷»üj " ä ¯- „> cPJc<w7‹-ðü99Å-R$'´‹2‹7€Eu\j}a §X ÚQ L [J ©JMaSÉ\:j´{6 ‘¿ «Q Ëß D é …U iÈRD@É2V)ì$Š"2#â' ›. ^7 *B O ß]Çl¹|´‹-ðü==Æ-T$(2‹°‹µ…Â~Ùwùr #n Uk k Ôm !qwxÕ‚<«¡# ¶£ Ð* îº Q :{ ß Q Ë¿ «6 ‘´{:jÉ\aSM©J[J L ÚQ §X }a \jEu7€2‹-ðü@@Ç-V$)°‹-‹2‰?†V…u„ ž„ Ï… ‰ L ˜—ì£I±®Â Ø‘ ñ ” 0! W¶ ƒ { Q :º * î£ Ð# ¶«¡<Õ‚wx!qÔm k Uk #n ùr ÙwÂ~µ…°‹-ðüCCÈ-X$*-‹«‹¯½Ó’ò• š J  „¨ Ų ¾cξà" ö  ,| Nÿ sŠ ž ͵ ¶  ¶ ƒ! W” 0 ‘ ñ Ø®ÂI±ì£˜—L ‰ Ï… ž„ u„ V…?†2‰-‹-ðüFFÉ-Z$+«‹)‹-’:˜PŸo§ –¯ ƺ þÆ ?Ô ˆåÙù3 • )þ Fp gé j ¶ò ä‚  PW ¶ µ  ÍŠ žÿ s| N , " ö¾àcξŲ „¨ J  š ò• Ó’½¯«‹-ðüIIÊ-Z$+)‹§‹«–¸¡Î¬ì¸ Å AÔ xå ¸÷ P $¨ > \p }ß ¢V ÌÕ ù[ +è a| ú W  P‚ ò äj ¶é p gþ F• )3 Ùùˆå?Ô þÆ Æº –¯ o§ PŸ:˜-’)‹-ðüMMË-\$,§‹$‹(›5ªJ¹gÊ Û »î ñ 0  w 3 Å O mz à ´M Ýà ? ; qM «Þ êv/ú | è a[ +Õ ùV Ìß ¢p } \¨ >P $ ¸÷ xå AÔ Å ì¸ Î¬¸¡«–§‹-ðüPPË-^$-$‹¢‹¦Ÿ³²ÇÆäÛ ñ 6  l ! © < î Z ; z œí ÂQ ë½ 0 Iª ~+ ·³ õA8×€Dv/Þ êM « q? ;à M Ýà ´z  mÅ Ow 3 0  ñ »î Û gÊ J¹5ª(›$‹-ðüSSÌ-`$.¢‹ ‹$ £0 »E Óa í …  ² " æ @ " _ f ² ¥ Ì` õ #, S ˆ Á“ þ?¥…7ÑÐ!íD×€A8³ õ+ ·ª ~0 I½ Q ëí  œ; zî Z © < l ! 6  ñ äÛ ÇÆ³²¦Ÿ¢‹-ðüVVÍ-b$/ ‹ž ‹¢ ¨® Ä áÞ þ   - = ` ^ › ‚ Þ ¨ ( Ðz ûÓ )4 Z›  Ç ü D‰Ó˜!-u™íÐ!7Ñ¥…?“ þ Á ˆ, S #` õ ̲ ¥f " _ æ @ ² " …  a í E Ó0 »$ £ ‹-ðüYYÎ-d$0ž ‹ ‹ ¬+ Í> îY | 2 § W Ù }  ¤ U Î ž ûî *E \¤ ‘ Év é FcŠäÓj ÷rŠÉ#%G™-u˜!Ó‰ü D  Ç› 4 ZÓ )z û( ÐÞ ¨ › ‚ ` ^ - =   Þ þ  á® Ä¢ ¨ž ‹-ðü\\Ï-f$1 ‹™ ‹ ±¨ Õ¼ ûÖ !ù H " q T › Œ Ç Í õ  & c Y¹  Èy ã ETˆÌÐJÎmXÃè}}ùG#%ŠÉ÷rj äÓcŠé Fv  ɤ ‘E \î *ž ûU Î  ¤ Ù } § W | 2 Y > î+ Í ¬ ‹-ðü``Ð-h$2™ ‹ ‹ µ& Þ9 S 3u ^ ž ‹ Î º  ê E  ‹ Q Ø ˆ, † ÿè @P„¿Ë4°g1»¸ErØÔp<¯ù}}èXÃÎmJÌÐTˆã Ey  ȹ c Y & Í õ Œ Ç T › " q ù H Ö !¼ û¨ Õ ±™ ‹-ðüccÑ-l$4 ‹• ‹™ ¹¤ ç¶ Ð Dñ t  ¥ H Ø  ¼ C  | L ·Ÿ õø 6W{¾Ã*]±” e£Æ3,È—bi¯p<ØÔEr¸1»°g4¿ËP„è @† ÿ, ÂØ ˆ‹ Q E   ê Î º ž ‹ u ^ S 39 & Þ µ ‹-ðüffÒ-n$5• ‹ ‹ ¾ ð2 "L Vl Š “ ¿ Á ö ÷ / 3 j v § À æ(hmƵ*”P£{ú÷Vyµƒñ¶d'ibÈ—3,£Æe” ±]*¾ÃW{ø 6Ÿ õL · | ¼ C  H Ø  ¥ ñ t Ð D¶ ¤ ç™ ¹• ‹-ðüiiÓ-p$6 ‹ ‹” ž ø° /È gè    Ù <  p R « ‘ í Ò 5 „[Ù¤5ñ—@ÿ“mêáDZ£Ù^nçÚvK ¢=ì'¶dñƒyµ÷V{ú£”P*Ƶhm(À æv § 3 j ÷ / Á ö “ ¿ l Š L V2 " ð ¾ ‹-ðüllÔ-t$8 ‹ ‹ Æ - =E yd µ Š ô ¶ 3 é t #¸ cý ªD ÷Kܤ,jÖÕ0G޽ñ:W»ÂB2Φ^óž!·ì¢= ÂvKçÚ^nÙZ£áDmêÿ“—@5ñÙ¤„[5 í Ò « ‘ p R <   Ù è   È g° /ž ø”  ‹-ðüppÕ-x$: ‹Œ ‹ Ëš ª J Šà Ë  0R b— ›Þ Ú( t j¼gq¾Õ>w­Ø!>š¨‰%²}DþÚ…t‹·!óž^ΦB2»Â:W½ñGŽÕ0jÖ¤,KÜ÷ªD cý #¸ é t ¶ 3 Š ô d µ E y- =  Æ ‹-ðüssÖ-|$<Œ ‹ ‹ Ï'W>œ[á ( ªp Úº  OS “¢ Üõ,J‚¢Ýý?[¥¼"ƒ‹úøvjöà|ZÚ”^'ç¾vX f‹tÚ…Dþ²}%‰š¨!>­Ø>wÕq¾g¼jÂt Ú( ›Þ b— 0R  à Ë Â Šª Jš  ËŒ ‹-ðüvv×-€$> ‹‡‹ŠÔ”¤dº­×÷ úB $Ž TÜ Š, Å~ Ò P( ñÝK<©xlæÙ[IÓ¾Q7ÓµZ7å¿uJÜŸr9 OfX ¾v'ç”^Ú|Zöàvjúøƒ‹"¥¼?[Ýý‚¢,JÜõ“¢ OS  Úº ªp ( [á >œ'W Ï ‹-ðüyyØ-„$@‡‹‹Ø$!q7¿S v\ ž­ Íÿ S <© | Ã[ ¸`¸{àvIÞ¶J&»š1¬+¯•6®RBåÚ|xFO9 ŸrÜuJå¿Z7ÓµQ7Ó¾[IæÙxl©K<ñÝP( Ò Å~ Š, TÜ $Ž úB ×÷ º­¤d”ŠÔ‡‹-ðü||Ù-ˆ$B‹ƒ‹†Ü-Ÿ~´ÐÏ#ñv Ë F" yz ²Ô ñ0 6Ž €ïÐS%º#ßC­tëgçƒj󇀜§,C¿ãV‰ï4RF|xåÚRB®6¯•+¬1»šJ&Þ¶vIà¸{`¸Ã[ | <© S Íÿ ž­ v\ S 7¿!q$Ø‹-ðü€€Ú-Ž$Eƒ‹‹á 6‹0âK8k ’ê ¾D ð¡ (ÿ e_ ¨Á ð& >Ž‘øéeFÖ©IÁ{<ì»`=ÙÄWPØß]tå rªM”õ*¢ÂT] xRï4V‰¿ã,Cœ§‡€óƒjçgë­tCß#%ºÐS€ï6Ž ñ0 ²Ô yz F" Ë ñv Ï#´ÐŸ~-†Üƒ‹-ðüƒƒÚ-–$I‹~‹åŠ?˜™­óÇNæ«  7g hÇ ž* ÚŽ õ b] ­Éþ7T¨¯”sÜI»•1«­)@ª×0s¸D¸ÓbeùÆ‘*>ÆËx] ÂT*¢”õMrªå ]tØßWPÙÄ`=ì»{<Á©IFÖée‘ø>Žð& ¨Á e_ (ÿ ð¡ ¾D ’ê k K80â‹ 6á‹-ðü††Û-ž$M~‹ü‹ÿêG¦)CdbÅ †' °Š àî U O½ Ž( Ó•  kv¿ëctÞÖ\<Þ§cìˆzÿ z ø:zØÿ{‡#Ï €17ÄòY³ñyŠD&nËÆ*>‘ùÆeÓbD¸¸0sª×)@«­1»•IÜs”¯T¨þ7­Éb] õ ÚŽ ž* hÇ 7g  æ« ÇN­ó˜™Š?å~‹-ðü‰‰Ü-ª$Sü‹y‹|î„P’³¥¾zÜß ÿE (¬ W Š€ Ãì [ CÌ ‹? ص)-©Ú'9©œ.·oCßÓShÊEÃ>EãÉQ<Ûïh§÷dˆ'î±»HŒác{@ "² ö n&ŠDñyY³Äò17 €Ï‡#ÿ{zØø:z ÿ ˆzì§c<ÞÖ\tÞc¿ëkv Ó• Ž( O½ U àî °Š †' bÅ Cd)¦Gÿêü‹-ðüŒŒÝ-º$[y‹÷‹úòYÀ"(:Wù zc ¡Ï Î< « 7 tŽ ´ úz Eô”pçï@qœ÷ýa Ê›7.§Åa“ ¤‹K ø©^Ÿ*Ø·›GdØ2kÿÞ•», žÄ †\!sõ!fŽ"^'#['#ö ²  "{@ácHŒ±»îˆ'÷dh§ÛïQ<ÉEãÃ>EÊShßÓoC·œ.9©Ú'©)-ص‹? CÌ [ Ãì Š€ W (¬ ÿE Üß ¾z¥’³„P|îy‹-ðüÞ-¾$]÷‹u‹x÷bŒÍŸ9¶¦Òô‚ ò Fc wÖ ¬K çÁ &: iµ ²3 ÿ³P5¥»ÿD]п`%òމü#lÁàcW Ñ´OcÏQÍÖŠ]KçrÛÿªŽX¯6B Õ i!ðþ!ã“"Ü'#Ù'#[Ž"^õ!f\!sÄ †, ž•»ÿÞkØ2Gd·›*ØŸ^© ø‹K ¤“a§Å7.Ê›a ýœ÷@qçï”pEôúz ´ tŽ 7 « Î< ¡Ï zc Wù :"(ÀYúò÷‹-ðü““ß-¾$]u‹ó‹öûýk ÚK2¼N-n  ” ¾Š í !z Zô —q Ùð r iõ¸| c’¾!´JæãP½".Ç¡o‘̓Œ= û¾…Q&"°ø<ÒɲX –ç v!n"a—"Z'#W'#Ù“"Üþ!ãi!ðÕ B ¯6XŽÿªrÛç]KÖŠQÍÏOcÑ´W àclÁü#މ%ò¿`]ÐÿD¥»P5ÿ³²3 iµ &: çÁ ¬K wÖ Fc ò ô‚ Ò¶¦Ÿ9ŒÍbx÷u‹-ðü––à-¾$]ó‹p‹rzs†ç—\­ÑÈGç¿ 7 5° c, •© Ì' ¨ G+ ‹° Ó8 ÂqOÅßqzÙ¡==£Þ {)ëÕ^„Ô7LïÇ«DkÃ0EùÈÇL™Óp[Kã,m ø ûƒ!ê"Þœ"Ö'#Ô'#W—"Z"av!nç X –ɲ<Ò°ø&"Q…¾ ûŒ=ƒ‘Í¡o.ǽ"PæãJ´¾!c’ ¸|iõr Ùð —q Zô !z í ¾Š ” n  N-2¼K Úýköûó‹-ðü™™á-¾$]p‹î‹ðø|õn)çCbbÝ …Z ­× ÙW Ø ?Z xß ¶f øï >z ˆ Ö™(,~Â×\4ø”˜ø;^âÈŒ5:¤ì¢‹\{Üö£tnó=söéyÆþ§ƒ  !x‘!g"\ "T'#R'#Ôœ"Ö"Þƒ!êø ûm ã,[KÓpL™ÈÇEùÃ0DkÇ«LïÔ7^„ëÕ{) £Þ==Ù¡zqÅßqO ÂÓ8 ‹° G+ ¨ Ì' •© c, 5° 7 ç¿ ÈG­Ñ—\†çzsrp‹-ðüœœâ-¾$]î‹l‹nu…‘¥ý¾|Üû þ| %þ O‚  ²Ž ê %¡ e. ©½ ñO <ãŒzÞ5°PìóL™¯Bð ëUY ÊÉ=‰²N*£ã³š‰b—@ "™ !õž!å!"Ù¤"Ò'#Ð'#R "T"\‘!g !xƒ þ§yÆöésó=tnö£{Ü‹\¢¤ì5:ÈŒ^âø;”˜4ø×\~Â(,Ö™ˆ >z øï ¶f xß ?Z Ø ÙW ­× …Z bÝ Cb)çnõø|ðî‹-ðüŸŸã-¾$]l‹ê‹ì óŽþ ‘!:–VwŸ œ% Æ­ ó6 %Á [N •Ü Òm  Y• ¢- ïÇ?d’é§CM ö£cSÉ1½œx 6xùê¿]‰ÒWI*Á;Û¶º2 ž¯ …-!q«!b*"W©"P'#N'#Ф"Ò!"Ùž!å!õ™  "—@bš‰³£ã*²N=‰ÊÉY ëU ð¯BL™ìóP5°ÞŒz<ãñO ©½ e. %¡ ê ²Ž  O‚ %þ þ| Üû ¾|¥ý‘u…nl‹-ðü££ä-¾$]ê‹g‹ip–z‰¢)´°Ð8ïÁ L ;Ø ge —ô Ë…  ?¬ ~B ÁÛ v Q ŸµïXCþš§ôSQ°µkw%ÞâH£³g!/ûËtŸèw]SÔ4L Å >!í¸!Þ2"Ô­"Í'#Ë'#N©"P*"W«!b-!q¯ …2 ž¶º;ÛÁI*ÒW]‰ê¿xù 6œx1½ÉcS£ öCMé§’?dïÇ¢- Y•  Òm •Ü [N %Á ó6 Æ­ œ% wŸ V:–! ‘þóŽì ê‹-ðü¦¦å-¾$]g‹å‹çíŸø)´>/ÊJWhä ‹s ² Ü” ' =¼ rR ¬ë é… )" mÀ µb ÿ M¬žVòH±¢cþ\Ѿ!M‡îÖX¡Ão0@Ÿï€Ìó®f “Ú }P!jÅ!\;"Q±"K'#I'#Ë­"Í2"Ô¸!Þ>!íÅ L Ô4]SèwtŸËû!/³gH£Þâw%k°µQôSš§CþïXŸµQ v ÁÛ ~B ?¬  Ë… —ô ge ;Ø L ïÁ Ð8´°)‰¢zp–ig‹-ðü©©æ-¾$]å‹c‹ek¨u6ƒÅ•TªäÄuâš (. Qà ~Z ®ó â * TÈ ’h Ó ¯ `W « ø­I\óÄK|§7öd¸Æ})Föâ_µÊŒ6g£F (€ ð ùa!çÒ!ÙD"϶"É'#Ç'#I±"K;"QÅ!\P!jÚ }f “ó®€ÌïŸ0@ÃoX¡îÖ‡!M¾\Ñþ¢cH±òžVM¬ÿ µb mÀ )" é… ¬ë rR =¼ ' Ü” ² ‹s hä JW/Ê>´ø)íŸçå‹-ðü¬¬ç-¾$]c‹á‹ãé±òC×j&þ>”[*{Á ŸY Æó ñŽ * QÈ †i ¿ ú® 9U {ý À¨ U S ¡·ñlD$™ßñJ^¦#êdµÆƒ*U*õ]߯¿0 ¢š Š!us!dß!VM"Mº"G'#E'#Ƕ"ÉD"ÏÒ!Ùa!çð ù€  (£F6gÊŒ_µöâ)FÆ}d¸ö§7K|óÄI\ø­« `W ¯ Ó ’h TÈ * â ®ó ~Z Qà (. š âÄuªä•TƒÅu6k¨ec‹-ðü¯¯è-¾$]á‹^‹`#e¹oQ{茀 ¸²ÓLòç „ :! cÀ a ¿ ò§ )M bô žž ÞJ ø e© ­\ ø EÉ”„æB:ÆéCVŸ#ýó\ǽž xƒVè7N ´ !ð„!ßí!ÓU"É¿"Ä'#Â'#Eº"GM"Mß!Vs!d!uš Š0 ¢Æ¿]ßõ**Uƃdµê¦#J^ñ™ßD$ñl¡·S U À¨ {ý 9U ú® ¿ †i QÈ * ñŽ Æó ŸY {Á [*>”&þj×òCé±ãá‹-ðü³³é-¾$]^‹Ü‹Þ'ãÂì^øú–32ÐLojН ¯Q Öô ˜ .> _æ “ Ê; è A˜ I Ãý ³ Ol ™' åå4¥„h×.+÷‚ÃÚ’4e:íKîªÎ °l –Ï 2!l–!\ú!P^"GÃ"B'#@'#¿"ÄU"Éí!Ó„!ß!ð´ N è7ƒV x½ž\ÇýóŸ#CVéÆ:æB”„EÉø ­\ e© ø ÞJ žž bô )M ò§ ¿ a cÀ :! „ òç ÓL¸² Œ€{èoQe¹`#^‹-ðü¶¶é-¾$]Ü‹Z‹\+aËiku „¬–M¬ïÅ’á5Ú #€ I' rÏ žy Í% þÒ 3 j2 ¤å áš Q b §Æ í„ 6E  ÎΗnbÁ1kÖí‡veÑE. )‹ é úH!è§!Ù"Íg"ÅÇ"À'#¾'#@Ã"B^"Gú!P–!\2!lÏ l – °ªÎKîí:4eÚ’‚Ã+÷×.„h4¥åå™' Ol ³ Ãý I A˜ è Ê; “ _æ .> ˜ Öô ¯Q Н jLo2Ð3–øúì^ãÂÞ'Ü‹-ðü¹¹ê-¾$]Z‹Ø‹Ú0ÞÔçxòÂg& >´Y\w˜¯ ¼Z ã µ :d i ›È Ð| 3 Bë ~¦ ½b þ! Bâ ‡¦ Ïl 4 dÿ±ÍžQq£Gö Kü¡Ûø½P ¢© Š!v^!d¹!V"Kp"BÌ">'#<'#¾Ç"Àg"Å"ͧ!ÙH!èé ú‹ . )ÑEve‡Ã­kÖÁ1nb—ÎÎ 6E í„ §Æ b Q áš ¤å j2 3 þÒ Í% žy rÏ I' #€ Ú á5Å’¬ï–M„¬u ikaË\+Z‹-ðü¼¼ë-¾$]Ø‹U‹W4[Ýc…m.{׌ ,¶×Ѓí0 Þ . T> {ï ¦£ ÓW  5Æ j€ ¡; Ûù ¹ U{ •? × Î b™ ªg ó7 ? ‹ßÚ¸)’zpÌQ 4s È !ðs!ßÊ!Ñ!"Çy"¿Ð"»'#¹'#<Ì">p"B"K¹!V^!d!v© ŠP ¢ø½¡ÛKüö £GQqž±Ídÿ4 Ïl ‡¦ Bâ þ! ½b ~¦ Bë 3 Ð| ›È i :d µ ã ¼Z ˜¯ wY\>´& gÂòçxÞÔÚ0Ø‹-ðü¿¿ì-¾$]U‹Ó‹Ô9Ùåà’ê@÷í›J0ùHªc[ ¢À Åu ë* â >š kT › ÍÍ Œ 9M q ¬Õ é (f i1 ¬ÿ ðÏ 6¢ ~w ÆO ) \ ©å÷ÇF ¬• ”æ ~7!k‰![Ü!N."D"=Õ"8'#7'#¹Ð"»y"¿!"ÇÊ!Ñs!ß!ðÈ s  4ÌQzp)’Ú¸‹ß? ó7 ªg b™ Î × •? U{ ¹ Ûù ¡; j€ 5Æ  ÓW ¦£ {ï T> . Þ í0Ѓ¶× ,Œ{×m.c…[ÝW4U‹-ðüÂÂí-¾$]Ó‹Q‹R=Wî]ŸgQs‚µ”i©ÀÑÙ†ö<ô 6¬ Zf €! ©Ý Ô› Z 1 bÝ –¢ Ìh 0 >ú yÆ ·• öe 78 y ½ä ¾ Hš y ØZ " = m $ ¸ !øQ!æŸ!×í!Ë;"ÁŠ"»Ù"¶'#µ'#7Õ"8"=."DÜ!N‰![7!kæ ~• ”F ¬÷Ç©å\ ) ÆO ~w 6¢ ðÏ ¬ÿ i1 (f é ¬Õ q 9M Œ ÍÍ › kT >š â ë* Åu ¢À  c[Hª0ùJ›÷íê@à’ÙåÔ9Ó‹-ðüÆÆî-¾$]Q‹Î‹ÏAÓ÷Ú­ãbîýÏ ‡!?7÷O±jk‡&¦ã È  ì_  <à f£ “h Â. óõ &¿ [Š ‘W Ê& ÷ ?Ê |  »w ûP <,  Âë  Î M ³ “ › Û … #!q k!a µ!R þ!G I"> “"7 Ý"3 '#2 '#µÙ"¶Š"»;"Áí!ËŸ!×Q!æ!ø¸ m $ " = ØZ y Hš ¾ ½ä y 78 öe ·• yÆ >ú 0 Ìh –¢ bÝ 1 Z Ô› ©Ý €! Zf 6¬ ô ö<Ù†ÀÑ©”i‚µsgQ]ŸWîR=Q‹-ðüÉÉï-¾$]΋L‹MFQWº`tk/xꈥša®ÅÜßšúZ7Û Zž ~b ¤' Ìí ÷µ # QJ  ²å æµ ‡ Q[ ‰0 à þâ :¾ w› ¶| ö^ 6 C x ) º  ý þ A!ì †!Ü Ë!Ï "Ä V"» œ"µ â"± '#° '#2 Ý"3 “"7 I"> þ!G µ!R k!a #!q Û … “ › M ³  Î Âë  <, ûP »w |  ?Ê ÷ Ê& ‘W [Š &¿ óõ Â. “h f£ <à  ì_ È  ¦ã ‡&jkO±7÷!? ‡ýÏîãbÚ­Ó÷ÏA΋-ðüÌÌð-¾$]L‹Ê‹ËJÏÔÇ܆çDóÄ„&E<SÉm‰Q§ÇÝ é¥ m 27 Z ƒÐ ®ž Ûn ? : lç Ÿ¾ Ó– p AM y+ ³ íí ) Ñ e · £   á Š !w `!f  !W à!K ""@ c"8 ¤"3 æ"/ '#. '#° â"± œ"µ V"» "Ä Ë!Ï †!Ü A!ì ý þ º  x ) 6 C ö^ ¶| w› :¾ þâ à ‰0 Q[ ‡ æµ ²å  QJ # ÷µ Ìí ¤' ~b Zž 7Û úZßšÅÜ®šaˆ¥xêk/`tWºQMFL‹-ðüÏÏñ-¾$]Ê‹H‹IOLRÔY—cZn|⌧žl²2ÈùàÀúˆR4Sç u´ ˜ ½P ä! ò 6Å aš Žp ½H ì! ü PÙ ƒ· ¸˜ îz $ ^ \ D • , Î  ! C!ð ~!à º!Ò ö!Ç 3"½ p"¶ ­"° ë"­ '#¬ '#. æ"/ ¤"3 c"8 ""@ à!K  !W `!f !w á Š £   e · ) Ñ íí ³ y+ AM p Ó– Ÿ¾ lç : ? Ûn ®ž ƒÐ Z 27 m é¥ ÇÝ §‰QmSÉ<&E„ÄóçD܆ÔÇÏËJÊ‹-ðüÒÒò-¾$]H‹Å‹ÆSÉÎáÕ¨Þpé8öÉ“(]<(Rój¿„Œ [½*Ýú ýË  Dq iF  ¸ô âÍ ¨ 9„ ga –A Æ! ÷ ( è [ Î ¶ Ä   ù Œ /!y e!h œ!Z Ô!M "B D"9 }"2 ¶"- ï"* '#) '#¬ ë"­ ­"° p"¶ 3"½ ö!Ç º!Ò ~!à C!ð ! Î  • , \ D $ ^ îz ¸˜ ƒ· PÙ ü ì! ½H Žp aš 6Å ò ä! ½P ˜ u´ Sç 4RúˆàÀÈù²2žlŒ§|âncZY—RÔLIOH‹-ðüÖÖó-¾$]Å‹C‹DWG#KîRºZ†dRp}캞ˆ±WÅ&Ü÷ôÈ š(lE@cƒë ¤ Çš êt N 6+ ^ ‡ç ±Ç Ü©  Œ 6 q d X “ @  ) ó  $! V!ñ ˆ!á »!Ô î!È ""¾ V"¶ Š"¯ ¿"« ó"¨ '#§ '#) ï"* ¶"- }"2 D"9 "B Ô!M œ!Z e!h /!y ù Œ Ä   ¶ [ Î ( è ÷ Æ! –A ga 9„ ¨ âÍ ¸ô  iF Dq  ýË Ýú ½* [„Œj¿Ró<((]“Éöé8ÞpÕ¨ÎáÉÆSÅ‹-ðüÙÙô-¾$]C‹Á‹Â\Ä,ÉûÎÌÖœßlê=÷á³&†9YM.czÙ“¯­‡É_æ9$ï EË g© ‹ˆ ¯i ÕJ û- #  K ÷ u Þ Ÿ Ç Ê ± õ "!Š O!x }!i «![ Ù!N "C 8": h"2 —"- È"( ø"& '#% '#§ ó"¨ ¿"« Š"¯ V"¶ ""¾ î!È »!Ô ˆ!á V!ñ $! ó   ) “ @ d X 6 q  Œ Ü© ±Ç ‡ç ^ 6+ N êt Çš ¤ ƒë cE@(l šôÈÜ÷Å&±Wžˆº}ìpdRZ†RºKîG#DWC‹-ðüÜÜõ-¾$]Á‹?‹@`B4F KÝR²Z‡d\p2}‹Þ›µ¬¾eÒ>çþòÍ/©I†ed‚C #¿ßæ É " ­ E “ i z Ž b ´ K Ú 6 !" )! Q!ÿ z!ï ¤!á Î!Ô ø!È #"¾ N"¶ y"¯ ¥"ª Ð"¦ ü"¤ '#£ '#% ø"& È"( —"- h"2 8": "C Ù!N «![ }!i O!x "!Š õ Ê ± Ÿ Ç u Þ K ÷ #  û- ÕJ ¯i ‹ˆ g© EË $ï æ9É_­‡“¯zÙcM.9Y&†³á÷ê=ßlÖœÎÌÉûÄ,Â\Á‹-ðüßßö-¾$]?‹¼‹½d¿=ÂÇîÍÇÕ¡ÞzèTó. äÀ/œ@yTVh4~”ó¬ÓÅ´ß—úz ^3 CP )o  ø ¯ â Ð Ì ò ¸ !¤ 8!“ \!‚ €!r ¥!d Ê!W ð!L "B ="9 c"1 Š"+ ²"& Ù"# #! '# '#£ ü"¤ Ð"¦ ¥"ª y"¯ N"¶ #"¾ ø!È Î!Ô ¤!á z!ï Q!ÿ )! !" Ú 6 ´ K Ž b i z E “ " ­ É ßæ ¿ #‚CedI†/©ÍþòçÒ>¾e¬›µ‹Þ}p2d\Z‡R²KÝF B4@`?‹-ðüââ÷-¾$]¼‹:‹;i<F@#DIÝP»X™awkUw4ƒ‘ó Ó°´Á•ÓwæYú= !% < ëT Ñm ¸‡  ¡ ‰½ sÙ ^õ J!71!%P!o!!õ ¯!ç Ð!Û ñ!Ï "Å 5"¼ W"´ y"­ œ"¨ ¿"¤ â"  #Ÿ '#ž '# #! Ù"# ²"& Š"+ c"1 ="9 "B ð!L Ê!W ¥!d €!r \!‚ 8!“ !¤ ò ¸ Ð Ì ¯ â ø o P )3 C ^úzß—Å´¬Ó”ó~h4TV@y/œÀä ó.èTÞzÕ¡ÍÇÇî¿=½d¼‹-ðüææø-¾$]:‹¸‹¹mºO½0ÁÅóËÕÒ·Ú™ã|í_øB &  ï. Ô> ºN  ` ‡s n† Vš ?¯ )Å Û þò ê !×#!ÄS"6q"/")®"%Ì"!ë" #'#'#ž #Ÿ â"  ¿"¤ œ"¨ y"­ W"´ 5"¼ "Å ñ!Ï Ð!Û ¯!ç !õ o!P!1!%!7õ JÙ ^½ s¡ ‰‡  m ¸T Ñ< ë%  !ú=æYÓwÁ•°´ Ó‘óƒw4kUawX™P»IÝD@#<F;i:‹-ðüééø-¾$]¸‹6 ‹6 r8 W: == #A F ïL ÖS ¼[ £c Šm rw Y‚ AŽ *› © ü· æÆ ÑÖ ¼æ §ø “ !€!n/!\C!JX!:m!*‚!˜! ¯!ÿÆ!òÝ!æõ!Û"Ñ&"Ç?"¿X"·r"°‹"ª¥"¥¿"¡Ù"žó"œ#š'#š'# #ë"Ì"!®"%")q"/S"65">"Gû!QÞ!\Â!h¦!u‹!ƒp!’V!¢ º. Ô ï  &øBí_ã|Ú™Ò·ËÕÅóÁ½0ºO¹m¸‹-ðüììù-¾$]6 ‹³ ‹³ vµ `¶ J¹ 4½ Á Æ ôË ßÒ ÊÙ µá  é Œó xý e!R!?!,+!8! F!øU!çd!×s!ȃ!¹”!ª¥!œ¶!È!ƒÛ!wî!k"a"W("M<"EQ"=f"6{"/"*¥"%»"!Ð"æ"ü"#'#'#š#šó"œÙ"ž¿"¡¥"¥‹"ªr"°X"·?"¿&"Ç"Ñõ!ÛÝ!æÆ!ò¯!ÿ˜! ‚!m!*X!:C!J/!\!n !€ø “æ §Ö ¼Æ Ñ· æ© ü› Ž *‚ Aw Ym rc Š[ £S ¼L ÖF ïA = #: =8 W6 r6 ‹-ðüïïú-¾$]³ ‹1!‹1!z2!i4!W6!F9!5º!1¾!$Á!Æ! Ê!ÿÐ!óÕ!çÛ!Ûâ!Ðè!Äï!¹÷!®ÿ!¤"š""†""},"t6"k@"cJ"[U"S`"Ll"Fw"?ƒ"9"4›".§"*³"%À""Í"Ú"ç"ô"###'#'#•#•#–ó"˜â"šÑ"¿" ®"¤"¨"®|"³l"º["ÀL"È<"Ð-"Ø"á"ë"õò!å! ×!Ë!"¾!/²!;§!Iœ!V‘!d‡!s}!t!‘l! d!°\!¿V!ÐO!àJ!ñD!@!<"6?".C"&F"J"O"S"X"]"øb"ñh"ëm"äs"Þz"×€"ч"Ì"Æ”"Áœ"¼£"·«"³²"®º"ªÂ"§Ê"£Ò" Ú"ã"›ë"˜ô"–ü"•#“#’#’#‘'#‘'####ô"ç"Ú"Í"À""³"%§"*›"."4ƒ"9w"?l"F`"LU"SJ"[@"c6"k,"t""}"†""šÿ!¤÷!®ï!¹è!Äâ!ÐÛ!ÛÕ!çÐ!óÊ!ÿÆ! Á!¾!$º!1·!>µ!K³!X±!e°!r¯!¯!‹-ðüùùý-¾$]-"‹ª"‹ª"ˆª"ƒ«"«"z¬"v­"r®"n¯"i°"e²"a³"]µ"Y·"U¹"Q»"M½"IÀ"FÂ"BÅ">Ç";Ê"8Í"4Ð"1Ô".×"+Ú")Þ"&â"$å"!é"í"ñ"õ"ù"ý"## ######$#'#'#‘#‘#’#’#“ü"•ô"–ë"˜ã"›Ú"Ò" Ê"£Â"§º"ª²"®«"³£"·œ"¼”"Á"Ƈ"Ì€"Ñz"×s"Þm"äh"ëb"ñ]"øX"S"O"J"F"C"&?".<"69">7"G4"O2"X1"`/"i."r."z-"ƒ-"‹-ðüüüþ-d$0ª"‹'#‹'#$###### ###ý"ù"õ"ñ"í"é"å"!â"$Þ"&Ú")×"+Ô".Ð"1Í"4Ê"8Ç";Å">Â"BÀ"F½"I»"M¹"Q·"Uµ"Y³"]²"a°"e¯"i®"n­"r¬"v«"z«"ª"ƒª"ˆª"‹-ðü--%'#'#‹‹--û– A¼Times New Roman- ÿ.2 j ÄPixie€h)ho .û¼"Systemn-ðûàμ Arial¯- .-2 ”~Tiny Pictures for the Webwïwwï¨ïïw¨wïw–ï .-ðlibpixie-java-1.1.6/examples/test.wmf0000644000175000017500000001015011365605266016226 0ustar renerene×ÍÆš$mVTì g )-  VT$m.ú(-ü->LØ3 <â>L|g <Å8"»gÅ8A"Ø3nâ.ûcù¼"Arialõwøòwÿÿÿÿ¸òÙçîw -2 ³)6Metafile Companion Test Chartþ.û?ý¼"Arialõwøòwÿÿÿÿ¸òÙçîw -ð 2 ,AObjectsº 2 ,E;Colors 2 )=E;Advanced 2 %=…Fillsþú-ðÔ?Ü« fJÁJ! ¶.û?ýÈ"Arialõwøòwÿÿÿÿ¸òÙçîw -ð 2 nD¿aRotatedº.û?ý"Arialõwøòwÿÿÿÿ¸òÙçîw -ð 2 8Å,Textú-ðüÀÀÀ-ð8ëQBFÓU¢@“YBFWSžE¿U BXžE“TÊD«U*C¿VÊDú-ð|1Í|1ýú-ð˜-͘-ýú-ð´)©´)Ùú-ð”+©”+Ùú-ðx/Íx/ýú-ðü-ðòHeYDÌ ü-ðòH`YDÇ-B( ÿÿÿï÷ûýþýû÷-ðUC9)¼> $üÿ-ðÃÑ^ Zü€-ðÃÖX |*ü-ðòH\YD£üÿÿ-ðÃÍd `úx-ðx-x-Í!ú-ð”)y”)©!ú<-ðt+yt+©!ú´-ðX/X/Í!úð-ð\1\1Í!ú-ðü-ðUCe¼>Ì ü-ðUC‰ ¼>Ðü-ðUC`¼>Çü-ðUC\¼>£üÿÿÿ-ð¤¥F  Bü-ð¤É@ <ü€€€-ð¤¡L Hüÿ-ð¤œR ãMü-ðòH‰ YDÐú-ð %à Úoæ/>w%÷ Dû Dü-ð$y$Hy$”¹&Œ9*ŒÕ)”™'¬ú(-ðÃ6Ø3ï&âû?ý¼"Arialõwøòwÿÿÿÿ¸òÙçîw -ð 2 ô'©Linesþ 7|gï&Å8 2 (i;Fontsþ 2 ä,ÁTBoldû?ý"Courier Newÿÿÿÿ¸òÙçîw -ð 2 œ3U Underlineþû?ý"Times New Roman¸òÙçîw -ð 2 0áTItalicû?ý"Arialõwøòwÿÿÿÿ¸òÙçîw -ð 2 Ä,e;Arialþû?ý"Times New Roman¸òÙçîw -ð2 0A;Times New Romanºû?ý"Courier Newÿÿÿÿ¸òÙçîw -ð 2 œ3e; Courier Newºÿÿú-ðüÿ-ð¦Eª@î@ñ;üÿÿ-ð¬DLô?ÕEÿÿÿü-ðCFØHŠAáCCFuNŠAÜI.ûYþTimes New Roman¸òÙçîw -ð 2 žJóaText 2 âH³aRotatedº. 2 öH: Background 2 ²J{<Colorþ 2 IÛRComplexº 2 ¾JkSPolygonº 2 öH·D Transparency. 2 è3© Patterns. 2 4© Thicknessþ.2 K*Bitmap Fill Patterns2 ùJ1Basic Fill Patternsº.ú-ð-B( ÿÿÿÿÿÿþþþþà-ðòH9)YD $-B( ÿÿÿþüøðàÀ€-ðòH’/YD|*ú-ðüÿÿÿ-ðû¼SystemwH(ó(€÷¤êîw-ðlibpixie-java-1.1.6/common_build.xml0000644000175000017500000020225611365605266016121 0ustar renerene ------------------------------------------------------------------------------- Common Build file provides tasks needed to perform a project build. It is typically not used directly but imported by each project's build.xml file. The build.xml file can override tasks when customization is required. MAIN TARGETS ============ * clean / clean-all : remove all artifacts of the build, clean-all adds the removal of any library or jar dependencies downloaded as part of the build * resolve : download/refresh library or jar dependencies needed for the build (uses Apache IVY) * compile : run javac on the project's source * jar : creates a jar file * dist : creates all project distributables * test : runs JUnit tests from your project's test source SPECIAL TARGETS ============ * publish-local : builds a jar for your project and registers it with the local artifact repository isolated to your machine at $HOME/.ivy2/local. Further executions of the the resolve target by this or other projects will find your published jar. * ivy-clean* : this family of targets helps reset your IVY environment in the event that you are having difficulty resolving dependencies TYPICAL TARGET SEQUENCE ============ * clean-all resolve dist : a good start to build all project distributables from scratch. Note that jar dependencies will not be downloaded unless you explicitly run the resolve target. We made the resolution and retrieval completely discretionary since there are many situations in which you will not want to get or refresh dependencies, e.g. if you are offline with no Internet access. In such case, you could just run "dist" if the set of jars you already have are sufficient. libpixie-java-1.1.6/.project0000644000175000017500000000060011365605264014362 0ustar renerene libpixie org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature libpixie-java-1.1.6/ant/0000755000175000017500000000000011365605264013501 5ustar renerenelibpixie-java-1.1.6/ant/build-lib.xml0000644000175000017500000006224211365605264016074 0ustar renerene libpixie-java-1.1.6/ivy.xml0000644000175000017500000000143211365605266014252 0ustar renerene libpixie-java-1.1.6/build.xml0000644000175000017500000000323511365605266014545 0ustar renerene This build file is used to create the API project and works with the common_build.xml file. libpixie-java-1.1.6/build.properties0000644000175000017500000000030211365605266016131 0ustar renereneproject.revision=1.1-SNAPSHOT ivy.artifact.group=pentaho-library ivy.artifact.id=libpixie impl.title=Libpixie impl.productID=libpixie src.dir=${basedir}/source dependency.libbase.revision=1.1.6