import org.apache.poi.util.LittleEndianInputStream;\r
\r
public class WmfBitmap16 {\r
+ final boolean isPartial;\r
int type;\r
int width;\r
int height;\r
int planes;\r
int bitsPixel;\r
\r
+ public WmfBitmap16() {\r
+ this(false);\r
+ }\r
+ \r
+ public WmfBitmap16(boolean isPartial) {\r
+ this.isPartial = isPartial;\r
+ }\r
+ \r
public int init(LittleEndianInputStream leis) throws IOException {\r
// A 16-bit signed integer that defines the bitmap type.\r
type = leis.readShort();\r
// An 8-bit unsigned integer that defines the number of adjacent color bits on \r
// each plane.\r
bitsPixel = leis.readUByte();\r
+\r
+ int size = 2*LittleEndianConsts.BYTE_SIZE+4*LittleEndianConsts.SHORT_SIZE;\r
+ if (isPartial) {\r
+ // Bits (4 bytes): This field MUST be ignored.\r
+ long skipSize = leis.skip(LittleEndianConsts.INT_SIZE);\r
+ assert(skipSize == LittleEndianConsts.INT_SIZE);\r
+ // Reserved (18 bytes): This field MUST be ignored.\r
+ skipSize = leis.skip(18);\r
+ assert(skipSize == 18);\r
+ size += 18+LittleEndianConsts.INT_SIZE;\r
+ }\r
\r
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);\r
- int size = 2*LittleEndianConsts.BYTE_SIZE+4*LittleEndianConsts.SHORT_SIZE;\r
\r
int size2 = 0;\r
byte buf[] = new byte[widthBytes];\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_DIBCREATEPATTERNBRUSH record creates a Brush Object with a\r
- * pattern specified by a DeviceIndependentBitmap (DIB) Object \r
- */\r
-public class WmfDibCreatePatternBrush implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines the brush style. The legal values for this\r
- * field are defined as follows: if the value is not BS_PATTERN, BS_DIBPATTERNPT MUST be\r
- * assumed.\r
- */\r
- public static enum BrushStyle {\r
- /**\r
- * A brush that paints a single, constant color, either solid or dithered.\r
- */\r
- BS_SOLID(0x0000),\r
- /**\r
- * A brush that does nothing. Using a BS_NULL brush in a graphics operation\r
- * MUST have the same effect as using no brush at all.\r
- */\r
- BS_NULL(0x0001),\r
- /**\r
- * A brush that paints a predefined simple pattern, or "hatch", onto a solid background.\r
- */\r
- BS_HATCHED(0x0002),\r
- /**\r
- * A brush that paints a pattern defined by a bitmap, which MAY be a Bitmap16\r
- * Object or a DeviceIndependentBitmap (DIB) Object.\r
- */\r
- BS_PATTERN(0x0003),\r
- /**\r
- * Not supported\r
- */\r
- BS_INDEXED(0x0004),\r
- /**\r
- * A pattern brush specified by a DIB.\r
- */\r
- BS_DIBPATTERN(0x0005),\r
- /**\r
- * A pattern brush specified by a DIB.\r
- */\r
- BS_DIBPATTERNPT(0x0006),\r
- /**\r
- * Not supported\r
- */\r
- BS_PATTERN8X8(0x0007),\r
- /**\r
- * Not supported\r
- */\r
- BS_DIBPATTERN8X8(0x0008),\r
- /**\r
- * Not supported\r
- */\r
- BS_MONOPATTERN(0x0009);\r
- \r
- int flag;\r
- BrushStyle(int flag) {\r
- this.flag = flag;\r
- }\r
- \r
- static BrushStyle valueOf(int flag) {\r
- for (BrushStyle bs : values()) {\r
- if (bs.flag == flag) return bs;\r
- }\r
- return null;\r
- }\r
- }\r
- \r
- BrushStyle style;\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines whether the Colors field of a DIB\r
- * Object contains explicit RGB values, or indexes into a palette.\r
- * \r
- * If the Style field specifies BS_PATTERN, a ColorUsage value of DIB_RGB_COLORS MUST be\r
- * used regardless of the contents of this field.\r
- * \r
- * If the Style field specified anything but BS_PATTERN, this field MUST be one of the values:\r
- * DIB_RGB_COLORS = 0x0000,\r
- * DIB_PAL_COLORS = 0x0001,\r
- * DIB_PAL_INDICES = 0x0002\r
- */\r
- int colorUsage;\r
- \r
- WmfBitmapDib patternDib;\r
- WmfBitmap16 pattern16;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.dibCreatePatternBrush;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- style = BrushStyle.valueOf(leis.readUShort());\r
- colorUsage = leis.readUShort();\r
- int size = 2*LittleEndianConsts.SHORT_SIZE; \r
- switch (style) {\r
- case BS_SOLID:\r
- case BS_NULL:\r
- case BS_DIBPATTERN:\r
- case BS_DIBPATTERNPT:\r
- case BS_HATCHED:\r
- patternDib = new WmfBitmapDib();\r
- size += patternDib.init(leis);\r
- break;\r
- case BS_PATTERN:\r
- pattern16 = new WmfBitmap16();\r
- size += pattern16.init(leis);\r
- break;\r
- case BS_INDEXED:\r
- case BS_DIBPATTERN8X8:\r
- case BS_MONOPATTERN:\r
- case BS_PATTERN8X8:\r
- throw new RuntimeException("pattern not supported");\r
- }\r
- return size;\r
- }\r
-}\r
import org.apache.poi.util.LittleEndianInputStream;\r
\r
public class WmfDraw {\r
+ /**\r
+ * The META_MOVETO record sets the output position in the playback device context to a specified\r
+ * point.\r
+ */\r
+ public static class WmfMoveTo implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit signed integer that defines the y-coordinate, in logical units.\r
+ */\r
+ int y;\r
+ \r
+ /**\r
+ * A 16-bit signed integer that defines the x-coordinate, in logical units.\r
+ */\r
+ int x;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.moveTo;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ y = leis.readShort();\r
+ x = leis.readShort();\r
+ return 2*LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+ \r
/**\r
* The META_LINETO record draws a line from the drawing position that is defined in the playback\r
* device context up to, but not including, the specified point.\r
}\r
}\r
\r
+ /**\r
+ */\r
public static class WmfStretchBlt implements WmfRecord {\r
- /**\r
- */\r
- \r
/**\r
* A 32-bit unsigned integer that defines how the source pixels, the current brush\r
* in the playback device context, and the destination pixels are to be combined to form the new \r
}\r
}\r
\r
+ /**\r
+ * The META_STRETCHDIB record specifies the transfer of color data from a\r
+ * block of pixels in deviceindependent format according to a raster operation,\r
+ * with possible expansion or contraction.\r
+ * The source of the color data is a DIB, and the destination of the transfer is\r
+ * the current output region in the playback device context.\r
+ */\r
+ public static class WmfStretchDib implements WmfRecord {\r
+ /**\r
+ * A 32-bit unsigned integer that defines how the source pixels, the current brush in\r
+ * the playback device context, and the destination pixels are to be combined to\r
+ * form the new image.\r
+ */\r
+ WmfTernaryRasterOp rasterOperation;\r
+\r
+ /**\r
+ * A 16-bit unsigned integer that defines whether the Colors field of the\r
+ * DIB contains explicit RGB values or indexes into a palette.\r
+ * This value MUST be in the ColorUsage Enumeration:\r
+ * DIB_RGB_COLORS = 0x0000,\r
+ * DIB_PAL_COLORS = 0x0001,\r
+ * DIB_PAL_INDICES = 0x0002\r
+ */\r
+ int colorUsage;\r
+ /**\r
+ * A 16-bit signed integer that defines the height, in logical units, of the\r
+ * source rectangle.\r
+ */\r
+ int srcHeight;\r
+ /**\r
+ * A 16-bit signed integer that defines the width, in logical units, of the\r
+ * source rectangle.\r
+ */\r
+ int srcWidth; \r
+ /**\r
+ * A 16-bit signed integer that defines the y-coordinate, in logical units, of the\r
+ * source rectangle.\r
+ */\r
+ int ySrc;\r
+ /**\r
+ * A 16-bit signed integer that defines the x-coordinate, in logical units, of the \r
+ * source rectangle.\r
+ */\r
+ int xSrc;\r
+ /**\r
+ * A 16-bit signed integer that defines the height, in logical units, of the \r
+ * destination rectangle.\r
+ */\r
+ int destHeight;\r
+ /**\r
+ * A 16-bit signed integer that defines the width, in logical units, of the \r
+ * destination rectangle.\r
+ */\r
+ int destWidth;\r
+ /**\r
+ * A 16-bit signed integer that defines the y-coordinate, in logical units, of the \r
+ * upper-left corner of the destination rectangle.\r
+ */\r
+ int yDst;\r
+ /**\r
+ * A 16-bit signed integer that defines the x-coordinate, in logical units, of the \r
+ * upper-left corner of the destination rectangle.\r
+ */\r
+ int xDst;\r
+ /**\r
+ * A variable-sized DeviceIndependentBitmap Object (section 2.2.2.9) that is the \r
+ * source of the color data.\r
+ */\r
+ WmfBitmapDib dib;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.stretchDib;\r
+ }\r
+ \r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ int rasterOpIndex = leis.readUShort();\r
+ int rasterOpCode = leis.readUShort();\r
+ \r
+ rasterOperation = WmfTernaryRasterOp.fromOpIndex(rasterOpIndex);\r
+ assert(rasterOpCode == rasterOperation.opCode);\r
+\r
+ colorUsage = leis.readUShort();\r
+ srcHeight = leis.readShort();\r
+ srcWidth = leis.readShort();\r
+ ySrc = leis.readShort();\r
+ xSrc = leis.readShort();\r
+ destHeight = leis.readShort();\r
+ destWidth = leis.readShort();\r
+ yDst = leis.readShort();\r
+ xDst = leis.readShort();\r
+ \r
+ int size = 11*LittleEndianConsts.SHORT_SIZE;\r
+ dib = new WmfBitmapDib();\r
+ size += dib.init(leis);\r
+ return size;\r
+ } \r
+ }\r
+ \r
public static class WmfBitBlt implements WmfRecord {\r
\r
/**\r
return size;\r
}\r
}\r
+\r
+ public static class WmfDibStretchBlt implements WmfRecord {\r
+ /**\r
+ * A 32-bit unsigned integer that defines how the source pixels, the current brush\r
+ * in the playback device context, and the destination pixels are to be combined to form the\r
+ * new image. This code MUST be one of the values in the Ternary Raster Operation Enumeration.\r
+ */\r
+ WmfTernaryRasterOp rasterOperation;\r
+ /**\r
+ * A 16-bit signed integer that defines the height, in logical units, of the source rectangle.\r
+ */\r
+ int srcHeight;\r
+ /**\r
+ * A 16-bit signed integer that defines the width, in logical units, of the source rectangle.\r
+ */\r
+ int srcWidth;\r
+ /**\r
+ * A 16-bit signed integer that defines the y-coordinate, in logical units, of the\r
+ * upper-left corner of the source rectangle.\r
+ */\r
+ int ySrc;\r
+ /**\r
+ * A 16-bit signed integer that defines the x-coordinate, in logical units, of the\r
+ * upper-left corner of the source rectangle.\r
+ */\r
+ int xSrc;\r
+ /**\r
+ * A 16-bit signed integer that defines the height, in logical units, of the\r
+ * destination rectangle.\r
+ */\r
+ int destHeight;\r
+ /**\r
+ * A 16-bit signed integer that defines the width, in logical units, of the\r
+ * destination rectangle.\r
+ */\r
+ int destWidth;\r
+ /**\r
+ * A 16-bit signed integer that defines the y-coordinate, in logical units,\r
+ * of the upper-left corner of the destination rectangle.\r
+ */\r
+ int yDest;\r
+ /**\r
+ * A 16-bit signed integer that defines the x-coordinate, in logical units,\r
+ * of the upper-left corner of the destination rectangle.\r
+ */\r
+ int xDest;\r
+ /**\r
+ * A variable-sized DeviceIndependentBitmap Object that defines image content.\r
+ * This object MUST be specified, even if the raster operation does not require a source.\r
+ */\r
+ WmfBitmapDib target;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.dibStretchBlt;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ boolean hasBitmap = (recordSize > ((recordFunction >> 8) + 3));\r
+\r
+ int size = 0;\r
+ int rasterOpIndex = leis.readUShort();\r
+ int rasterOpCode = leis.readUShort();\r
+ \r
+ rasterOperation = WmfTernaryRasterOp.fromOpIndex(rasterOpIndex);\r
+ assert(rasterOpCode == rasterOperation.opCode);\r
+\r
+ srcHeight = leis.readShort();\r
+ srcWidth = leis.readShort();\r
+ ySrc = leis.readShort();\r
+ xSrc = leis.readShort();\r
+ size = 6*LittleEndianConsts.SHORT_SIZE;\r
+ if (!hasBitmap) {\r
+ @SuppressWarnings("unused")\r
+ int reserved = leis.readShort();\r
+ size += LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ destHeight = leis.readShort();\r
+ destWidth = leis.readShort();\r
+ yDest = leis.readShort();\r
+ xDest = leis.readShort();\r
+ size += 4*LittleEndianConsts.SHORT_SIZE;\r
+ if (hasBitmap) {\r
+ target = new WmfBitmapDib();\r
+ size += target.init(leis);\r
+ }\r
+ \r
+ return size;\r
+ }\r
+ }\r
}\r
--- /dev/null
+package org.apache.poi.hwmf.record;\r
+\r
+import java.io.IOException;\r
+\r
+import org.apache.poi.util.LittleEndianConsts;\r
+import org.apache.poi.util.LittleEndianInputStream;\r
+\r
+public class WmfMisc {\r
+ /**\r
+ * The META_SAVEDC record saves the playback device context for later retrieval.\r
+ */\r
+ public static class WmfSaveDc implements WmfRecord {\r
+ public WmfRecordType getRecordType() { return WmfRecordType.saveDc; }\r
+\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ return 0;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETRELABS record is reserved and not supported.\r
+ */\r
+ public static class WmfSetRelabs implements WmfRecord {\r
+ public WmfRecordType getRecordType() { return WmfRecordType.setRelabs; }\r
+\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ return 0;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_RESTOREDC record restores the playback device context from a previously saved device\r
+ * context.\r
+ */\r
+ public static class WmfRestoreDc implements WmfRecord {\r
+ \r
+ /**\r
+ * nSavedDC (2 bytes): A 16-bit signed integer that defines the saved state to be restored. If this \r
+ * member is positive, nSavedDC represents a specific instance of the state to be restored. If \r
+ * this member is negative, nSavedDC represents an instance relative to the current state.\r
+ */\r
+ int nSavedDC;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.restoreDc;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ nSavedDC = leis.readShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETBKCOLOR record sets the background color in the playback device context to a\r
+ * specified color, or to the nearest physical color if the device cannot represent the specified color.\r
+ */\r
+ public static class WmfSetBkColor implements WmfRecord {\r
+ \r
+ WmfColorRef colorRef;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setBkColor;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ WmfColorRef colorRef = new WmfColorRef();\r
+ return colorRef.init(leis);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETBKMODE record defines the background raster operation mix mode in the playback\r
+ * device context. The background mix mode is the mode for combining pens, text, hatched brushes,\r
+ * and interiors of filled objects with background colors on the output surface.\r
+ */\r
+ public static class WmfSetBkMode implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines background mix mode.\r
+ * This MUST be either TRANSPARENT = 0x0001 or OPAQUE = 0x0002\r
+ */\r
+ int bkMode;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setBkMode;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ bkMode = leis.readUShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETLAYOUT record defines the layout orientation in the playback device context.\r
+ * The layout orientation determines the direction in which text and graphics are drawn\r
+ */\r
+ public static class WmfSetLayout implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines the layout of text and graphics.\r
+ * LAYOUT_LTR = 0x0000\r
+ * LAYOUT_RTL = 0x0001\r
+ * LAYOUT_BITMAPORIENTATIONPRESERVED = 0x0008\r
+ */\r
+ int layout;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setLayout;\r
+ }\r
+ \r
+ @SuppressWarnings("unused")\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ layout = leis.readUShort();\r
+ // A 16-bit field that MUST be ignored.\r
+ int reserved = leis.readShort();\r
+ return 2*LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETMAPMODE record defines the mapping mode in the playback device context.\r
+ * The mapping mode defines the unit of measure used to transform page-space units into\r
+ * device-space units, and also defines the orientation of the device's x and y axes. \r
+ */\r
+ public static class WmfSetMapMode implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines the mapping mode.\r
+ * \r
+ * The MapMode defines how logical units are mapped to physical units;\r
+ * that is, assuming that the origins in both the logical and physical coordinate systems\r
+ * are at the same point on the drawing surface, what is the physical coordinate (x',y')\r
+ * that corresponds to logical coordinate (x,y).\r
+ * \r
+ * For example, suppose the mapping mode is MM_TEXT. Given the following definition of that\r
+ * mapping mode, and an origin (0,0) at the top left corner of the drawing surface, logical\r
+ * coordinate (4,5) would map to physical coordinate (4,5) in pixels.\r
+ * \r
+ * Now suppose the mapping mode is MM_LOENGLISH, with the same origin as the previous\r
+ * example. Given the following definition of that mapping mode, logical coordinate (4,-5)\r
+ * would map to physical coordinate (0.04,0.05) in inches.\r
+ * \r
+ * This MUST be one of the following:\r
+ * \r
+ * MM_TEXT (= 0x0001):\r
+ * Each logical unit is mapped to one device pixel.\r
+ * Positive x is to the right; positive y is down.\r
+ * \r
+ * MM_LOMETRIC (= 0x0002):\r
+ * Each logical unit is mapped to 0.1 millimeter.\r
+ * Positive x is to the right; positive y is up.\r
+ *\r
+ * MM_HIMETRIC (= 0x0003):\r
+ * Each logical unit is mapped to 0.01 millimeter.\r
+ * Positive x is to the right; positive y is up.\r
+ *\r
+ * MM_LOENGLISH (= 0x0004):\r
+ * Each logical unit is mapped to 0.01 inch.\r
+ * Positive x is to the right; positive y is up.\r
+ * \r
+ * MM_HIENGLISH (= 0x0005):\r
+ * Each logical unit is mapped to 0.001 inch.\r
+ * Positive x is to the right; positive y is up.\r
+ * \r
+ * MM_TWIPS (= 0x0006):\r
+ * Each logical unit is mapped to one twentieth (1/20) of a point.\r
+ * In printing, a point is 1/72 of an inch; therefore, 1/20 of a point is 1/1440 of an inch.\r
+ * This unit is also known as a "twip".\r
+ * Positive x is to the right; positive y is up.\r
+ *\r
+ * MM_ISOTROPIC (= 0x0007):\r
+ * Logical units are mapped to arbitrary device units with equally scaled axes;\r
+ * that is, one unit along the x-axis is equal to one unit along the y-axis.\r
+ * The META_SETWINDOWEXT and META_SETVIEWPORTEXT records specify the units and the\r
+ * orientation of the axes.\r
+ * The processing application SHOULD make adjustments as necessary to ensure the x and y\r
+ * units remain the same size. For example, when the window extent is set, the viewport\r
+ * SHOULD be adjusted to keep the units isotropic.\r
+ *\r
+ * MM_ANISOTROPIC (= 0x0008):\r
+ * Logical units are mapped to arbitrary units with arbitrarily scaled axes.\r
+ */\r
+ int mapMode;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setMapMode;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ mapMode = leis.readUShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETMAPPERFLAGS record defines the algorithm that the font mapper uses when it maps\r
+ * logical fonts to physical fonts.\r
+ */\r
+ public static class WmfSetMapperFlags implements WmfRecord {\r
+ \r
+ /**\r
+ * A 32-bit unsigned integer that defines whether the font mapper should attempt to\r
+ * match a font's aspect ratio to the current device's aspect ratio. If bit 0 is\r
+ * set, the mapper selects only matching fonts.\r
+ */\r
+ long mapperValues;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setMapperFlags;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ mapperValues = leis.readUInt();\r
+ return LittleEndianConsts.INT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETROP2 record defines the foreground raster operation mix mode in the playback device\r
+ * context. The foreground mix mode is the mode for combining pens and interiors of filled objects with\r
+ * foreground colors on the output surface.\r
+ */\r
+ public static class WmfSetRop2 implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines the foreground binary raster\r
+ * operation mixing mode. This MUST be one of the values:\r
+ * R2_BLACK = 0x0001,\r
+ * R2_NOTMERGEPEN = 0x0002,\r
+ * R2_MASKNOTPEN = 0x0003,\r
+ * R2_NOTCOPYPEN = 0x0004,\r
+ * R2_MASKPENNOT = 0x0005,\r
+ * R2_NOT = 0x0006,\r
+ * R2_XORPEN = 0x0007,\r
+ * R2_NOTMASKPEN = 0x0008,\r
+ * R2_MASKPEN = 0x0009,\r
+ * R2_NOTXORPEN = 0x000A,\r
+ * R2_NOP = 0x000B,\r
+ * R2_MERGENOTPEN = 0x000C,\r
+ * R2_COPYPEN = 0x000D,\r
+ * R2_MERGEPENNOT = 0x000E,\r
+ * R2_MERGEPEN = 0x000F,\r
+ * R2_WHITE = 0x0010\r
+ */\r
+ int drawMode;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setRop2;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ drawMode = leis.readUShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_SETSTRETCHBLTMODE record defines the bitmap stretching mode in the playback device\r
+ * context.\r
+ */\r
+ public static class WmfSetStretchBltMode implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines bitmap stretching mode.\r
+ * This MUST be one of the values:\r
+ * BLACKONWHITE = 0x0001,\r
+ * WHITEONBLACK = 0x0002,\r
+ * COLORONCOLOR = 0x0003,\r
+ * HALFTONE = 0x0004\r
+ */\r
+ int setStretchBltMode;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.setStretchBltMode;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ setStretchBltMode = leis.readUShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_DIBCREATEPATTERNBRUSH record creates a Brush Object with a\r
+ * pattern specified by a DeviceIndependentBitmap (DIB) Object \r
+ */\r
+ public static class WmfDibCreatePatternBrush implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines the brush style. The legal values for this\r
+ * field are defined as follows: if the value is not BS_PATTERN, BS_DIBPATTERNPT MUST be\r
+ * assumed.\r
+ */\r
+ public static enum BrushStyle {\r
+ /**\r
+ * A brush that paints a single, constant color, either solid or dithered.\r
+ */\r
+ BS_SOLID(0x0000),\r
+ /**\r
+ * A brush that does nothing. Using a BS_NULL brush in a graphics operation\r
+ * MUST have the same effect as using no brush at all.\r
+ */\r
+ BS_NULL(0x0001),\r
+ /**\r
+ * A brush that paints a predefined simple pattern, or "hatch", onto a solid background.\r
+ */\r
+ BS_HATCHED(0x0002),\r
+ /**\r
+ * A brush that paints a pattern defined by a bitmap, which MAY be a Bitmap16\r
+ * Object or a DeviceIndependentBitmap (DIB) Object.\r
+ */\r
+ BS_PATTERN(0x0003),\r
+ /**\r
+ * Not supported\r
+ */\r
+ BS_INDEXED(0x0004),\r
+ /**\r
+ * A pattern brush specified by a DIB.\r
+ */\r
+ BS_DIBPATTERN(0x0005),\r
+ /**\r
+ * A pattern brush specified by a DIB.\r
+ */\r
+ BS_DIBPATTERNPT(0x0006),\r
+ /**\r
+ * Not supported\r
+ */\r
+ BS_PATTERN8X8(0x0007),\r
+ /**\r
+ * Not supported\r
+ */\r
+ BS_DIBPATTERN8X8(0x0008),\r
+ /**\r
+ * Not supported\r
+ */\r
+ BS_MONOPATTERN(0x0009);\r
+ \r
+ int flag;\r
+ BrushStyle(int flag) {\r
+ this.flag = flag;\r
+ }\r
+ \r
+ static BrushStyle valueOf(int flag) {\r
+ for (BrushStyle bs : values()) {\r
+ if (bs.flag == flag) return bs;\r
+ }\r
+ return null;\r
+ }\r
+ }\r
+ \r
+ BrushStyle style;\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that defines whether the Colors field of a DIB\r
+ * Object contains explicit RGB values, or indexes into a palette.\r
+ * \r
+ * If the Style field specifies BS_PATTERN, a ColorUsage value of DIB_RGB_COLORS MUST be\r
+ * used regardless of the contents of this field.\r
+ * \r
+ * If the Style field specified anything but BS_PATTERN, this field MUST be one of the values:\r
+ * DIB_RGB_COLORS = 0x0000,\r
+ * DIB_PAL_COLORS = 0x0001,\r
+ * DIB_PAL_INDICES = 0x0002\r
+ */\r
+ int colorUsage;\r
+ \r
+ WmfBitmapDib patternDib;\r
+ WmfBitmap16 pattern16;\r
+ \r
+ public WmfRecordType getRecordType() {\r
+ return WmfRecordType.dibCreatePatternBrush;\r
+ }\r
+ \r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ style = BrushStyle.valueOf(leis.readUShort());\r
+ colorUsage = leis.readUShort();\r
+ int size = 2*LittleEndianConsts.SHORT_SIZE; \r
+ switch (style) {\r
+ case BS_SOLID:\r
+ case BS_NULL:\r
+ case BS_DIBPATTERN:\r
+ case BS_DIBPATTERNPT:\r
+ case BS_HATCHED:\r
+ patternDib = new WmfBitmapDib();\r
+ size += patternDib.init(leis);\r
+ break;\r
+ case BS_PATTERN:\r
+ pattern16 = new WmfBitmap16();\r
+ size += pattern16.init(leis);\r
+ break;\r
+ case BS_INDEXED:\r
+ case BS_DIBPATTERN8X8:\r
+ case BS_MONOPATTERN:\r
+ case BS_PATTERN8X8:\r
+ throw new RuntimeException("pattern not supported");\r
+ }\r
+ return size;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * The META_DELETEOBJECT record deletes an object, including Bitmap16, Brush,\r
+ * DeviceIndependentBitmap, Font, Palette, Pen, and Region. After the object is deleted,\r
+ * its index in the WMF Object Table is no longer valid but is available to be reused.\r
+ */\r
+ public static class WmfDeleteObject implements WmfRecord {\r
+ /**\r
+ * A 16-bit unsigned integer used to index into the WMF Object Table to \r
+ get the object to be deleted.\r
+ */\r
+ int objectIndex;\r
+ \r
+ public WmfRecordType getRecordType() { return WmfRecordType.deleteObject; }\r
+\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ objectIndex = leis.readUShort();\r
+ return LittleEndianConsts.SHORT_SIZE;\r
+ }\r
+ }\r
+\r
+ public static class WmfCreatePatternBrush implements WmfRecord {\r
+ \r
+ WmfBitmap16 pattern;\r
+\r
+ public WmfRecordType getRecordType() { return WmfRecordType.createPatternBrush; }\r
+\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ pattern = new WmfBitmap16(true);\r
+ return pattern.init(leis);\r
+ }\r
+ }\r
+\r
+ public static class WmfCreatePenIndirect implements WmfRecord {\r
+ \r
+ /**\r
+ * A 16-bit unsigned integer that specifies the pen style.\r
+ * The value MUST be defined from the PenStyle Enumeration table.\r
+ * \r
+ * PS_COSMETIC = 0x0000,\r
+ * PS_ENDCAP_ROUND = 0x0000,\r
+ * PS_JOIN_ROUND = 0x0000,\r
+ * PS_SOLID = 0x0000,\r
+ * PS_DASH = 0x0001,\r
+ * PS_DOT = 0x0002,\r
+ * PS_DASHDOT = 0x0003,\r
+ * PS_DASHDOTDOT = 0x0004,\r
+ * PS_NULL = 0x0005,\r
+ * PS_INSIDEFRAME = 0x0006,\r
+ * PS_USERSTYLE = 0x0007,\r
+ * PS_ALTERNATE = 0x0008,\r
+ * PS_ENDCAP_SQUARE = 0x0100,\r
+ * PS_ENDCAP_FLAT = 0x0200,\r
+ * PS_JOIN_BEVEL = 0x1000,\r
+ * PS_JOIN_MITER = 0x2000\r
+ */\r
+ int penStyle;\r
+ /**\r
+ * A 32-bit PointS Object that specifies a point for the object dimensions.\r
+ * The xcoordinate is the pen width. The y-coordinate is ignored.\r
+ */\r
+ int xWidth, yWidth; \r
+ /**\r
+ * A 32-bit ColorRef Object that specifies the pen color value.\r
+ */\r
+ WmfColorRef colorRef;\r
+ \r
+ public WmfRecordType getRecordType() { return WmfRecordType.createPatternBrush; }\r
+\r
+ public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
+ penStyle = leis.readUShort();\r
+ xWidth = leis.readShort();\r
+ yWidth = leis.readShort();\r
+ colorRef = new WmfColorRef();\r
+ int size = 3*LittleEndianConsts.SHORT_SIZE;\r
+ size += colorRef.init(leis);\r
+ return size;\r
+ }\r
+ }\r
+}
\ No newline at end of file
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_MOVETO record sets the output position in the playback device context to a specified\r
- * point.\r
- */\r
-public class WmfMoveTo implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit signed integer that defines the y-coordinate, in logical units.\r
- */\r
- int y;\r
- \r
- /**\r
- * A 16-bit signed integer that defines the x-coordinate, in logical units.\r
- */\r
- int x;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.moveTo;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- y = leis.readShort();\r
- x = leis.readShort();\r
- return 2*LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-public class WmfNoArg {\r
- protected static abstract class WmfNoArgParent implements WmfRecord {\r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- return 0;\r
- }\r
- }\r
- \r
- /**\r
- * The META_SAVEDC record saves the playback device context for later retrieval.\r
- */\r
- public static class WmfSaveDc extends WmfNoArgParent {\r
- public WmfRecordType getRecordType() { return WmfRecordType.saveDc; }\r
- }\r
-\r
- /**\r
- * The META_SETRELABS record is reserved and not supported.\r
- */\r
- public static class WmfSetRelabs extends WmfNoArgParent {\r
- public WmfRecordType getRecordType() { return WmfRecordType.setRelabs; }\r
- }\r
-}\r
eof(0x0000, null),\r
realizePalette(0x0035, WmfPalette.WmfRealizePalette.class),\r
setPalEntries(0x0037, WmfPalette.WmfSetPaletteEntries.class),\r
- setBkMode(0x0102, WmfSetBkMode.class),\r
- setMapMode(0x0103, WmfSetMapMode.class),\r
- setRop2(0x0104, WmfSetRop2.class),\r
- setRelabs(0x0105, WmfNoArg.WmfSetRelabs.class),\r
+ setBkMode(0x0102, WmfMisc.WmfSetBkMode.class),\r
+ setMapMode(0x0103, WmfMisc.WmfSetMapMode.class),\r
+ setRop2(0x0104, WmfMisc.WmfSetRop2.class),\r
+ setRelabs(0x0105, WmfMisc.WmfSetRelabs.class),\r
setPolyFillMode(0x0106, WmfFill.WmfSetPolyfillMode.class),\r
- setStretchBltMode(0x0107, WmfSetStretchBltMode.class),\r
+ setStretchBltMode(0x0107, WmfMisc.WmfSetStretchBltMode.class),\r
setTextCharExtra(0x0108, WmfText.WmfSetTextCharExtra.class),\r
- restoreDc(0x0127, WmfRestoreDc.class),\r
+ restoreDc(0x0127, WmfMisc.WmfRestoreDc.class),\r
resizePalette(0x0139, WmfPalette.WmfResizePalette.class),\r
- dibCreatePatternBrush(0x0142, WmfDibCreatePatternBrush.class),\r
- setLayout(0x0149, WmfSetLayout.class),\r
- setBkColor(0x0201, WmfSetBkColor.class),\r
+ dibCreatePatternBrush(0x0142, WmfMisc.WmfDibCreatePatternBrush.class),\r
+ setLayout(0x0149, WmfMisc.WmfSetLayout.class),\r
+ setBkColor(0x0201, WmfMisc.WmfSetBkColor.class),\r
setTextColor(0x0209, WmfText.WmfSetTextColor.class),\r
offsetViewportOrg(0x0211, WmfWindowing.WmfOffsetViewportOrg.class),\r
lineTo(0x0213, WmfDraw.WmfLineTo.class),\r
- moveTo(0x0214, WmfMoveTo.class),\r
+ moveTo(0x0214, WmfDraw.WmfMoveTo.class),\r
offsetClipRgn(0x0220, WmfWindowing.WmfOffsetClipRgn.class),\r
fillRegion(0x0228, WmfFill.WmfFillRegion.class),\r
- setMapperFlags(0x0231, WmfSetMapperFlags.class),\r
+ setMapperFlags(0x0231, WmfMisc.WmfSetMapperFlags.class),\r
selectPalette(0x0234, WmfPalette.WmfSelectPalette.class),\r
polygon(0x0324, WmfDraw.WmfPolygon.class),\r
polyline(0x0325, WmfDraw.WmfPolyline.class),\r
setPixel(0x041f, WmfDraw.WmfSetPixel.class),\r
roundRect(0x061c, WmfDraw.WmfRoundRect.class),\r
patBlt(0x061d, WmfFill.WmfPatBlt.class),\r
- saveDc(0x001e, WmfNoArg.WmfSaveDc.class),\r
+ saveDc(0x001e, WmfMisc.WmfSaveDc.class),\r
pie(0x081a, WmfDraw.WmfPie.class),\r
stretchBlt(0x0b23, WmfFill.WmfStretchBlt.class),\r
escape(0x0626, WmfEscape.class),\r
extTextOut(0x0a32, WmfText.WmfExtTextOut.class),\r
setDibToDev(0x0d33, WmfFill.WmfSetDibToDev.class),\r
dibBitBlt(0x0940, WmfFill.WmfDibBitBlt.class),\r
- dibStretchBlt(0x0b41, null),\r
- stretchDib(0x0f43, null),\r
- deleteObject(0x01f0, null),\r
+ dibStretchBlt(0x0b41, WmfFill.WmfDibStretchBlt.class),\r
+ stretchDib(0x0f43, WmfFill.WmfStretchDib.class),\r
+ deleteObject(0x01f0, WmfMisc.WmfDeleteObject.class),\r
createPalette(0x00f7, WmfPalette.WmfCreatePalette.class),\r
- createPatternBrush(0x01f9, null),\r
- createPenIndirect(0x02fa, null),\r
+ createPatternBrush(0x01f9, WmfMisc.WmfCreatePatternBrush.class),\r
+ createPenIndirect(0x02fa, WmfMisc.WmfCreatePenIndirect.class),\r
createFontIndirect(0x02fb, null),\r
createBrushIndirect(0x02fc, null),\r
createRegion(0x06ff, null);\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_RESTOREDC record restores the playback device context from a previously saved device\r
- * context.\r
- */\r
-public class WmfRestoreDc implements WmfRecord {\r
- \r
- /**\r
- * nSavedDC (2 bytes): A 16-bit signed integer that defines the saved state to be restored. If this \r
- * member is positive, nSavedDC represents a specific instance of the state to be restored. If \r
- * this member is negative, nSavedDC represents an instance relative to the current state.\r
- */\r
- int nSavedDC;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.restoreDc;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- nSavedDC = leis.readShort();\r
- return LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETBKCOLOR record sets the background color in the playback device context to a\r
- * specified color, or to the nearest physical color if the device cannot represent the specified color.\r
- */\r
-public class WmfSetBkColor implements WmfRecord {\r
- \r
- WmfColorRef colorRef;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setBkColor;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- WmfColorRef colorRef = new WmfColorRef();\r
- return colorRef.init(leis);\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETBKMODE record defines the background raster operation mix mode in the playback\r
- * device context. The background mix mode is the mode for combining pens, text, hatched brushes,\r
- * and interiors of filled objects with background colors on the output surface.\r
- */\r
-public class WmfSetBkMode implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines background mix mode.\r
- * This MUST be either TRANSPARENT = 0x0001 or OPAQUE = 0x0002\r
- */\r
- int bkMode;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setBkMode;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- bkMode = leis.readUShort();\r
- return LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETLAYOUT record defines the layout orientation in the playback device context.\r
- * The layout orientation determines the direction in which text and graphics are drawn\r
- */\r
-public class WmfSetLayout implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines the layout of text and graphics.\r
- * LAYOUT_LTR = 0x0000\r
- * LAYOUT_RTL = 0x0001\r
- * LAYOUT_BITMAPORIENTATIONPRESERVED = 0x0008\r
- */\r
- int layout;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setLayout;\r
- }\r
- \r
- @SuppressWarnings("unused")\r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- layout = leis.readUShort();\r
- // A 16-bit field that MUST be ignored.\r
- int reserved = leis.readShort();\r
- return 2*LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETMAPMODE record defines the mapping mode in the playback device context.\r
- * The mapping mode defines the unit of measure used to transform page-space units into\r
- * device-space units, and also defines the orientation of the device's x and y axes. \r
- */\r
-public class WmfSetMapMode implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines the mapping mode.\r
- * \r
- * The MapMode defines how logical units are mapped to physical units;\r
- * that is, assuming that the origins in both the logical and physical coordinate systems\r
- * are at the same point on the drawing surface, what is the physical coordinate (x',y')\r
- * that corresponds to logical coordinate (x,y).\r
- * \r
- * For example, suppose the mapping mode is MM_TEXT. Given the following definition of that\r
- * mapping mode, and an origin (0,0) at the top left corner of the drawing surface, logical\r
- * coordinate (4,5) would map to physical coordinate (4,5) in pixels.\r
- * \r
- * Now suppose the mapping mode is MM_LOENGLISH, with the same origin as the previous\r
- * example. Given the following definition of that mapping mode, logical coordinate (4,-5)\r
- * would map to physical coordinate (0.04,0.05) in inches.\r
- * \r
- * This MUST be one of the following:\r
- * \r
- * MM_TEXT (= 0x0001):\r
- * Each logical unit is mapped to one device pixel.\r
- * Positive x is to the right; positive y is down.\r
- * \r
- * MM_LOMETRIC (= 0x0002):\r
- * Each logical unit is mapped to 0.1 millimeter.\r
- * Positive x is to the right; positive y is up.\r
- *\r
- * MM_HIMETRIC (= 0x0003):\r
- * Each logical unit is mapped to 0.01 millimeter.\r
- * Positive x is to the right; positive y is up.\r
- *\r
- * MM_LOENGLISH (= 0x0004):\r
- * Each logical unit is mapped to 0.01 inch.\r
- * Positive x is to the right; positive y is up.\r
- * \r
- * MM_HIENGLISH (= 0x0005):\r
- * Each logical unit is mapped to 0.001 inch.\r
- * Positive x is to the right; positive y is up.\r
- * \r
- * MM_TWIPS (= 0x0006):\r
- * Each logical unit is mapped to one twentieth (1/20) of a point.\r
- * In printing, a point is 1/72 of an inch; therefore, 1/20 of a point is 1/1440 of an inch.\r
- * This unit is also known as a "twip".\r
- * Positive x is to the right; positive y is up.\r
- *\r
- * MM_ISOTROPIC (= 0x0007):\r
- * Logical units are mapped to arbitrary device units with equally scaled axes;\r
- * that is, one unit along the x-axis is equal to one unit along the y-axis.\r
- * The META_SETWINDOWEXT and META_SETVIEWPORTEXT records specify the units and the\r
- * orientation of the axes.\r
- * The processing application SHOULD make adjustments as necessary to ensure the x and y\r
- * units remain the same size. For example, when the window extent is set, the viewport\r
- * SHOULD be adjusted to keep the units isotropic.\r
- *\r
- * MM_ANISOTROPIC (= 0x0008):\r
- * Logical units are mapped to arbitrary units with arbitrarily scaled axes.\r
- */\r
- int mapMode;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setMapMode;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- mapMode = leis.readUShort();\r
- return LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETMAPPERFLAGS record defines the algorithm that the font mapper uses when it maps\r
- * logical fonts to physical fonts.\r
- */\r
-public class WmfSetMapperFlags implements WmfRecord {\r
- \r
- /**\r
- * A 32-bit unsigned integer that defines whether the font mapper should attempt to\r
- * match a font's aspect ratio to the current device's aspect ratio. If bit 0 is\r
- * set, the mapper selects only matching fonts.\r
- */\r
- long mapperValues;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setMapperFlags;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- mapperValues = leis.readUInt();\r
- return LittleEndianConsts.INT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETROP2 record defines the foreground raster operation mix mode in the playback device\r
- * context. The foreground mix mode is the mode for combining pens and interiors of filled objects with\r
- * foreground colors on the output surface.\r
- */\r
-public class WmfSetRop2 implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines the foreground binary raster\r
- * operation mixing mode. This MUST be one of the values:\r
- * R2_BLACK = 0x0001,\r
- * R2_NOTMERGEPEN = 0x0002,\r
- * R2_MASKNOTPEN = 0x0003,\r
- * R2_NOTCOPYPEN = 0x0004,\r
- * R2_MASKPENNOT = 0x0005,\r
- * R2_NOT = 0x0006,\r
- * R2_XORPEN = 0x0007,\r
- * R2_NOTMASKPEN = 0x0008,\r
- * R2_MASKPEN = 0x0009,\r
- * R2_NOTXORPEN = 0x000A,\r
- * R2_NOP = 0x000B,\r
- * R2_MERGENOTPEN = 0x000C,\r
- * R2_COPYPEN = 0x000D,\r
- * R2_MERGEPENNOT = 0x000E,\r
- * R2_MERGEPEN = 0x000F,\r
- * R2_WHITE = 0x0010\r
- */\r
- int drawMode;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setRop2;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- drawMode = leis.readUShort();\r
- return LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r
+++ /dev/null
-package org.apache.poi.hwmf.record;\r
-\r
-import java.io.IOException;\r
-\r
-import org.apache.poi.util.LittleEndianConsts;\r
-import org.apache.poi.util.LittleEndianInputStream;\r
-\r
-/**\r
- * The META_SETSTRETCHBLTMODE record defines the bitmap stretching mode in the playback device\r
- * context.\r
- */\r
-public class WmfSetStretchBltMode implements WmfRecord {\r
- \r
- /**\r
- * A 16-bit unsigned integer that defines bitmap stretching mode.\r
- * This MUST be one of the values:\r
- * BLACKONWHITE = 0x0001,\r
- * WHITEONBLACK = 0x0002,\r
- * COLORONCOLOR = 0x0003,\r
- * HALFTONE = 0x0004\r
- */\r
- int setStretchBltMode;\r
- \r
- public WmfRecordType getRecordType() {\r
- return WmfRecordType.setStretchBltMode;\r
- }\r
- \r
- public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {\r
- setStretchBltMode = leis.readUShort();\r
- return LittleEndianConsts.SHORT_SIZE;\r
- }\r
-}\r