").svg({
- onLoad: function (svg) {
- return _this._render(svg, info.mapMode, info.xExt, info.yExt);
- },
- settings: {
- viewBox: [0, 0, info.xExt, info.yExt].join(" "),
- preserveAspectRatio: "none",
- },
- });
- var svgContainer = $(img[0]).svg("get");
- return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
- };
return Renderer;
}());
var WMFRect16 = /** @class */ (function () {
@@ -2840,7 +2835,6 @@ SOFTWARE.
exports.Error = WMFJSError;
exports.loggingEnabled = loggingEnabled;
-exports.RendererSettings = RendererSettings;
exports.Renderer = Renderer;
exports.WMFRect16 = WMFRect16;
exports.WMFPlacable = WMFPlacable;
diff --git a/dist/wmf.bundle.js.map b/dist/wmf.bundle.js.map
index 1d116d7..22acbe4 100644
--- a/dist/wmf.bundle.js.map
+++ b/dist/wmf.bundle.js.map
@@ -1 +1 @@
-{"version":3,"file":"wmf.bundle.js","sources":["../src/wmfjs/Helper.ts","../src/wmfjs/Blob.ts","../src/wmfjs/Primitives.ts","../src/wmfjs/Region.ts","../src/wmfjs/Bitmap.ts","../src/wmfjs/Style.ts","../src/wmfjs/GDIContext.ts","../src/wmfjs/WMFRecords.ts","../src/wmfjs/Renderer.ts","../src/wmfjs/index.ts"],"sourcesContent":["/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\n// tslint:disable-next-line:interface-name\nexport interface WMFJSError {\n name: string;\n message: string;\n stack: string;\n}\n\n// tslint:disable-next-line:variable-name\nexport const WMFJSError = function(this: WMFJSError, message: string) {\n this.name = \"WMFJSError\";\n this.message = message;\n this.stack = (new Error()).stack;\n} as any as { new (message: string): WMFJSError; };\nWMFJSError.prototype = new Error();\n\nlet isLoggingEnabled = true;\nexport function loggingEnabled(enabled: boolean) {\n isLoggingEnabled = enabled;\n}\n\nexport class Helper {\n static GDI = {\n METAHEADER_SIZE: 18,\n BITMAPINFOHEADER_SIZE: 40,\n BITMAPCOREHEADER_SIZE: 12,\n MetafileType: {\n MEMORYMETAFILE: 1,\n DISKMETAFILE: 2,\n },\n MetafileVersion: {\n METAVERSION100: 0x100,\n METAVERSION300: 0x300,\n },\n RecordType: {\n META_EOF: 0x0000,\n META_REALIZEPALETTE: 0x0035,\n META_SETPALENTRIES: 0x0037,\n META_SETBKMODE: 0x0102,\n META_SETMAPMODE: 0x0103,\n META_SETROP2: 0x0104,\n META_SETRELABS: 0x0105,\n META_SETPOLYFILLMODE: 0x0106,\n META_SETSTRETCHBLTMODE: 0x0107,\n META_SETTEXTCHAREXTRA: 0x0108,\n META_RESTOREDC: 0x0127,\n META_RESIZEPALETTE: 0x0139,\n META_DIBCREATEPATTERNBRUSH: 0x0142,\n META_SETLAYOUT: 0x0149,\n META_SETBKCOLOR: 0x0201,\n META_SETTEXTCOLOR: 0x0209,\n META_OFFSETVIEWPORTORG: 0x0211,\n META_LINETO: 0x0213,\n META_MOVETO: 0x0214,\n META_OFFSETCLIPRGN: 0x0220,\n META_FILLREGION: 0x0228,\n META_SETMAPPERFLAGS: 0x0231,\n META_SELECTPALETTE: 0x0234,\n META_POLYGON: 0x0324,\n META_POLYLINE: 0x0325,\n META_SETTEXTJUSTIFICATION: 0x020a,\n META_SETWINDOWORG: 0x020b,\n META_SETWINDOWEXT: 0x020c,\n META_SETVIEWPORTORG: 0x020d,\n META_SETVIEWPORTEXT: 0x020e,\n META_OFFSETWINDOWORG: 0x020f,\n META_SCALEWINDOWEXT: 0x0410,\n META_SCALEVIEWPORTEXT: 0x0412,\n META_EXCLUDECLIPRECT: 0x0415,\n META_INTERSECTCLIPRECT: 0x0416,\n META_ELLIPSE: 0x0418,\n META_FLOODFILL: 0x0419,\n META_FRAMEREGION: 0x0429,\n META_ANIMATEPALETTE: 0x0436,\n META_TEXTOUT: 0x0521,\n META_POLYPOLYGON: 0x0538,\n META_EXTFLOODFILL: 0x0548,\n META_RECTANGLE: 0x041b,\n META_SETPIXEL: 0x041f,\n META_ROUNDRECT: 0x061c,\n META_PATBLT: 0x061d,\n META_SAVEDC: 0x001e,\n META_PIE: 0x081a,\n META_STRETCHBLT: 0x0b23,\n META_ESCAPE: 0x0626,\n META_INVERTREGION: 0x012a,\n META_PAINTREGION: 0x012b,\n META_SELECTCLIPREGION: 0x012c,\n META_SELECTOBJECT: 0x012d,\n META_SETTEXTALIGN: 0x012e,\n META_ARC: 0x0817,\n META_CHORD: 0x0830,\n META_BITBLT: 0x0922,\n META_EXTTEXTOUT: 0x0a32,\n META_SETDIBTODEV: 0x0d33,\n META_DIBBITBLT: 0x0940,\n META_DIBSTRETCHBLT: 0x0b41,\n META_STRETCHDIB: 0x0f43,\n META_DELETEOBJECT: 0x01f0,\n META_CREATEPALETTE: 0x00f7,\n META_CREATEPATTERNBRUSH: 0x01f9,\n META_CREATEPENINDIRECT: 0x02fa,\n META_CREATEFONTINDIRECT: 0x02fb,\n META_CREATEBRUSHINDIRECT: 0x02fc,\n META_CREATEREGION: 0x06ff,\n },\n MetafileEscapes: {\n NEWFRAME: 0x0001,\n ABORTDOC: 0x0002,\n NEXTBAND: 0x0003,\n SETCOLORTABLE: 0x0004,\n GETCOLORTABLE: 0x0005,\n FLUSHOUT: 0x0006,\n DRAFTMODE: 0x0007,\n QUERYESCSUPPORT: 0x0008,\n SETABORTPROC: 0x0009,\n STARTDOC: 0x000a,\n ENDDOC: 0x000b,\n GETPHYSPAGESIZE: 0x000c,\n GETPRINTINGOFFSET: 0x000d,\n GETSCALINGFACTOR: 0x000e,\n META_ESCAPE_ENHANCED_METAFILE: 0x000f,\n SETPENWIDTH: 0x0010,\n SETCOPYCOUNT: 0x0011,\n SETPAPERSOURCE: 0x0012,\n PASSTHROUGH: 0x0013,\n GETTECHNOLOGY: 0x0014,\n SETLINECAP: 0x0015,\n SETLINEJOIN: 0x0016,\n SETMITERLIMIT: 0x0017,\n BANDINFO: 0x0018,\n DRAWPATTERNRECT: 0x0019,\n GETVECTORPENSIZE: 0x001a,\n GETVECTORBRUSHSIZE: 0x001b,\n ENABLEDUPLEX: 0x001c,\n GETSETPAPERBINS: 0x001d,\n GETSETPRINTORIENT: 0x001e,\n ENUMPAPERBINS: 0x001f,\n SETDIBSCALING: 0x0020,\n EPSPRINTING: 0x0021,\n ENUMPAPERMETRICS: 0x0022,\n GETSETPAPERMETRICS: 0x0023,\n POSTSCRIPT_DATA: 0x0025,\n POSTSCRIPT_IGNORE: 0x0026,\n GETDEVICEUNITS: 0x002a,\n GETEXTENDEDTEXTMETRICS: 0x0100,\n GETPAIRKERNTABLE: 0x0102,\n EXTTEXTOUT: 0x0200,\n GETFACENAME: 0x0201,\n DOWNLOADFACE: 0x0202,\n METAFILE_DRIVER: 0x0801,\n QUERYDIBSUPPORT: 0x0c01,\n BEGIN_PATH: 0x1000,\n CLIP_TO_PATH: 0x1001,\n END_PATH: 0x1002,\n OPEN_CHANNEL: 0x100e,\n DOWNLOADHEADER: 0x100f,\n CLOSE_CHANNEL: 0x1010,\n POSTSCRIPT_PASSTHROUGH: 0x1013,\n ENCAPSULATED_POSTSCRIPT: 0x1014,\n POSTSCRIPT_IDENTIFY: 0x1015,\n POSTSCRIPT_INJECTION: 0x1016,\n CHECKJPEGFORMAT: 0x1017,\n CHECKPNGFORMAT: 0x1018,\n GET_PS_FEATURESETTING: 0x1019,\n MXDC_ESCAPE: 0x101a,\n SPCLPASSTHROUGH2: 0x11d8,\n },\n MapMode: {\n MM_TEXT: 1,\n MM_LOMETRIC: 2,\n MM_HIMETRIC: 3,\n MM_LOENGLISH: 4,\n MM_HIENGLISH: 5,\n MM_TWIPS: 6,\n MM_ISOTROPIC: 7,\n MM_ANISOTROPIC: 8,\n },\n StretchMode: {\n BLACKONWHITE: 1,\n WHITEONBLACK: 2,\n COLORONCOLOR: 3,\n HALFTONE: 4,\n },\n TextAlignmentMode: {\n TA_UPDATECP: 1,\n TA_RIGHT: 2,\n TA_CENTER: 6,\n TA_BOTTOM: 8,\n TA_BASELINE: 24,\n TA_RTLREADING: 256,\n },\n MixMode: {\n TRANSPARENT: 1,\n OPAQUE: 2,\n },\n VerticalTextAlignmentMode: {\n VTA_BOTTOM: 2,\n VTA_CENTER: 6,\n VTA_LEFT: 8,\n VTA_BASELINE: 24,\n },\n BrushStyle: {\n BS_SOLID: 0,\n BS_NULL: 1,\n BS_HATCHED: 2,\n BS_PATTERN: 3,\n BS_INDEXED: 4,\n BS_DIBPATTERN: 5,\n BS_DIBPATTERNPT: 6,\n BS_PATTERN8X8: 7,\n BS_DIBPATTERN8X8: 8,\n BS_MONOPATTERN: 9,\n },\n PenStyle: {\n PS_SOLID: 0,\n PS_DASH: 1,\n PS_DOT: 2,\n PS_DASHDOT: 3,\n PS_DASHDOTDOT: 4,\n PS_NULL: 5,\n PS_INSIDEFRAME: 6,\n PS_USERSTYLE: 7,\n PS_ALTERNATE: 8,\n PS_ENDCAP_SQUARE: 256,\n PS_ENDCAP_FLAT: 512,\n PS_JOIN_BEVEL: 4096,\n PS_JOIN_MITER: 8192,\n },\n PolyFillMode: {\n ALTERNATE: 1,\n WINDING: 2,\n },\n ColorUsage: {\n DIB_RGB_COLORS: 0,\n DIB_PAL_COLORS: 1,\n DIB_PAL_INDICES: 2,\n },\n PaletteEntryFlag: {\n PC_RESERVED: 1,\n PC_EXPLICIT: 2,\n PC_NOCOLLAPSE: 4,\n },\n BitmapCompression: {\n BI_RGB: 0,\n BI_RLE8: 1,\n BI_RLE4: 2,\n BI_BITFIELDS: 3,\n BI_JPEG: 4,\n BI_PNG: 5,\n },\n };\n static _uniqueId = 0;\n\n static log(message: string) {\n if (isLoggingEnabled) {\n // tslint:disable-next-line:no-console\n console.log(message);\n }\n }\n\n static _makeUniqueId(prefix: string) {\n return \"wmfjs_\" + prefix + (this._uniqueId++);\n }\n\n static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {\n uint8arr[pos++] = val & 0xff;\n uint8arr[pos++] = (val >>> 8) & 0xff;\n uint8arr[pos++] = (val >>> 16) & 0xff;\n uint8arr[pos++] = (val >>> 24) & 0xff;\n }\n\n static _blobToBinary(blob: Uint8Array) {\n let ret = \"\";\n const len = blob.length;\n for (let i = 0; i < len; i++) {\n ret += String.fromCharCode(blob[i]);\n }\n return ret;\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { WMFJSError } from \"./Helper\";\n\nexport class Blob {\n blob: Blob | ArrayBuffer;\n data: Uint8Array;\n pos: number;\n\n constructor(blob: Blob | ArrayBuffer, offset?: number) {\n if (blob instanceof Blob) {\n this.blob = blob.blob;\n this.data = blob.data;\n this.pos = offset || blob.pos;\n } else {\n this.blob = blob;\n this.data = new Uint8Array(blob);\n this.pos = offset || 0;\n }\n }\n\n eof() {\n return this.pos >= this.data.length;\n }\n\n seek(newpos: number) {\n if (newpos < 0 || newpos > this.data.length) {\n throw new WMFJSError(\"Invalid seek position\");\n }\n this.pos = newpos;\n }\n\n skip(cnt: number) {\n const newPos = this.pos + cnt;\n if (newPos > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n this.pos = newPos;\n }\n\n readBinary(cnt: number) {\n const end = this.pos + cnt;\n if (end > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let ret = \"\";\n while (cnt-- > 0) {\n ret += String.fromCharCode(this.data[this.pos++]);\n }\n return ret;\n }\n\n readInt8() {\n if (this.pos + 1 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n return this.data[this.pos++];\n }\n\n readUint8() {\n return this.readInt8() >>> 0;\n }\n\n readInt32() {\n if (this.pos + 4 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let val = this.data[this.pos++];\n val |= this.data[this.pos++] << 8;\n val |= this.data[this.pos++] << 16;\n val |= this.data[this.pos++] << 24;\n return val;\n }\n\n readUint32() {\n return this.readInt32() >>> 0;\n }\n\n readUint16() {\n if (this.pos + 2 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let val = this.data[this.pos++];\n val |= this.data[this.pos++] << 8;\n return val;\n }\n\n readInt16() {\n let val = this.readUint16();\n if (val > 32767) {\n val -= 65536;\n }\n return val;\n }\n\n readString(length: number) {\n if (this.pos + length > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let ret = \"\";\n for (let i = 0; i < length; i++) {\n ret += String.fromCharCode(this.data[this.pos++] >>> 0);\n }\n return ret;\n }\n\n readNullTermString(maxSize: number) {\n let ret = \"\";\n if (maxSize > 0) {\n maxSize--;\n for (let i = 0; i < maxSize; i++) {\n if (this.pos + i + 1 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n const byte = this.data[this.pos + i] >>> 0;\n if (byte === 0) {\n break;\n }\n ret += String.fromCharCode(byte);\n }\n }\n return ret;\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { WMFJSError } from \"./Helper\";\n\nexport class PointS {\n x: number;\n y: number;\n\n constructor(reader: Blob, x?: number, y?: number) {\n if (reader != null) {\n this.x = reader.readInt16();\n this.y = reader.readInt16();\n } else {\n this.x = x;\n this.y = y;\n }\n }\n\n clone() {\n return new PointS(null, this.x, this.y);\n }\n\n toString() {\n return \"{x: \" + this.x + \", y: \" + this.y + \"}\";\n }\n}\n\nexport class Rect {\n bottom: number;\n right: number;\n top: number;\n left: number;\n\n constructor(reader: Blob, left?: number, top?: number, right?: number, bottom?: number) {\n if (reader != null) {\n this.bottom = reader.readInt16();\n this.right = reader.readInt16();\n this.top = reader.readInt16();\n this.left = reader.readInt16();\n } else {\n this.bottom = bottom;\n this.right = right;\n this.top = top;\n this.left = left;\n }\n }\n\n clone() {\n return new Rect(null, this.left, this.top, this.right, this.bottom);\n }\n\n toString() {\n return \"{left: \" + this.left + \", top: \" + this.top + \", right: \" + this.right\n + \", bottom: \" + this.bottom + \"}\";\n }\n\n empty() {\n return this.left >= this.right || this.top >= this.bottom;\n }\n\n intersect(rect: Rect) {\n if (this.empty() || rect.empty()) {\n return null;\n }\n if (this.left >= rect.right || this.top >= rect.bottom ||\n this.right <= rect.left || this.bottom <= rect.top) {\n return null;\n }\n return new Rect(null, Math.max(this.left, rect.left), Math.max(this.top, rect.top),\n Math.min(this.right, rect.right), Math.min(this.bottom, rect.bottom));\n }\n}\n\nexport class Obj {\n type: string;\n\n constructor(type: string) {\n this.type = type;\n }\n\n clone(): Obj {\n throw new WMFJSError(\"clone not implemented\");\n }\n\n toString() {\n throw new WMFJSError(\"toString not implemented\");\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { Obj, Rect } from \"./Primitives\";\n\nexport class Region extends Obj {\n bounds: Rect;\n scans: Scan[];\n complexity: number;\n\n constructor(reader: Blob, copy?: Region) {\n super(\"region\");\n if (reader != null) {\n reader.skip(2);\n if (reader.readInt16() !== 6) {\n throw new WMFJSError(\"Invalid region identifier\");\n }\n reader.skip(2);\n const rgnSize = reader.readInt16();\n const scanCnt = reader.readInt16();\n reader.skip(2);\n // note, Rect in reverse, can't use Rect(reader) directly\n const left = reader.readInt16();\n const top = reader.readInt16();\n const right = reader.readInt16();\n const bottom = reader.readInt16();\n this.bounds = new Rect(null, left, top, right, bottom);\n this.scans = [];\n for (let i = 0; i < scanCnt; i++) {\n this.scans.push(new Scan(reader));\n }\n this._updateComplexity();\n } else if (copy != null) {\n this.bounds = copy.bounds != null ? copy.bounds.clone() : null;\n if (copy.scans != null) {\n this.scans = [];\n for (let i = 0; i < copy.scans.length; i++) {\n this.scans.push(copy.scans[i].clone());\n }\n } else {\n this.scans = null;\n }\n this.complexity = copy.complexity;\n } else {\n this.bounds = null;\n this.scans = null;\n this.complexity = 0;\n }\n }\n\n clone() {\n return new Region(null, this);\n }\n\n toString() {\n const _complexity = [\"null\", \"simple\", \"complex\"];\n return \"{complexity: \" + _complexity[this.complexity]\n + \" bounds: \" + (this.bounds != null ? this.bounds.toString() : \"[none]\")\n + \" #scans: \" + (this.scans != null ? this.scans.length : \"[none]\") + \"}\";\n }\n\n _updateComplexity() {\n if (this.bounds == null) {\n this.complexity = 0;\n this.scans = null;\n } else if (this.bounds.empty()) {\n this.complexity = 0;\n this.scans = null;\n this.bounds = null;\n } else if (this.scans == null) {\n this.complexity = 1;\n } else {\n this.complexity = 2;\n if (this.scans.length === 1) {\n const scan = this.scans[0];\n if (scan.top === this.bounds.top && scan.bottom === this.bounds.bottom && scan.scanlines.length === 1) {\n const scanline = scan.scanlines[0];\n if (scanline.left === this.bounds.left && scanline.right === this.bounds.right) {\n this.scans = null;\n this.complexity = 1;\n }\n }\n }\n }\n }\n\n subtract(rect: Rect) {\n Helper.log(\"[wmf] Region \" + this.toString() + \" subtract \" + rect.toString());\n\n if (this.bounds != null) {\n const isect = this.bounds.intersect(rect);\n if (isect != null) { // Only need to do anything if there is any chance of an overlap\n if (this.scans == null) {\n // We currently have a simple region and there is some kind of an overlap.\n // We need to create scanlines now. Simplest method is to fake one scan line\n // that equals the simple region and re-use the same logic as for complex regions\n this.scans = [];\n this.scans.push( new Scan(null, null, this.bounds.top, this.bounds.bottom,\n [{left: this.bounds.left, right: this.bounds.right}]));\n this.complexity = 2;\n }\n\n // We (now) have a complex region. First we skip any scans that are entirely above rect.top\n // The first scan that falls partially below rect.top needs to be split into two scans.\n let si = 0;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.bottom >= rect.top) {\n // We need to clone this scan into two so that we can subtract from the second one\n const cloned = scan.clone();\n scan.bottom = rect.top - 1;\n cloned.top = rect.top;\n if (scan.top >= scan.bottom) {\n this.scans[si] = cloned;\n } else {\n Helper.log(\"[wmf] Region split top scan \" + si + \" for substraction\");\n this.scans.splice(++si, 0, cloned);\n }\n break;\n }\n si++;\n }\n\n // Now find the first one that falls at least partially below rect.bottom, which needs to be\n // split if it is only partially below rect.bottom\n const first = si;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.top > rect.bottom) {\n break;\n }\n if (scan.bottom > rect.bottom) {\n // We need to clone this scan into two so that we can subtract from the first one\n const cloned = scan.clone();\n scan.bottom = rect.bottom;\n cloned.top = rect.bottom + 1;\n if (scan.top >= scan.bottom) {\n this.scans[si] = cloned;\n } else {\n Helper.log(\"[wmf] Region split bottom scan \" + si + \" for substraction\");\n this.scans.splice(++si, 0, cloned);\n }\n break;\n }\n si++;\n }\n\n // Now perform a subtraction on each scan in between rect.top and rect.bottom. Because we\n // cloned scans that partially overlapped rect.top and rect.bottom, we don't have to\n // account for this anymore.\n if (first < this.scans.length) {\n let last = si;\n si = first;\n while (si < last) {\n const scan = this.scans[si];\n if (!scan.subtract(rect.left, rect.right)) {\n Helper.log(\"[wmf] Region remove now empty scan \" + si + \" due to subtraction\");\n this.scans.splice(si, 1);\n last--;\n continue;\n }\n\n si++;\n }\n }\n\n // Update bounds\n if (this.scans != null) {\n let left;\n let top;\n let right;\n let bottom;\n const len = this.scans.length;\n for (let i = 0; i < len; i++) {\n const scan = this.scans[i];\n if (i === 0) {\n top = scan.top;\n }\n if (i === len - 1) {\n bottom = scan.bottom;\n }\n\n const slen = scan.scanlines.length;\n if (slen > 0) {\n let scanline = scan.scanlines[0];\n if (left == null || scanline.left < left) {\n left = scanline.left;\n }\n scanline = scan.scanlines[slen - 1];\n if (right == null || scanline.right > right) {\n right = scanline.right;\n }\n }\n }\n\n if (left != null && top != null && right != null && bottom != null) {\n this.bounds = new Rect(null, left, top, right, bottom);\n this._updateComplexity();\n } else {\n // This has to be a null region now\n this.bounds = null;\n this.scans = null;\n this.complexity = 0;\n }\n } else {\n this._updateComplexity();\n }\n }\n }\n\n Helper.log(\"[wmf] Region subtraction -> \" + this.toString());\n }\n\n intersect(rect: Rect) {\n Helper.log(\"[wmf] Region \" + this.toString() + \" intersect with \" + rect.toString());\n if (this.bounds != null) {\n this.bounds = this.bounds.intersect(rect);\n if (this.bounds != null) {\n if (this.scans != null) {\n let si = 0;\n // Remove any scans that are entirely above the new bounds.top\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.bottom < this.bounds.top) {\n si++;\n } else {\n break;\n }\n }\n if (si > 0) {\n Helper.log(\"[wmf] Region remove \" + si + \" scans from top\");\n this.scans.splice(0, si);\n\n // Adjust the first scan's top to match the new bounds.top\n if (this.scans.length > 0) {\n this.scans[0].top = this.bounds.top;\n }\n }\n\n // Get rid of anything that falls outside the new bounds.left/bounds.right\n si = 0;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.top > this.bounds.bottom) {\n // Remove this and all remaining scans that fall entirely below the new bounds.bottom\n Helper.log(\"[wmf] Region remove \" + (this.scans.length - si) + \" scans from bottom\");\n this.scans.splice(si, this.scans.length - si);\n break;\n }\n if (!scan.intersect(this.bounds.left, this.bounds.right)) {\n // Remove now empty scan\n Helper.log(\"[wmf] Region remove now empty scan \" + si + \" due to intersection\");\n this.scans.splice(si, 1);\n continue;\n }\n si++;\n }\n\n // If there are any scans left, adjust the last one's bottom to the new bounds.bottom\n if (this.scans.length > 0) {\n this.scans[this.scans.length - 1].bottom = this.bounds.bottom;\n }\n\n this._updateComplexity();\n }\n } else {\n this.scans = null;\n this.complexity = 0;\n }\n }\n Helper.log(\"[wmf] Region intersection -> \" + this.toString());\n }\n\n offset(offX: number, offY: number) {\n if (this.bounds != null) {\n this.bounds.left += offX;\n this.bounds.top += offY;\n this.bounds.right += offX;\n this.bounds.bottom += offY;\n }\n\n if (this.scans != null) {\n const slen = this.scans.length;\n for (let si = 0; si < slen; si++) {\n const scan = this.scans[si];\n scan.top += offY;\n scan.bottom += offY;\n\n const len = scan.scanlines.length;\n for (let i = 0; i < len; i++) {\n const scanline = scan.scanlines[i];\n scanline.left += offX;\n scanline.right += offX;\n }\n }\n }\n }\n}\n\nexport function CreateSimpleRegion(left: number, top: number, right: number, bottom: number) {\n const rgn = new Region(null, null);\n rgn.bounds = new Rect(null, left, top, right, bottom);\n rgn._updateComplexity();\n return rgn;\n}\n\nexport class Scan {\n top: number;\n bottom: number;\n scanlines: Array<{left: number, right: number}>;\n\n constructor(reader: Blob, copy?: Scan, top?: number, bottom?: number,\n scanlines?: Array<{left: number, right: number}>) {\n if (reader != null) {\n const cnt = reader.readUint16();\n this.top = reader.readUint16();\n this.bottom = reader.readUint16();\n this.scanlines = [];\n for (let i = 0; i < cnt; i++) {\n const left = reader.readUint16();\n const right = reader.readUint16();\n this.scanlines.push({left, right});\n }\n reader.skip(2);\n } else if (copy != null) {\n this.top = copy.top;\n this.bottom = copy.bottom;\n this.scanlines = [];\n for (let i = 0; i < copy.scanlines.length; i++) {\n const scanline = copy.scanlines[i];\n this.scanlines.push({left: scanline.left, right: scanline.right});\n }\n } else {\n this.top = top;\n this.bottom = bottom;\n this.scanlines = scanlines;\n }\n }\n\n clone() {\n return new Scan(null, this);\n }\n\n subtract(left: number, right: number) {\n let i;\n\n // Keep everything on the left side\n i = 0;\n while (i < this.scanlines.length) {\n const scanline = this.scanlines[i];\n if (scanline.left <= left) {\n if (scanline.right >= left) {\n scanline.right = left - 1;\n if (scanline.left >= scanline.right) {\n this.scanlines.splice(i, 1);\n continue;\n }\n }\n i++;\n } else {\n break;\n }\n }\n\n // Find the first one that may exceed to the right side\n const first = i;\n let cnt = 0;\n while (i < this.scanlines.length) {\n const scanline = this.scanlines[i];\n if (scanline.right > right) {\n scanline.left = right;\n cnt = i - first;\n if (scanline.left >= scanline.right) {\n cnt++;\n }\n break;\n }\n i++;\n }\n\n // Delete everything we're subtracting\n if (cnt > 0 && first < this.scanlines.length) {\n this.scanlines.splice(first, cnt);\n }\n\n return this.scanlines.length > 0;\n }\n\n intersect(left: number, right: number) {\n // Get rid of anything that falls entirely outside to the left\n for (let i = 0; i < this.scanlines.length; i++) {\n const scanline = this.scanlines[i];\n if (scanline.left >= left || scanline.right >= left) {\n if (i > 0) {\n this.scanlines.splice(0, i);\n }\n break;\n }\n }\n\n if (this.scanlines.length > 0) {\n // Adjust the first to match the left, if needed\n let scanline = this.scanlines[0];\n if (scanline.left < left) {\n scanline.left = left;\n }\n\n // Get rid of anything that falls entirely outside to the right\n for (let i = 0; i < this.scanlines.length; i++) {\n scanline = this.scanlines[i];\n if (scanline.left > right) {\n this.scanlines.splice(i, this.scanlines.length - i);\n break;\n }\n }\n\n if (this.scanlines.length > 0) {\n // Adjust the last to match the right, if needed\n scanline = this.scanlines[this.scanlines.length - 1];\n if (scanline.right > right) {\n scanline.right = right;\n }\n }\n }\n return this.scanlines.length > 0;\n }\n\n toString() {\n return \"{ #scanlines: \" + this.scanlines.length + \"}\";\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\n\nexport class BitmapBase {\n getWidth() {\n throw new WMFJSError(\"getWidth not implemented\");\n }\n\n getHeight() {\n throw new WMFJSError(\"getHeight not implemented\");\n }\n}\n\nexport class BitmapCoreHeader {\n width: number;\n height: number;\n planes: number;\n bitcount: number;\n\n constructor(reader: Blob, skipsize: boolean) {\n if (skipsize) {\n reader.skip(4);\n }\n this.width = reader.readUint16();\n this.height = reader.readUint16();\n this.planes = reader.readUint16();\n this.bitcount = reader.readUint16();\n }\n\n colors() {\n return this.bitcount <= 8 ? 1 << this.bitcount : 0;\n }\n}\n\nexport class BitmapInfoHeader {\n width: number;\n height: number;\n planes: number;\n bitcount: number;\n compression: number;\n sizeimage: number;\n xpelspermeter: number;\n ypelspermeter: number;\n clrused: number;\n clrimportant: number;\n\n constructor(reader: Blob, skipsize: boolean) {\n if (skipsize) {\n reader.skip(4);\n }\n this.width = reader.readInt32();\n this.height = reader.readInt32();\n this.planes = reader.readUint16();\n this.bitcount = reader.readUint16();\n this.compression = reader.readUint32();\n this.sizeimage = reader.readUint32();\n this.xpelspermeter = reader.readInt32();\n this.ypelspermeter = reader.readInt32();\n this.clrused = reader.readUint32();\n this.clrimportant = reader.readUint32();\n }\n\n colors() {\n if (this.clrused !== 0) {\n return this.clrused < 256 ? this.clrused : 256;\n } else {\n return this.bitcount > 8 ? 0 : 1 << this.bitcount;\n }\n }\n}\n\nexport class BitmapInfo extends BitmapBase {\n _reader: Blob;\n _offset: number;\n _usergb: boolean;\n _infosize: number;\n _header: BitmapCoreHeader | BitmapInfoHeader;\n\n constructor(reader: Blob, usergb: boolean) {\n super();\n this._reader = reader;\n this._offset = reader.pos;\n this._usergb = usergb;\n const hdrsize = reader.readUint32();\n this._infosize = hdrsize;\n if (hdrsize === Helper.GDI.BITMAPCOREHEADER_SIZE) {\n this._header = new BitmapCoreHeader(reader, false);\n this._infosize += this._header.colors() * (usergb ? 3 : 2);\n } else {\n this._header = new BitmapInfoHeader(reader, false);\n const masks =\n (this._header as BitmapInfoHeader).compression === Helper.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;\n if (hdrsize <= Helper.GDI.BITMAPINFOHEADER_SIZE + (masks * 4)) {\n this._infosize = Helper.GDI.BITMAPINFOHEADER_SIZE + (masks * 4);\n }\n this._infosize += this._header.colors() * (usergb ? 4 : 2);\n }\n }\n\n getWidth() {\n return this._header.width;\n }\n\n getHeight() {\n return Math.abs(this._header.height);\n }\n\n infosize() {\n return this._infosize;\n }\n\n header() {\n return this._header;\n }\n}\n\nexport class DIBitmap extends BitmapBase {\n _reader: Blob;\n _offset: number;\n _size: number;\n _info: BitmapInfo;\n\n constructor(reader: Blob, size: number) {\n super();\n this._reader = reader;\n this._offset = reader.pos;\n this._size = size;\n this._info = new BitmapInfo(reader, true);\n }\n\n getWidth() {\n return this._info.getWidth();\n }\n\n getHeight() {\n return this._info.getHeight();\n }\n\n makeBitmapFileHeader() {\n const buf = new ArrayBuffer(14);\n const view = new Uint8Array(buf);\n view[0] = 0x42;\n view[1] = 0x4d;\n Helper._writeUint32Val(view, 2, this._size + 14);\n Helper._writeUint32Val(view, 10, this._info.infosize() + 14);\n return Helper._blobToBinary(view);\n }\n\n base64ref() {\n const prevpos = this._reader.pos;\n this._reader.seek(this._offset);\n let mime = \"image/bmp\";\n const header = this._info.header();\n let data;\n if (header instanceof BitmapInfoHeader && header.compression != null) {\n switch (header.compression) {\n case Helper.GDI.BitmapCompression.BI_JPEG:\n mime = \"data:image/jpeg\";\n break;\n case Helper.GDI.BitmapCompression.BI_PNG:\n mime = \"data:image/png\";\n break;\n default:\n data = this.makeBitmapFileHeader();\n break;\n }\n } else {\n data = this.makeBitmapFileHeader();\n }\n\n if (data != null) {\n data += this._reader.readBinary(this._size);\n } else {\n data = this._reader.readBinary(this._size);\n }\n\n const ref = \"data:\" + mime + \";base64,\" + btoa(data);\n this._reader.seek(prevpos);\n return ref;\n }\n}\n\nexport class Bitmap16 extends BitmapBase {\n _reader: Blob;\n _offset: number;\n _size: number;\n type: number;\n width: number;\n height: number;\n widthBytes: number;\n planes: number;\n bitsPixel: number;\n bitsOffset: number;\n bitsSize: number;\n constructor(reader: Blob, size: number | Bitmap16) {\n super();\n if (reader != null) {\n size = size as number;\n this._reader = reader;\n this._offset = reader.pos;\n this._size = size;\n this.type = reader.readInt16();\n this.width = reader.readInt16();\n this.height = reader.readInt16();\n this.widthBytes = reader.readInt16();\n this.planes = reader.readUint8();\n this.bitsPixel = reader.readUint8();\n this.bitsOffset = reader.pos;\n this.bitsSize = (((this.width * this.bitsPixel + 15) >> 4) << 1) * this.height;\n if (this.bitsSize > size - 10) {\n throw new WMFJSError(\"Bitmap should have \" + this.bitsSize + \" bytes, but has \" + (size - 10));\n }\n } else {\n const copy = size as Bitmap16;\n this._reader = copy._reader;\n this._offset = copy._offset;\n this._size = copy._size;\n this.type = copy.type;\n this.width = copy.width;\n this.height = copy.height;\n this.widthBytes = copy.widthBytes;\n this.planes = copy.planes;\n this.bitsPixel = copy.bitsPixel;\n this.bitsOffset = copy.bitsOffset;\n this.bitsSize = copy.bitsSize;\n }\n }\n\n getWidth() {\n return this.width;\n }\n\n getHeight() {\n return this.height;\n }\n\n clone() {\n return new Bitmap16(null, this);\n }\n}\n\nexport class PatternBitmap16 extends Bitmap16 {\n constructor(reader: Blob, size: number | Bitmap16) {\n super(reader, size);\n if (reader != null) {\n this.bitsOffset += 22; // skip bits (4 bytes) + reserved (18 bytes)\n }\n }\n\n clone(): PatternBitmap16 {\n return new PatternBitmap16(null, this);\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Bitmap16, DIBitmap, PatternBitmap16 } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { Helper } from \"./Helper\";\nimport { Obj, PointS } from \"./Primitives\";\n\nexport class ColorRef {\n r: number;\n g: number;\n b: number;\n\n constructor(reader: Blob, r?: number, g?: number, b?: number) {\n if (reader != null) {\n this.r = reader.readUint8();\n this.g = reader.readUint8();\n this.b = reader.readUint8();\n reader.skip(1);\n } else {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n }\n\n clone() {\n return new ColorRef(null, this.r, this.g, this.b);\n }\n\n toHex() {\n const rgb = (this.r << 16) | (this.g << 8) | this.b;\n return (0x1000000 + rgb).toString(16).slice(1);\n }\n\n toString() {\n return \"{r: \" + this.r + \", g: \" + this.g + \", b: \" + this.b + \"}\";\n }\n}\n\nexport class Font extends Obj {\n height: number;\n width: number;\n escapement: number;\n orientation: number;\n weight: number;\n italic: number;\n underline: number;\n strikeout: number;\n charset: number;\n outprecision: number;\n clipprecision: number;\n quality: number;\n pitch: number;\n family: number;\n facename: string;\n\n constructor(reader: Blob, copy: Font | number) {\n super(\"font\");\n if (reader != null) {\n this.height = reader.readInt16();\n this.width = reader.readInt16();\n this.escapement = reader.readInt16();\n this.orientation = reader.readInt16();\n this.weight = reader.readInt16();\n this.italic = reader.readUint8();\n this.underline = reader.readUint8();\n this.strikeout = reader.readUint8();\n this.charset = reader.readUint8();\n this.outprecision = reader.readUint8();\n this.clipprecision = reader.readUint8();\n this.quality = reader.readUint8();\n const pitchAndFamily = reader.readUint8();\n this.pitch = pitchAndFamily & 0xf; // TODO: double check\n this.family = (pitchAndFamily >> 6) & 0x3; // TODO: double check\n\n const dataLength = copy as number;\n const start = reader.pos;\n this.facename = reader.readNullTermString(Math.min(dataLength - (reader.pos - start), 32));\n } else if (copy != null) {\n copy = copy as Font;\n this.height = copy.height;\n this.width = copy.width;\n this.escapement = copy.escapement;\n this.orientation = copy.orientation;\n this.weight = copy.weight;\n this.italic = copy.italic;\n this.underline = copy.underline;\n this.strikeout = copy.strikeout;\n this.charset = copy.charset;\n this.outprecision = copy.outprecision;\n this.clipprecision = copy.clipprecision;\n this.quality = copy.quality;\n this.pitch = copy.pitch;\n this.family = copy.family;\n this.facename = copy.facename;\n } else {\n // TODO: Values for a default font?\n this.height = -80;\n this.width = 0;\n this.escapement = 0;\n this.orientation = 0;\n this.weight = 400;\n this.italic = 0;\n this.underline = 0;\n this.strikeout = 0;\n this.charset = 0;\n this.outprecision = 0;\n this.clipprecision = 0;\n this.quality = 0;\n this.pitch = 0;\n this.family = 0;\n this.facename = \"Helvetica\";\n }\n }\n\n clone() {\n return new Font(null, this);\n }\n\n toString() {\n return JSON.stringify(this);\n }\n}\n\nexport class Brush extends Obj {\n style: number;\n color: ColorRef;\n pattern: Bitmap16;\n colorusage: number;\n dibpatternpt: DIBitmap;\n hatchstyle: number;\n\n constructor(reader: Blob, copy: Brush | number, forceDibPattern?: boolean | PatternBitmap16) {\n super(\"brush\");\n if (reader != null) {\n const dataLength = copy as number;\n const start = reader.pos;\n\n if (forceDibPattern === true || forceDibPattern === false) {\n this.style = reader.readUint16();\n if (forceDibPattern && this.style !== Helper.GDI.BrushStyle.BS_PATTERN) {\n this.style = Helper.GDI.BrushStyle.BS_DIBPATTERNPT;\n }\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n this.color = new ColorRef(reader);\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n reader.skip(forceDibPattern ? 2 : 6);\n this.pattern = new Bitmap16(reader, dataLength - (reader.pos - start));\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n this.colorusage = forceDibPattern ? reader.readUint16() : reader.readUint32();\n if (!forceDibPattern) {\n reader.skip(2);\n }\n this.dibpatternpt = new DIBitmap(reader, dataLength - (reader.pos - start));\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n this.color = new ColorRef(reader);\n this.hatchstyle = reader.readUint16();\n break;\n }\n } else if (forceDibPattern instanceof PatternBitmap16) {\n this.style = Helper.GDI.BrushStyle.BS_PATTERN;\n this.pattern = forceDibPattern;\n }\n } else if (copy != null) {\n copy = copy as Brush;\n this.style = copy.style;\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n this.color = copy.color.clone();\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n this.pattern = copy.pattern.clone();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n this.colorusage = copy.colorusage;\n this.dibpatternpt = copy.dibpatternpt;\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n this.color = copy.color.clone();\n this.hatchstyle = copy.hatchstyle;\n break;\n }\n }\n }\n\n clone() {\n return new Brush(null, this);\n }\n\n toString() {\n let ret = \"{style: \" + this.style;\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n ret += \", color: \" + this.color.toString();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n ret += \", colorusage: \" + this.colorusage;\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n ret += \", color: \" + this.color.toString() + \", hatchstyle: \" + this.hatchstyle;\n break;\n }\n return ret + \"}\";\n }\n}\n\nexport class Pen extends Obj {\n style: number;\n width: PointS;\n color: ColorRef;\n linecap: number;\n join: number;\n\n constructor(reader: Blob, style?: number, width?: PointS, color?: ColorRef, linecap?: number, join?: number) {\n super(\"pen\");\n if (reader != null) {\n style = reader.readUint16();\n this.style = style & 0xFF;\n this.width = new PointS(reader);\n this.color = new ColorRef(reader);\n this.linecap = (style & (Helper.GDI.PenStyle.PS_ENDCAP_SQUARE | Helper.GDI.PenStyle.PS_ENDCAP_FLAT));\n this.join = (style & (Helper.GDI.PenStyle.PS_JOIN_BEVEL | Helper.GDI.PenStyle.PS_JOIN_MITER));\n } else {\n this.style = style;\n this.width = width;\n this.color = color;\n this.linecap = linecap;\n this.join = join;\n }\n }\n\n clone() {\n return new Pen(null, this.style, this.width.clone(), this.color.clone(), this.linecap, this.join);\n }\n\n toString() {\n return \"{style: \" + this.style + \", width: \" + this.width.toString() + \", color: \" + this.color.toString()\n + \", linecap: \" + this.linecap + \", join: \" + this.join + \"}\";\n }\n}\n\nexport class PaletteEntry {\n flag: number;\n b: number;\n g: number;\n r: number;\n\n constructor(reader: Blob, copy?: PaletteEntry) {\n if (reader != null) {\n this.flag = reader.readUint8();\n this.b = reader.readUint8();\n this.g = reader.readUint8();\n this.r = reader.readUint8();\n } else {\n this.flag = copy.flag;\n this.b = copy.b;\n this.g = copy.g;\n this.r = copy.r;\n }\n }\n\n clone() {\n return new PaletteEntry(null, this);\n }\n}\n\nexport class Palette extends Obj {\n start: number;\n entries: PaletteEntry[];\n\n constructor(reader: Blob, copy?: Palette) {\n super(\"palette\");\n if (reader != null) {\n this.start = reader.readUint16();\n const cnt = reader.readUint16();\n this.entries = [];\n while (cnt > 0) {\n this.entries.push(new PaletteEntry(reader));\n }\n } else {\n this.start = copy.start;\n this.entries = [];\n const len = copy.entries.length;\n for (let i = 0; i < len; i++) {\n this.entries.push(copy.entries[i]);\n }\n }\n }\n\n clone() {\n return new Palette(null, this);\n }\n\n toString() {\n return \"{ #entries: \" + this.entries.length + \"}\"; // TODO\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { DIBitmap } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { Obj, PointS, Rect } from \"./Primitives\";\nimport { CreateSimpleRegion, Region } from \"./Region\";\nimport { Brush, ColorRef, Font, Palette, Pen } from \"./Style\";\n\nexport interface ISelectedStyle {\n brush?: Brush;\n pen?: Pen;\n font?: Font;\n palette?: Palette;\n region?: Region;\n [key: string]: Obj;\n}\n\nexport class GDIContextState {\n _svggroup: any;\n _svgclipChanged: boolean;\n _svgtextbkfilter: any;\n mapmode: number;\n stretchmode: number;\n textalign: number;\n bkmode: number;\n textcolor: ColorRef;\n bkcolor: ColorRef;\n polyfillmode: number;\n wx: number;\n wy: number;\n ww: number;\n wh: number;\n vx: number;\n vy: number;\n vw: number;\n vh: number;\n x: number;\n y: number;\n clip: Region;\n ownclip: boolean;\n selected: ISelectedStyle;\n\n constructor(copy: GDIContextState, defObjects?: ISelectedStyle) {\n if (copy != null) {\n this._svggroup = copy._svggroup;\n this._svgclipChanged = copy._svgclipChanged;\n this._svgtextbkfilter = copy._svgtextbkfilter;\n this.mapmode = copy.mapmode;\n this.stretchmode = copy.stretchmode;\n this.textalign = copy.textalign;\n this.bkmode = copy.bkmode;\n this.textcolor = copy.textcolor.clone();\n this.bkcolor = copy.bkcolor.clone();\n this.polyfillmode = copy.polyfillmode;\n this.wx = copy.wx;\n this.wy = copy.wy;\n this.ww = copy.ww;\n this.wh = copy.wh;\n this.vx = copy.vx;\n this.vy = copy.vy;\n this.vw = copy.vw;\n this.vh = copy.vh;\n this.x = copy.x;\n this.y = copy.y;\n\n this.clip = copy.clip;\n this.ownclip = false;\n\n this.selected = {};\n for (const type in copy.selected) {\n this.selected[type] = copy.selected[type];\n }\n } else {\n this._svggroup = null;\n this._svgclipChanged = false;\n this._svgtextbkfilter = null;\n this.mapmode = Helper.GDI.MapMode.MM_ANISOTROPIC;\n this.stretchmode = Helper.GDI.StretchMode.COLORONCOLOR;\n this.textalign = 0; // TA_LEFT | TA_TOP | TA_NOUPDATECP\n this.bkmode = Helper.GDI.MixMode.OPAQUE;\n this.textcolor = new ColorRef(null, 0, 0, 0);\n this.bkcolor = new ColorRef(null, 255, 255, 255);\n this.polyfillmode = Helper.GDI.PolyFillMode.ALTERNATE;\n this.wx = 0;\n this.wy = 0;\n this.ww = 0;\n this.wh = 0;\n this.vx = 0;\n this.vy = 0;\n this.vw = 0;\n this.vh = 0;\n this.x = 0;\n this.y = 0;\n\n this.clip = null;\n this.ownclip = false;\n\n this.selected = {};\n for (const type in defObjects) {\n const defObj = defObjects[type];\n this.selected[type] = defObj != null ? defObj.clone() : null;\n }\n }\n }\n}\n\nexport class GDIContext {\n _svg: any;\n _svgdefs: any;\n _svgPatterns: {[key: string]: Brush};\n _svgClipPaths: {[key: string]: Region};\n defObjects: ISelectedStyle;\n state: GDIContextState;\n statestack: GDIContextState[];\n objects: {[key: string]: Obj};\n\n constructor(svg: any) {\n this._svg = svg;\n this._svgdefs = null;\n this._svgPatterns = {};\n this._svgClipPaths = {};\n\n this.defObjects = {\n brush: new Brush(null, null),\n pen: new Pen(null, Helper.GDI.PenStyle.PS_SOLID, new PointS(null, 1, 1), new ColorRef(null, 0, 0, 0), 0, 0),\n font: new Font(null, null),\n palette: null,\n region: null,\n };\n\n this.state = new GDIContextState(null, this.defObjects);\n this.statestack = [this.state];\n this.objects = {};\n }\n\n _pushGroup() {\n if (this.state._svggroup == null || this.state._svgclipChanged) {\n this.state._svgclipChanged = false;\n this.state._svgtextbkfilter = null;\n\n const settings: any = {\n viewBox: [this.state.vx, this.state.vy, this.state.vw, this.state.vh].join(\" \"),\n preserveAspectRatio: \"none\",\n };\n if (this.state.clip != null) {\n Helper.log(\"[gdi] new svg x=\" + this.state.vx + \" y=\" + this.state.vy\n + \" width=\" + this.state.vw + \" height=\" + this.state.vh + \" with clipping\");\n settings[\"clip-path\"] = \"url(#\" + this._getSvgClipPathForRegion(this.state.clip) + \")\";\n } else {\n Helper.log(\"[gdi] new svg x=\" + this.state.vx + \" y=\" + this.state.vy\n + \" width=\" + this.state.vw + \" height=\" + this.state.vh + \" without clipping\");\n }\n this.state._svggroup = this._svg.svg(this.state._svggroup,\n this.state.vx, this.state.vy, this.state.vw, this.state.vh, settings);\n }\n }\n\n _storeObject(obj: Obj) {\n let i = 0;\n while (this.objects[i.toString()] != null && i <= 65535) {\n i++;\n }\n if (i > 65535) {\n Helper.log(\"[gdi] Too many objects!\");\n return -1;\n }\n\n this.objects[i.toString()] = obj;\n return i;\n }\n\n _getObject(objIdx: number) {\n const obj = this.objects[objIdx.toString()];\n if (obj == null) {\n Helper.log(\"[gdi] No object with handle \" + objIdx);\n }\n return obj;\n }\n\n _getSvgDef() {\n if (this._svgdefs == null) {\n this._svgdefs = this._svg.defs();\n }\n return this._svgdefs;\n }\n\n _getSvgClipPathForRegion(region: Region) {\n for (const existingId in this._svgClipPaths) {\n const rgn = this._svgClipPaths[existingId];\n if (rgn === region) {\n return existingId;\n }\n }\n\n const id = Helper._makeUniqueId(\"c\");\n const sclip = this._svg.clipPath(this._getSvgDef(), id, \"userSpaceOnUse\");\n switch (region.complexity) {\n case 1:\n this._svg.rect(sclip, this._todevX(region.bounds.left), this._todevY(region.bounds.top),\n this._todevW(region.bounds.right - region.bounds.left),\n this._todevH(region.bounds.bottom - region.bounds.top),\n { fill: \"black\", strokeWidth: 0 });\n break;\n case 2:\n for (let i = 0; i < region.scans.length; i++) {\n const scan = region.scans[i];\n for (let j = 0; j < scan.scanlines.length; j++) {\n const scanline = scan.scanlines[j];\n this._svg.rect(sclip, this._todevX(scanline.left), this._todevY(scan.top),\n this._todevW(scanline.right - scanline.left), this._todevH(scan.bottom - scan.top),\n { fill: \"black\", strokeWidth: 0 });\n }\n }\n break;\n }\n this._svgClipPaths[id] = region;\n return id;\n }\n\n _getSvgPatternForBrush(brush: Brush) {\n for (const existingId in this._svgPatterns) {\n const pat = this._svgPatterns[existingId];\n if (pat === brush) {\n return existingId;\n }\n }\n\n let width;\n let height;\n let img;\n switch (brush.style) {\n case Helper.GDI.BrushStyle.BS_PATTERN:\n width = brush.pattern.getWidth();\n height = brush.pattern.getHeight();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n width = brush.dibpatternpt.getWidth();\n height = brush.dibpatternpt.getHeight();\n img = brush.dibpatternpt.base64ref();\n break;\n default:\n throw new WMFJSError(\"Invalid brush style\");\n }\n\n const id = Helper._makeUniqueId(\"p\");\n const spat = this._svg.pattern(this._getSvgDef(), id, 0, 0, width, height, {patternUnits: \"userSpaceOnUse\"});\n this._svg.image(spat, 0, 0, width, height, img);\n this._svgPatterns[id] = brush;\n return id;\n }\n\n _selectObject(obj: Obj) {\n this.state.selected[obj.type] = obj;\n if (obj.type === \"region\") {\n this.state._svgclipChanged = true;\n }\n }\n\n _deleteObject(objIdx: number) {\n const obj = this.objects[objIdx.toString()];\n if (obj != null) {\n for (let i = 0; i < this.statestack.length; i++) {\n const state = this.statestack[i];\n if (state.selected[obj.type] === obj) {\n state.selected[obj.type] = this.defObjects[obj.type].clone();\n }\n }\n delete this.objects[objIdx.toString()];\n return true;\n }\n\n Helper.log(\"[gdi] Cannot delete object with invalid handle \" + objIdx);\n return false;\n }\n\n _getClipRgn() {\n if (this.state.clip != null) {\n if (!this.state.ownclip) {\n this.state.clip = this.state.clip.clone();\n }\n } else {\n if (this.state.selected.region != null) {\n this.state.clip = this.state.selected.region.clone();\n } else {\n this.state.clip = CreateSimpleRegion(this.state.wx, this.state.wy, this.state.wx + this.state.ww,\n this.state.wy + this.state.wh);\n }\n }\n this.state.ownclip = true;\n return this.state.clip;\n }\n\n _todevX(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.wx) * (this.state.vw / this.state.ww)) + this.state.vx;\n }\n\n _todevY(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.wy) * (this.state.vh / this.state.wh)) + this.state.vy;\n }\n\n _todevW(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val * (this.state.vw / this.state.ww)) + this.state.vx;\n }\n\n _todevH(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val * (this.state.vh / this.state.wh)) + this.state.vy;\n }\n\n _tologicalX(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.vx) / (this.state.vw / this.state.ww)) + this.state.wx;\n }\n\n _tologicalY(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.vy) / (this.state.vh / this.state.wh)) + this.state.wy;\n }\n\n _tologicalW(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val / (this.state.vw / this.state.ww)) + this.state.wx;\n }\n\n _tologicalH(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val / (this.state.vh / this.state.wh)) + this.state.wy;\n }\n\n setMapMode(mode: number) {\n Helper.log(\"[gdi] setMapMode: mode=\" + mode);\n this.state.mapmode = mode;\n this.state._svggroup = null;\n }\n\n setWindowOrg(x: number, y: number) {\n Helper.log(\"[gdi] setWindowOrg: x=\" + x + \" y=\" + y);\n this.state.wx = x;\n this.state.wy = y;\n this.state._svggroup = null;\n }\n\n setWindowExt(x: number, y: number) {\n Helper.log(\"[gdi] setWindowExt: x=\" + x + \" y=\" + y);\n this.state.ww = x;\n this.state.wh = y;\n this.state._svggroup = null;\n }\n\n offsetWindowOrg(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetWindowOrg: offX=\" + offX + \" offY=\" + offY);\n this.state.wx += offX;\n this.state.wy += offY;\n this.state._svggroup = null;\n }\n\n setViewportOrg(x: number, y: number) {\n Helper.log(\"[gdi] setViewportOrg: x=\" + x + \" y=\" + y);\n this.state.vx = x;\n this.state.vy = y;\n this.state._svggroup = null;\n }\n\n setViewportExt(x: number, y: number) {\n Helper.log(\"[gdi] setViewportExt: x=\" + x + \" y=\" + y);\n this.state.vw = x;\n this.state.vh = y;\n this.state._svggroup = null;\n }\n\n offsetViewportOrg(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetViewportOrg: offX=\" + offX + \" offY=\" + offY);\n this.state.vx += offX;\n this.state.vy += offY;\n this.state._svggroup = null;\n }\n\n saveDC() {\n Helper.log(\"[gdi] saveDC\");\n const prevstate = this.state;\n this.state = new GDIContextState(this.state);\n this.statestack.push(prevstate);\n this.state._svggroup = null;\n }\n\n restoreDC(saved: number) {\n Helper.log(\"[gdi] restoreDC: saved=\" + saved);\n if (this.statestack.length > 1) {\n if (saved === -1) {\n this.state = this.statestack.pop();\n } else if (saved < -1) {\n throw new WMFJSError(\"restoreDC: relative restore not implemented\");\n } else if (saved > 1) {\n throw new WMFJSError(\"restoreDC: absolute restore not implemented\");\n }\n } else {\n throw new WMFJSError(\"No saved contexts\");\n }\n\n this.state._svggroup = null;\n }\n\n escape(func: number, blob: Blob, offset: number, count: number) {\n Helper.log(\"[gdi] escape: func=\" + func + \" offset=\" + offset + \" count=\" + count);\n }\n\n setStretchBltMode(stretchMode: number) {\n Helper.log(\"[gdi] setStretchBltMode: stretchMode=\" + stretchMode);\n }\n\n stretchDib(srcX: number, srcY: number, srcW: number, srcH: number,\n dstX: number, dstY: number, dstW: number, dstH: number,\n rasterOp: number, colorUsage: number, dib: DIBitmap) {\n Helper.log(\"[gdi] stretchDib: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n srcX = this._todevX(srcX);\n srcY = this._todevY(srcY);\n srcW = this._todevW(srcW);\n srcH = this._todevH(srcH);\n dstX = this._todevX(dstX);\n dstY = this._todevY(dstY);\n dstW = this._todevW(dstW);\n dstH = this._todevH(dstH);\n Helper.log(\"[gdi] stretchDib: TRANSLATED: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16) + \" colorUsage=0x\" + colorUsage.toString(16));\n this._pushGroup();\n this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());\n }\n\n stretchDibBits(srcX: number, srcY: number, srcW: number, srcH: number,\n dstX: number, dstY: number, dstW: number, dstH: number,\n rasterOp: number, dib: DIBitmap) {\n Helper.log(\"[gdi] stretchDibBits: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n srcX = this._todevX(srcX);\n srcY = this._todevY(srcY);\n srcW = this._todevW(srcW);\n srcH = this._todevH(srcH);\n dstX = this._todevX(dstX);\n dstY = this._todevY(dstY);\n dstW = this._todevW(dstW);\n dstH = this._todevH(dstH);\n Helper.log(\"[gdi] stretchDibBits: TRANSLATED:\"\n + \" srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n this._pushGroup();\n this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());\n }\n\n _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {\n if (opts == null) {\n opts = {};\n }\n if (usePen) {\n const pen = this.state.selected.pen;\n if (pen.style !== Helper.GDI.PenStyle.PS_NULL) {\n opts.stroke = \"#\" + pen.color.toHex(), // TODO: pen style\n opts.strokeWidth = this._todevW(pen.width.x); // TODO: is .y ever used?\n\n let dotWidth;\n if ((pen.linecap & Helper.GDI.PenStyle.PS_ENDCAP_SQUARE) !== 0) {\n opts[\"stroke-linecap\"] = \"square\";\n dotWidth = 1;\n } else if ((pen.linecap & Helper.GDI.PenStyle.PS_ENDCAP_FLAT) !== 0) {\n opts[\"stroke-linecap\"] = \"butt\";\n dotWidth = opts.strokeWidth;\n } else {\n opts[\"stroke-linecap\"] = \"round\";\n dotWidth = 1;\n }\n\n if ((pen.join & Helper.GDI.PenStyle.PS_JOIN_BEVEL) !== 0) {\n opts[\"stroke-linejoin\"] = \"bevel\";\n } else if ((pen.join & Helper.GDI.PenStyle.PS_JOIN_MITER) !== 0) {\n opts[\"stroke-linejoin\"] = \"miter\";\n } else {\n opts[\"stroke-linejoin\"] = \"round\";\n }\n\n const dashWidth = opts.strokeWidth * 4;\n const dotSpacing = opts.strokeWidth * 2;\n switch (pen.style) {\n case Helper.GDI.PenStyle.PS_DASH:\n opts[\"stroke-dasharray\"] = [dashWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DOT:\n opts[\"stroke-dasharray\"] = [dotWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DASHDOT:\n opts[\"stroke-dasharray\"] = [dashWidth, dotSpacing, dotWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DASHDOTDOT:\n opts[\"stroke-dasharray\"]\n = [dashWidth, dotSpacing, dotWidth, dotSpacing, dotWidth, dotSpacing].toString();\n break;\n }\n }\n }\n if (useBrush) {\n const brush = this.state.selected.brush;\n switch (brush.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n opts.fill = \"#\" + brush.color.toHex();\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n opts.fill = \"url(#\" + this._getSvgPatternForBrush(brush) + \")\";\n break;\n case Helper.GDI.BrushStyle.BS_NULL:\n opts.fill = \"none\";\n break;\n default:\n Helper.log(\"[gdi] unsupported brush style: \" + brush.style);\n opts.fill = \"none\";\n break;\n }\n }\n if (useFont) {\n const font = this.state.selected.font;\n opts[\"font-family\"] = font.facename;\n opts[\"font-size\"] = this._todevH(Math.abs(font.height));\n opts.fill = \"#\" + this.state.textcolor.toHex();\n }\n return opts;\n }\n\n rectangle(rect: Rect, rw: number, rh: number) {\n Helper.log(\"[gdi] rectangle: rect=\" + rect.toString() + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const bottom = this._todevY(rect.bottom);\n const right = this._todevX(rect.right);\n const top = this._todevY(rect.top);\n const left = this._todevX(rect.left);\n rw = this._todevH(rw);\n rh = this._todevH(rh);\n Helper.log(\"[gdi] rectangle: TRANSLATED: bottom=\" + bottom + \" right=\" + right + \" top=\" + top\n + \" left=\" + left + \" rh=\" + rh + \" rw=\" + rw);\n this._pushGroup();\n\n const opts = this._applyOpts(null, true, true, false);\n this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);\n }\n\n textOut(x: number, y: number, text: string) {\n Helper.log(\"[gdi] textOut: x=\" + x + \" y=\" + y + \" text=\" + text\n + \" with font \" + this.state.selected.font.toString());\n x = this._todevX(x);\n y = this._todevY(y);\n Helper.log(\"[gdi] textOut: TRANSLATED: x=\" + x + \" y=\" + y);\n this._pushGroup();\n\n const opts = this._applyOpts(null, false, false, true);\n if (this.state.selected.font.escapement !== 0) {\n opts.transform = \"rotate(\" + [(-this.state.selected.font.escapement / 10), x, y] + \")\";\n opts.style = \"dominant-baseline: middle; text-anchor: start;\";\n }\n if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {\n if (this.state._svgtextbkfilter == null) {\n const filterId = Helper._makeUniqueId(\"f\");\n const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);\n this._svg.filters.flood(filter, null, \"#\" + this.state.bkcolor.toHex(), 1.0);\n this._svg.filters.composite(filter, null, null, \"SourceGraphic\");\n this.state._svgtextbkfilter = filter;\n }\n\n opts.filter = \"url(#\" + $(this.state._svgtextbkfilter).attr(\"id\") + \")\";\n }\n this._svg.text(this.state._svggroup, x, y, text, opts);\n }\n\n extTextOut(x: number, y: number, text: string, fwOpts: number, rect: Rect, dx: number[]) {\n Helper.log(\"[gdi] extTextOut: x=\" + x + \" y=\" + y + \" text=\" + text\n + \" with font \" + this.state.selected.font.toString());\n x = this._todevX(x);\n y = this._todevY(y);\n Helper.log(\"[gdi] extTextOut: TRANSLATED: x=\" + x + \" y=\" + y);\n this._pushGroup();\n\n const opts = this._applyOpts(null, false, false, true);\n if (this.state.selected.font.escapement !== 0) {\n opts.transform = \"rotate(\" + [(-this.state.selected.font.escapement / 10), x, y] + \")\";\n opts.style = \"dominant-baseline: middle; text-anchor: start;\";\n }\n if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {\n if (this.state._svgtextbkfilter == null) {\n const filterId = Helper._makeUniqueId(\"f\");\n const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);\n this._svg.filters.flood(filter, null, \"#\" + this.state.bkcolor.toHex(), 1.0);\n this._svg.filters.composite(filter, null, null, \"SourceGraphic\");\n this.state._svgtextbkfilter = filter;\n }\n\n opts.filter = \"url(#\" + $(this.state._svgtextbkfilter).attr(\"id\") + \")\";\n }\n this._svg.text(this.state._svggroup, x, y, text, opts);\n }\n\n lineTo(x: number, y: number) {\n Helper.log(\"[gdi] lineTo: x=\" + x + \" y=\" + y + \" with pen \" + this.state.selected.pen.toString());\n const toX = this._todevX(x);\n const toY = this._todevY(y);\n const fromX = this._todevX(this.state.x);\n const fromY = this._todevY(this.state.y);\n\n // Update position\n this.state.x = x;\n this.state.y = y;\n\n Helper.log(\"[gdi] lineTo: TRANSLATED: toX=\" + toX + \" toY=\" + toY + \" fromX=\" + fromX + \" fromY=\" + fromY);\n this._pushGroup();\n\n const opts = this._applyOpts(null, true, false, false);\n this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);\n }\n\n moveTo(x: number, y: number) {\n Helper.log(\"[gdi] moveTo: x=\" + x + \" y=\" + y);\n this.state.x = x;\n this.state.y = y;\n }\n\n polygon(points: PointS[], first: boolean) {\n Helper.log(\"[gdi] polygon: points=\" + points + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const pts = [];\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n pts.push([this._todevX(point.x), this._todevY(point.y)]);\n }\n Helper.log(\"[gdi] polygon: TRANSLATED: pts=\" + pts);\n if (first) {\n this._pushGroup();\n }\n const opts = {\n \"fill-rule\": this.state.polyfillmode === Helper.GDI.PolyFillMode.ALTERNATE ? \"evenodd\" : \"nonzero\",\n };\n this._applyOpts(opts, true, true, false);\n this._svg.polygon(this.state._svggroup, pts, opts);\n }\n\n polyPolygon(polygons: PointS[][]) {\n Helper.log(\"[gdi] polyPolygon: polygons.length=\" + polygons.length\n + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n\n const cnt = polygons.length;\n for (let i = 0; i < cnt; i++) {\n this.polygon(polygons[i], i === 0);\n }\n }\n\n polyline(points: PointS[]) {\n Helper.log(\"[gdi] polyline: points=\" + points + \" with pen \" + this.state.selected.pen.toString());\n const pts = [];\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n pts.push([this._todevX(point.x), this._todevY(point.y)]);\n }\n Helper.log(\"[gdi] polyline: TRANSLATED: pts=\" + pts);\n this._pushGroup();\n const opts = this._applyOpts({fill: \"none\"}, true, false, false);\n this._svg.polyline(this.state._svggroup, pts, opts);\n }\n\n ellipse(rect: Rect) {\n Helper.log(\"[gdi] ellipse: rect=\" + rect.toString() + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const bottom = this._todevY(rect.bottom);\n const right = this._todevX(rect.right);\n const top = this._todevY(rect.top);\n const left = this._todevX(rect.left);\n Helper.log(\"[gdi] ellipse: TRANSLATED: bottom=\" + bottom + \" right=\" + right + \" top=\" + top + \" left=\" + left);\n this._pushGroup();\n const width2 = (right - left) / 2;\n const height2 = (bottom - top) / 2;\n const opts = this._applyOpts(null, true, true, false);\n this._svg.ellipse(this.state._svggroup, left + width2, top + height2, width2, height2, opts);\n }\n\n excludeClipRect(rect: Rect) {\n Helper.log(\"[gdi] excludeClipRect: rect=\" + rect.toString());\n this._getClipRgn().subtract(rect);\n }\n\n intersectClipRect(rect: Rect) {\n Helper.log(\"[gdi] intersectClipRect: rect=\" + rect.toString());\n this._getClipRgn().intersect(rect);\n }\n\n offsetClipRgn(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetClipRgn: offX=\" + offX + \" offY=\" + offY);\n this._getClipRgn().offset(offX, offY);\n }\n\n setTextAlign(textAlignmentMode: number) {\n Helper.log(\"[gdi] setTextAlign: textAlignmentMode=0x\" + textAlignmentMode.toString(16));\n this.state.textalign = textAlignmentMode;\n }\n\n setBkMode(bkMode: number) {\n Helper.log(\"[gdi] setBkMode: bkMode=0x\" + bkMode.toString(16));\n this.state.bkmode = bkMode;\n }\n\n setTextColor(textColor: ColorRef) {\n Helper.log(\"[gdi] setTextColor: textColor=\" + textColor.toString());\n this.state.textcolor = textColor;\n }\n\n setBkColor(bkColor: ColorRef) {\n Helper.log(\"[gdi] setBkColor: bkColor=\" + bkColor.toString());\n this.state.bkcolor = bkColor;\n this.state._svgtextbkfilter = null;\n }\n\n setPolyFillMode(polyFillMode: number) {\n Helper.log(\"[gdi] setPolyFillMode: polyFillMode=\" + polyFillMode);\n this.state.polyfillmode = polyFillMode;\n }\n\n createBrush(brush: Brush) {\n const idx = this._storeObject(brush);\n Helper.log(\"[gdi] createBrush: brush=\" + brush.toString() + \" with handle \" + idx);\n }\n\n createFont(font: Font) {\n const idx = this._storeObject(font);\n Helper.log(\"[gdi] createFont: font=\" + font.toString() + \" with handle \" + idx);\n }\n\n createPen(pen: Pen) {\n const idx = this._storeObject(pen);\n Helper.log(\"[gdi] createPen: pen=\" + pen.toString() + \" width handle \" + idx);\n }\n\n createPalette(palette: Palette) {\n const idx = this._storeObject(palette);\n Helper.log(\"[gdi] createPalette: palette=\" + palette.toString() + \" width handle \" + idx);\n }\n\n createRegion(region: Region) {\n const idx = this._storeObject(region);\n Helper.log(\"[gdi] createRegion: region=\" + region.toString() + \" width handle \" + idx);\n }\n\n createPatternBrush(patternBrush: Brush) {\n const idx = this._storeObject(patternBrush);\n Helper.log(\"[gdi] createRegion: region=\" + patternBrush.toString() + \" width handle \" + idx);\n }\n\n selectObject(objIdx: number, checkType: string) {\n const obj = this._getObject(objIdx);\n if (obj != null && (checkType == null || obj.type === checkType)) {\n this._selectObject(obj);\n Helper.log(\"[gdi] selectObject: objIdx=\" + objIdx\n + (obj ? \" selected \" + obj.type + \": \" + obj.toString() : \"[invalid index]\"));\n } else {\n Helper.log(\"[gdi] selectObject: objIdx=\" + objIdx\n + (obj ? \" invalid object type: \" + obj.type : \"[invalid index]\"));\n }\n }\n\n deleteObject(objIdx: number) {\n const ret = this._deleteObject(objIdx);\n Helper.log(\"[gdi] deleteObject: objIdx=\" + objIdx + (ret ? \" deleted object\" : \"[invalid index]\"));\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { DIBitmap, PatternBitmap16 } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { GDIContext } from \"./GDIContext\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { PointS, Rect } from \"./Primitives\";\nimport { Region } from \"./Region\";\nimport { Brush, ColorRef, Font, Palette, Pen } from \"./Style\";\n\nexport class WMFRecords {\n _records: Array<(gdi: GDIContext) => void>;\n\n constructor(reader: Blob, first: number) {\n this._records = [];\n\n let all = false;\n let curpos = first;\n main_loop: while (!all) {\n reader.seek(curpos);\n const size = reader.readUint32();\n if (size < 3) {\n throw new WMFJSError(\"Invalid record size\");\n }\n const type = reader.readUint16();\n switch (type) {\n case Helper.GDI.RecordType.META_EOF:\n all = true;\n break main_loop;\n case Helper.GDI.RecordType.META_SETMAPMODE: {\n const mapMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setMapMode(mapMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETWINDOWORG: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setWindowOrg(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETWINDOWEXT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setWindowExt(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETWINDOWORG: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetWindowOrg(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETVIEWPORTORG: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setViewportOrg(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETVIEWPORTEXT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setViewportExt(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETVIEWPORTORG: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetViewportOrg(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SAVEDC: {\n this._records.push((gdi) => {\n gdi.saveDC();\n });\n break;\n }\n case Helper.GDI.RecordType.META_RESTOREDC: {\n const saved = reader.readInt16();\n this._records.push((gdi) => {\n gdi.restoreDC(saved);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETSTRETCHBLTMODE: {\n const stretchMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setStretchBltMode(stretchMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_DIBSTRETCHBLT: {\n const haveSrcDib = ((type >> 8) + 3 !== size);\n const rasterOp = reader.readUint16() | (reader.readUint16() << 16);\n const srcH = reader.readInt16();\n const srcW = reader.readInt16();\n const srcY = reader.readInt16();\n const srcX = reader.readInt16();\n const destH = reader.readInt16();\n const destW = reader.readInt16();\n const destY = reader.readInt16();\n const destX = reader.readInt16();\n const datalength = size * 2 - (reader.pos - curpos);\n const dib = new DIBitmap(reader, datalength);\n this._records.push((gdi) => {\n gdi.stretchDibBits(srcX, srcY, srcW, srcH, destX, destY, destW, destH, rasterOp, dib);\n });\n break;\n }\n case Helper.GDI.RecordType.META_STRETCHDIB: {\n const rasterOp = reader.readUint16() | (reader.readUint16() << 16);\n const colorUsage = reader.readInt16();\n const srcH = reader.readInt16();\n const srcW = reader.readInt16();\n const srcY = reader.readInt16();\n const srcX = reader.readInt16();\n const destH = reader.readInt16();\n const destW = reader.readInt16();\n const destY = reader.readInt16();\n const destX = reader.readInt16();\n const datalength = size * 2 - (reader.pos - curpos);\n const dib = new DIBitmap(reader, datalength);\n this._records.push((gdi) => {\n gdi.stretchDib(srcX, srcY, srcW, srcH, destX, destY, destW, destH, rasterOp, colorUsage, dib);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ESCAPE: {\n const func = reader.readUint16();\n const count = reader.readUint16();\n const offset = reader.pos;\n const blob = new Blob(reader, offset);\n this._records.push((gdi) => {\n gdi.escape(func, blob, offset, count);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETTEXTALIGN: {\n const textAlign = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setTextAlign(textAlign);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETBKMODE: {\n const bkMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setBkMode(bkMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETTEXTCOLOR: {\n const textColor = new ColorRef(reader);\n this._records.push((gdi) => {\n gdi.setTextColor(textColor);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETBKCOLOR: {\n const bkColor = new ColorRef(reader);\n this._records.push((gdi) => {\n gdi.setBkColor(bkColor);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEBRUSHINDIRECT: {\n const datalength = size * 2 - (reader.pos - curpos);\n const brush = new Brush(reader, datalength, false);\n this._records.push((gdi) => {\n gdi.createBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_DIBCREATEPATTERNBRUSH: {\n const datalength = size * 2 - (reader.pos - curpos);\n const brush = new Brush(reader, datalength, true);\n this._records.push((gdi) => {\n gdi.createBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPENINDIRECT: {\n const pen = new Pen(reader);\n this._records.push((gdi) => {\n gdi.createPen(pen);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEFONTINDIRECT: {\n const datalength = size * 2 - (reader.pos - curpos);\n const font = new Font(reader, datalength);\n this._records.push((gdi) => {\n gdi.createFont(font);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTOBJECT: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, null);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTPALETTE: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, \"palette\");\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTCLIPREGION: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, \"region\");\n });\n break;\n }\n case Helper.GDI.RecordType.META_DELETEOBJECT: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.deleteObject(idx);\n });\n break;\n }\n case Helper.GDI.RecordType.META_RECTANGLE: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.rectangle(rect, 0, 0);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ROUNDRECT: {\n const rh = reader.readInt16();\n const rw = reader.readInt16();\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.rectangle(rect, rw, rh);\n });\n break;\n }\n case Helper.GDI.RecordType.META_LINETO: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.lineTo(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_MOVETO: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.moveTo(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_TEXTOUT: {\n const len = reader.readInt16();\n if (len > 0) {\n const text = reader.readString(len);\n reader.skip(len % 2);\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.textOut(x, y, text);\n });\n }\n break;\n }\n case Helper.GDI.RecordType.META_EXTTEXTOUT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n const len = reader.readInt16();\n const fwOpts = reader.readUint16();\n\n let hasRect = null;\n let hasDx = null;\n if (size * 2 === 14 + len + len % 2) {\n hasRect = false;\n hasDx = false;\n }\n if (size * 2 === 14 + 8 + len + len % 2) {\n hasRect = true;\n hasDx = false;\n }\n if (size * 2 === 14 + len + len % 2 + len * 2) {\n hasRect = false;\n hasDx = true;\n }\n if (size * 2 === 14 + 8 + len + len % 2 + len * 2) {\n hasRect = true;\n hasDx = true;\n }\n\n const rect = hasRect ? new Rect(reader) : null;\n if (len > 0) {\n const text = reader.readString(len);\n reader.skip(len % 2);\n\n const dx: number[] = [];\n if (hasDx) {\n for (let i = 0; i < text.length; i++) {\n dx.push(reader.readInt16());\n }\n }\n\n this._records.push((gdi) => {\n gdi.extTextOut(x, y, text, fwOpts, rect, dx);\n });\n }\n break;\n }\n case Helper.GDI.RecordType.META_EXCLUDECLIPRECT: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.excludeClipRect(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_INTERSECTCLIPRECT: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.intersectClipRect(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYGON: {\n let cnt = reader.readInt16();\n const points: PointS[] = [];\n while (cnt > 0) {\n points.push(new PointS(reader));\n cnt--;\n }\n this._records.push((gdi) => {\n gdi.polygon(points, true);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETPOLYFILLMODE: {\n const polyfillmode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setPolyFillMode(polyfillmode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYPOLYGON: {\n const cnt = reader.readUint16();\n const polygonsPtCnts = [];\n for (let i = 0; i < cnt; i++) {\n polygonsPtCnts.push(reader.readUint16());\n }\n\n const polygons: PointS[][] = [];\n for (let i = 0; i < cnt; i++) {\n const ptCnt = polygonsPtCnts[i];\n\n const p = [];\n for (let ip = 0; ip < ptCnt; ip++) {\n p.push(new PointS(reader));\n }\n polygons.push(p);\n }\n this._records.push((gdi) => {\n gdi.polyPolygon(polygons);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYLINE: {\n let cnt = reader.readInt16();\n const points: PointS[] = [];\n while (cnt > 0) {\n points.push(new PointS(reader));\n cnt--;\n }\n this._records.push((gdi) => {\n gdi.polyline(points);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ELLIPSE: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.ellipse(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPALETTE: {\n const palette = new Palette(reader);\n this._records.push((gdi) => {\n gdi.createPalette(palette);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEREGION: {\n const region = new Region(reader);\n this._records.push((gdi) => {\n gdi.createRegion(region);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPATTERNBRUSH: {\n const datalength = size * 2 - (reader.pos - curpos);\n const patternBitmap = new PatternBitmap16(reader, datalength);\n const brush = new Brush(reader, datalength, patternBitmap);\n this._records.push((gdi) => {\n gdi.createPatternBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETCLIPRGN: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetClipRgn(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_REALIZEPALETTE:\n case Helper.GDI.RecordType.META_SETPALENTRIES:\n case Helper.GDI.RecordType.META_SETROP2:\n case Helper.GDI.RecordType.META_SETRELABS:\n case Helper.GDI.RecordType.META_SETTEXTCHAREXTRA:\n case Helper.GDI.RecordType.META_RESIZEPALETTE:\n case Helper.GDI.RecordType.META_SETLAYOUT:\n case Helper.GDI.RecordType.META_FILLREGION:\n case Helper.GDI.RecordType.META_SETMAPPERFLAGS:\n case Helper.GDI.RecordType.META_SETTEXTJUSTIFICATION:\n case Helper.GDI.RecordType.META_SCALEWINDOWEXT:\n case Helper.GDI.RecordType.META_SCALEVIEWPORTEXT:\n case Helper.GDI.RecordType.META_FLOODFILL:\n case Helper.GDI.RecordType.META_FRAMEREGION:\n case Helper.GDI.RecordType.META_ANIMATEPALETTE:\n case Helper.GDI.RecordType.META_EXTFLOODFILL:\n case Helper.GDI.RecordType.META_SETPIXEL:\n case Helper.GDI.RecordType.META_PATBLT:\n case Helper.GDI.RecordType.META_PIE:\n case Helper.GDI.RecordType.META_STRETCHBLT:\n case Helper.GDI.RecordType.META_INVERTREGION:\n case Helper.GDI.RecordType.META_PAINTREGION:\n case Helper.GDI.RecordType.META_ARC:\n case Helper.GDI.RecordType.META_CHORD:\n case Helper.GDI.RecordType.META_BITBLT:\n case Helper.GDI.RecordType.META_SETDIBTODEV:\n case Helper.GDI.RecordType.META_DIBBITBLT:\n default: {\n let recordName = \"UNKNOWN\";\n for (const name in Helper.GDI.RecordType) {\n const recordTypes: any = Helper.GDI.RecordType;\n if (recordTypes[name] === type) {\n recordName = name;\n break;\n }\n }\n Helper.log(\"[WMF] \" + recordName + \" record (0x\" + type.toString(16) + \") at offset 0x\"\n + curpos.toString(16) + \" with \" + (size * 2) + \" bytes\");\n break;\n }\n }\n\n curpos += size * 2;\n }\n\n if (!all) {\n throw new WMFJSError(\"Could not read all records\");\n }\n }\n\n play(gdi: GDIContext) {\n const len = this._records.length;\n for (let i = 0; i < len; i++) {\n this._records[i](gdi);\n }\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { GDIContext } from \"./GDIContext\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { WMFRecords } from \"./WMFRecords\";\n\nexport class RendererSettings {\n width: string;\n height: string;\n xExt: number;\n yExt: number;\n mapMode: number;\n}\n\nexport class Renderer {\n _img: WMF;\n\n constructor(blob: ArrayBuffer) {\n this.parse(blob);\n Helper.log(\"WMFJS.Renderer instantiated\");\n }\n\n parse(blob: ArrayBuffer) {\n this._img = null;\n\n const reader = new Blob(blob);\n\n let type;\n let size;\n let placable;\n let headerstart;\n const key = reader.readUint32();\n if (key === 0x9ac6cdd7) {\n placable = new WMFPlacable(reader);\n headerstart = reader.pos;\n type = reader.readUint16();\n size = reader.readUint16();\n } else {\n headerstart = 0;\n type = key & 0xffff;\n size = (key >>> 16) & 0xffff;\n }\n switch (type) {\n case Helper.GDI.MetafileType.MEMORYMETAFILE:\n case Helper.GDI.MetafileType.DISKMETAFILE:\n if (size === Helper.GDI.METAHEADER_SIZE / 2) {\n const version = reader.readUint16();\n switch (version) {\n case Helper.GDI.MetafileVersion.METAVERSION100:\n case Helper.GDI.MetafileVersion.METAVERSION300:\n this._img = new WMF(reader, placable, version, headerstart + (size * 2));\n break;\n }\n }\n break;\n }\n\n if (this._img == null) {\n throw new WMFJSError(\"Format not recognized\");\n }\n }\n\n _render(svg: any, mapMode: number, xExt: number, yExt: number) {\n // See https://www-user.tu-chemnitz.de/~ygu/petzold/ch18b.htm\n const gdi = new GDIContext(svg);\n gdi.setViewportExt(xExt, yExt);\n gdi.setMapMode(mapMode);\n Helper.log(\"[WMF] BEGIN RENDERING --->\");\n this._img.render(gdi);\n Helper.log(\"[WMF] <--- DONE RENDERING\");\n }\n\n render(info: RendererSettings) {\n const inst = this;\n const img = ($(\"
\") as any).svg({\n onLoad: (svg: any) => {\n return this._render(svg, info.mapMode, info.xExt, info.yExt);\n },\n settings: {\n viewBox: [0, 0, info.xExt, info.yExt].join(\" \"),\n preserveAspectRatio: \"none\", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC\n },\n });\n const svgContainer = ($(img[0]) as any).svg(\"get\");\n return $(svgContainer.root()).attr(\"width\", info.width).attr(\"height\", info.height);\n }\n}\n\nexport class WMFRect16 {\n left: number;\n top: number;\n right: number;\n bottom: number;\n\n constructor(reader: Blob) {\n this.left = reader.readInt16();\n this.top = reader.readInt16();\n this.right = reader.readInt16();\n this.bottom = reader.readInt16();\n }\n\n toString() {\n return \"{left: \" + this.left + \", top: \" + this.top + \", right: \" + this.right\n + \", bottom: \" + this.bottom + \"}\";\n }\n}\n\nexport class WMFPlacable {\n boundingBox: WMFRect16;\n unitsPerInch: number;\n\n constructor(reader: Blob) {\n reader.skip(2);\n this.boundingBox = new WMFRect16(reader);\n this.unitsPerInch = reader.readInt16();\n reader.skip(4);\n reader.skip(2); // TODO: checksum\n Helper.log(\"Got bounding box \" + this.boundingBox + \" and \" + this.unitsPerInch + \" units/inch\");\n }\n}\n\nexport class WMF {\n _reader: Blob;\n _version: number;\n _hdrsize: number;\n _placable: WMFPlacable;\n _records: WMFRecords;\n\n constructor(reader: Blob, placable: WMFPlacable, version: number, hdrsize: number) {\n this._reader = reader;\n this._version = version;\n this._hdrsize = hdrsize;\n this._placable = placable;\n this._records = new WMFRecords(reader, this._hdrsize);\n }\n\n render(gdi: GDIContext) {\n this._records.play(gdi);\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nexport * from \"./Renderer\";\nexport { WMFJSError as Error, loggingEnabled } from \"./Helper\";\n"],"names":["__extends"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,UAAU,GAAG,UAA2B,OAAe;IAChE,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,KAAK,CAAC;CACa,CAAC;AACnD,UAAU,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;AAEnC,IAAI,gBAAgB,GAAG,IAAI,CAAC;AAC5B,wBAA+B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IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,MAAM,CAAC,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC,YAAY,GAAG,aAAa,CAAC,CAAC;KACpG;IACL,kBAAC;CAAA,IAAA;;IASG,aAAY,MAAY,EAAE,QAAqB,EAAE,OAAe,EAAE,OAAe;QAC7E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACzD;IAED,oBAAM,GAAN,UAAO,GAAe;QAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC3B;IACL,UAAC;CAAA;;ACpKD;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"wmf.bundle.js","sources":["../src/wmfjs/Helper.ts","../src/wmfjs/Blob.ts","../src/wmfjs/Primitives.ts","../src/wmfjs/Region.ts","../src/wmfjs/Bitmap.ts","../src/wmfjs/Style.ts","../src/wmfjs/GDIContext.ts","../src/wmfjs/WMFRecords.ts","../src/wmfjs/Renderer.ts","../src/wmfjs/index.ts"],"sourcesContent":["/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\n// tslint:disable-next-line:interface-name\nexport interface WMFJSError {\n name: string;\n message: string;\n stack: string;\n}\n\n// tslint:disable-next-line:variable-name\nexport const WMFJSError = function(this: WMFJSError, message: string) {\n this.name = \"WMFJSError\";\n this.message = message;\n this.stack = (new Error()).stack;\n} as any as { new (message: string): WMFJSError; };\nWMFJSError.prototype = new Error();\n\nlet isLoggingEnabled = true;\nexport function loggingEnabled(enabled: boolean) {\n isLoggingEnabled = enabled;\n}\n\nexport class Helper {\n public static GDI = {\n METAHEADER_SIZE: 18,\n BITMAPINFOHEADER_SIZE: 40,\n BITMAPCOREHEADER_SIZE: 12,\n MetafileType: {\n MEMORYMETAFILE: 1,\n DISKMETAFILE: 2,\n },\n MetafileVersion: {\n METAVERSION100: 0x100,\n METAVERSION300: 0x300,\n },\n RecordType: {\n META_EOF: 0x0000,\n META_REALIZEPALETTE: 0x0035,\n META_SETPALENTRIES: 0x0037,\n META_SETBKMODE: 0x0102,\n META_SETMAPMODE: 0x0103,\n META_SETROP2: 0x0104,\n META_SETRELABS: 0x0105,\n META_SETPOLYFILLMODE: 0x0106,\n META_SETSTRETCHBLTMODE: 0x0107,\n META_SETTEXTCHAREXTRA: 0x0108,\n META_RESTOREDC: 0x0127,\n META_RESIZEPALETTE: 0x0139,\n META_DIBCREATEPATTERNBRUSH: 0x0142,\n META_SETLAYOUT: 0x0149,\n META_SETBKCOLOR: 0x0201,\n META_SETTEXTCOLOR: 0x0209,\n META_OFFSETVIEWPORTORG: 0x0211,\n META_LINETO: 0x0213,\n META_MOVETO: 0x0214,\n META_OFFSETCLIPRGN: 0x0220,\n META_FILLREGION: 0x0228,\n META_SETMAPPERFLAGS: 0x0231,\n META_SELECTPALETTE: 0x0234,\n META_POLYGON: 0x0324,\n META_POLYLINE: 0x0325,\n META_SETTEXTJUSTIFICATION: 0x020a,\n META_SETWINDOWORG: 0x020b,\n META_SETWINDOWEXT: 0x020c,\n META_SETVIEWPORTORG: 0x020d,\n META_SETVIEWPORTEXT: 0x020e,\n META_OFFSETWINDOWORG: 0x020f,\n META_SCALEWINDOWEXT: 0x0410,\n META_SCALEVIEWPORTEXT: 0x0412,\n META_EXCLUDECLIPRECT: 0x0415,\n META_INTERSECTCLIPRECT: 0x0416,\n META_ELLIPSE: 0x0418,\n META_FLOODFILL: 0x0419,\n META_FRAMEREGION: 0x0429,\n META_ANIMATEPALETTE: 0x0436,\n META_TEXTOUT: 0x0521,\n META_POLYPOLYGON: 0x0538,\n META_EXTFLOODFILL: 0x0548,\n META_RECTANGLE: 0x041b,\n META_SETPIXEL: 0x041f,\n META_ROUNDRECT: 0x061c,\n META_PATBLT: 0x061d,\n META_SAVEDC: 0x001e,\n META_PIE: 0x081a,\n META_STRETCHBLT: 0x0b23,\n META_ESCAPE: 0x0626,\n META_INVERTREGION: 0x012a,\n META_PAINTREGION: 0x012b,\n META_SELECTCLIPREGION: 0x012c,\n META_SELECTOBJECT: 0x012d,\n META_SETTEXTALIGN: 0x012e,\n META_ARC: 0x0817,\n META_CHORD: 0x0830,\n META_BITBLT: 0x0922,\n META_EXTTEXTOUT: 0x0a32,\n META_SETDIBTODEV: 0x0d33,\n META_DIBBITBLT: 0x0940,\n META_DIBSTRETCHBLT: 0x0b41,\n META_STRETCHDIB: 0x0f43,\n META_DELETEOBJECT: 0x01f0,\n META_CREATEPALETTE: 0x00f7,\n META_CREATEPATTERNBRUSH: 0x01f9,\n META_CREATEPENINDIRECT: 0x02fa,\n META_CREATEFONTINDIRECT: 0x02fb,\n META_CREATEBRUSHINDIRECT: 0x02fc,\n META_CREATEREGION: 0x06ff,\n },\n MetafileEscapes: {\n NEWFRAME: 0x0001,\n ABORTDOC: 0x0002,\n NEXTBAND: 0x0003,\n SETCOLORTABLE: 0x0004,\n GETCOLORTABLE: 0x0005,\n FLUSHOUT: 0x0006,\n DRAFTMODE: 0x0007,\n QUERYESCSUPPORT: 0x0008,\n SETABORTPROC: 0x0009,\n STARTDOC: 0x000a,\n ENDDOC: 0x000b,\n GETPHYSPAGESIZE: 0x000c,\n GETPRINTINGOFFSET: 0x000d,\n GETSCALINGFACTOR: 0x000e,\n META_ESCAPE_ENHANCED_METAFILE: 0x000f,\n SETPENWIDTH: 0x0010,\n SETCOPYCOUNT: 0x0011,\n SETPAPERSOURCE: 0x0012,\n PASSTHROUGH: 0x0013,\n GETTECHNOLOGY: 0x0014,\n SETLINECAP: 0x0015,\n SETLINEJOIN: 0x0016,\n SETMITERLIMIT: 0x0017,\n BANDINFO: 0x0018,\n DRAWPATTERNRECT: 0x0019,\n GETVECTORPENSIZE: 0x001a,\n GETVECTORBRUSHSIZE: 0x001b,\n ENABLEDUPLEX: 0x001c,\n GETSETPAPERBINS: 0x001d,\n GETSETPRINTORIENT: 0x001e,\n ENUMPAPERBINS: 0x001f,\n SETDIBSCALING: 0x0020,\n EPSPRINTING: 0x0021,\n ENUMPAPERMETRICS: 0x0022,\n GETSETPAPERMETRICS: 0x0023,\n POSTSCRIPT_DATA: 0x0025,\n POSTSCRIPT_IGNORE: 0x0026,\n GETDEVICEUNITS: 0x002a,\n GETEXTENDEDTEXTMETRICS: 0x0100,\n GETPAIRKERNTABLE: 0x0102,\n EXTTEXTOUT: 0x0200,\n GETFACENAME: 0x0201,\n DOWNLOADFACE: 0x0202,\n METAFILE_DRIVER: 0x0801,\n QUERYDIBSUPPORT: 0x0c01,\n BEGIN_PATH: 0x1000,\n CLIP_TO_PATH: 0x1001,\n END_PATH: 0x1002,\n OPEN_CHANNEL: 0x100e,\n DOWNLOADHEADER: 0x100f,\n CLOSE_CHANNEL: 0x1010,\n POSTSCRIPT_PASSTHROUGH: 0x1013,\n ENCAPSULATED_POSTSCRIPT: 0x1014,\n POSTSCRIPT_IDENTIFY: 0x1015,\n POSTSCRIPT_INJECTION: 0x1016,\n CHECKJPEGFORMAT: 0x1017,\n CHECKPNGFORMAT: 0x1018,\n GET_PS_FEATURESETTING: 0x1019,\n MXDC_ESCAPE: 0x101a,\n SPCLPASSTHROUGH2: 0x11d8,\n },\n MapMode: {\n MM_TEXT: 1,\n MM_LOMETRIC: 2,\n MM_HIMETRIC: 3,\n MM_LOENGLISH: 4,\n MM_HIENGLISH: 5,\n MM_TWIPS: 6,\n MM_ISOTROPIC: 7,\n MM_ANISOTROPIC: 8,\n },\n StretchMode: {\n BLACKONWHITE: 1,\n WHITEONBLACK: 2,\n COLORONCOLOR: 3,\n HALFTONE: 4,\n },\n TextAlignmentMode: {\n TA_UPDATECP: 1,\n TA_RIGHT: 2,\n TA_CENTER: 6,\n TA_BOTTOM: 8,\n TA_BASELINE: 24,\n TA_RTLREADING: 256,\n },\n MixMode: {\n TRANSPARENT: 1,\n OPAQUE: 2,\n },\n VerticalTextAlignmentMode: {\n VTA_BOTTOM: 2,\n VTA_CENTER: 6,\n VTA_LEFT: 8,\n VTA_BASELINE: 24,\n },\n BrushStyle: {\n BS_SOLID: 0,\n BS_NULL: 1,\n BS_HATCHED: 2,\n BS_PATTERN: 3,\n BS_INDEXED: 4,\n BS_DIBPATTERN: 5,\n BS_DIBPATTERNPT: 6,\n BS_PATTERN8X8: 7,\n BS_DIBPATTERN8X8: 8,\n BS_MONOPATTERN: 9,\n },\n PenStyle: {\n PS_SOLID: 0,\n PS_DASH: 1,\n PS_DOT: 2,\n PS_DASHDOT: 3,\n PS_DASHDOTDOT: 4,\n PS_NULL: 5,\n PS_INSIDEFRAME: 6,\n PS_USERSTYLE: 7,\n PS_ALTERNATE: 8,\n PS_ENDCAP_SQUARE: 256,\n PS_ENDCAP_FLAT: 512,\n PS_JOIN_BEVEL: 4096,\n PS_JOIN_MITER: 8192,\n },\n PolyFillMode: {\n ALTERNATE: 1,\n WINDING: 2,\n },\n ColorUsage: {\n DIB_RGB_COLORS: 0,\n DIB_PAL_COLORS: 1,\n DIB_PAL_INDICES: 2,\n },\n PaletteEntryFlag: {\n PC_RESERVED: 1,\n PC_EXPLICIT: 2,\n PC_NOCOLLAPSE: 4,\n },\n BitmapCompression: {\n BI_RGB: 0,\n BI_RLE8: 1,\n BI_RLE4: 2,\n BI_BITFIELDS: 3,\n BI_JPEG: 4,\n BI_PNG: 5,\n },\n };\n public static _uniqueId = 0;\n\n public static log(message: string) {\n if (isLoggingEnabled) {\n // tslint:disable-next-line:no-console\n console.log(message);\n }\n }\n\n public static _makeUniqueId(prefix: string) {\n return \"wmfjs_\" + prefix + (this._uniqueId++);\n }\n\n public static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {\n uint8arr[pos++] = val & 0xff;\n uint8arr[pos++] = (val >>> 8) & 0xff;\n uint8arr[pos++] = (val >>> 16) & 0xff;\n uint8arr[pos++] = (val >>> 24) & 0xff;\n }\n\n public static _blobToBinary(blob: Uint8Array) {\n let ret = \"\";\n const len = blob.length;\n for (let i = 0; i < len; i++) {\n ret += String.fromCharCode(blob[i]);\n }\n return ret;\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { WMFJSError } from \"./Helper\";\n\nexport class Blob {\n public pos: number;\n private blob: Blob | ArrayBuffer;\n private data: Uint8Array;\n\n constructor(blob: Blob | ArrayBuffer, offset?: number) {\n if (blob instanceof Blob) {\n this.blob = blob.blob;\n this.data = blob.data;\n this.pos = offset || blob.pos;\n } else {\n this.blob = blob;\n this.data = new Uint8Array(blob);\n this.pos = offset || 0;\n }\n }\n\n public eof() {\n return this.pos >= this.data.length;\n }\n\n public seek(newpos: number) {\n if (newpos < 0 || newpos > this.data.length) {\n throw new WMFJSError(\"Invalid seek position\");\n }\n this.pos = newpos;\n }\n\n public skip(cnt: number) {\n const newPos = this.pos + cnt;\n if (newPos > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n this.pos = newPos;\n }\n\n public readBinary(cnt: number) {\n const end = this.pos + cnt;\n if (end > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let ret = \"\";\n while (cnt-- > 0) {\n ret += String.fromCharCode(this.data[this.pos++]);\n }\n return ret;\n }\n\n public readInt8() {\n if (this.pos + 1 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n return this.data[this.pos++];\n }\n\n public readUint8() {\n return this.readInt8() >>> 0;\n }\n\n public readInt32() {\n if (this.pos + 4 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let val = this.data[this.pos++];\n val |= this.data[this.pos++] << 8;\n val |= this.data[this.pos++] << 16;\n val |= this.data[this.pos++] << 24;\n return val;\n }\n\n public readUint32() {\n return this.readInt32() >>> 0;\n }\n\n public readUint16() {\n if (this.pos + 2 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let val = this.data[this.pos++];\n val |= this.data[this.pos++] << 8;\n return val;\n }\n\n public readInt16() {\n let val = this.readUint16();\n if (val > 32767) {\n val -= 65536;\n }\n return val;\n }\n\n public readString(length: number) {\n if (this.pos + length > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n let ret = \"\";\n for (let i = 0; i < length; i++) {\n ret += String.fromCharCode(this.data[this.pos++] >>> 0);\n }\n return ret;\n }\n\n public readNullTermString(maxSize: number) {\n let ret = \"\";\n if (maxSize > 0) {\n maxSize--;\n for (let i = 0; i < maxSize; i++) {\n if (this.pos + i + 1 > this.data.length) {\n throw new WMFJSError(\"Unexpected end of file\");\n }\n const byte = this.data[this.pos + i] >>> 0;\n if (byte === 0) {\n break;\n }\n ret += String.fromCharCode(byte);\n }\n }\n return ret;\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { WMFJSError } from \"./Helper\";\n\nexport class PointS {\n public x: number;\n public y: number;\n\n constructor(reader: Blob, x?: number, y?: number) {\n if (reader != null) {\n this.x = reader.readInt16();\n this.y = reader.readInt16();\n } else {\n this.x = x;\n this.y = y;\n }\n }\n\n public clone() {\n return new PointS(null, this.x, this.y);\n }\n\n public toString() {\n return \"{x: \" + this.x + \", y: \" + this.y + \"}\";\n }\n}\n\nexport class Rect {\n public bottom: number;\n public right: number;\n public top: number;\n public left: number;\n\n constructor(reader: Blob, left?: number, top?: number, right?: number, bottom?: number) {\n if (reader != null) {\n this.bottom = reader.readInt16();\n this.right = reader.readInt16();\n this.top = reader.readInt16();\n this.left = reader.readInt16();\n } else {\n this.bottom = bottom;\n this.right = right;\n this.top = top;\n this.left = left;\n }\n }\n\n public clone() {\n return new Rect(null, this.left, this.top, this.right, this.bottom);\n }\n\n public toString() {\n return \"{left: \" + this.left + \", top: \" + this.top + \", right: \" + this.right\n + \", bottom: \" + this.bottom + \"}\";\n }\n\n public empty() {\n return this.left >= this.right || this.top >= this.bottom;\n }\n\n public intersect(rect: Rect) {\n if (this.empty() || rect.empty()) {\n return null;\n }\n if (this.left >= rect.right || this.top >= rect.bottom ||\n this.right <= rect.left || this.bottom <= rect.top) {\n return null;\n }\n return new Rect(null, Math.max(this.left, rect.left), Math.max(this.top, rect.top),\n Math.min(this.right, rect.right), Math.min(this.bottom, rect.bottom));\n }\n}\n\nexport class Obj {\n public type: string;\n\n constructor(type: string) {\n this.type = type;\n }\n\n public clone(): Obj {\n throw new WMFJSError(\"clone not implemented\");\n }\n\n public toString() {\n throw new WMFJSError(\"toString not implemented\");\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { Obj, Rect } from \"./Primitives\";\n\nexport class Region extends Obj {\n public bounds: Rect;\n public scans: Scan[];\n public complexity: number;\n\n constructor(reader: Blob, copy?: Region) {\n super(\"region\");\n if (reader != null) {\n reader.skip(2);\n if (reader.readInt16() !== 6) {\n throw new WMFJSError(\"Invalid region identifier\");\n }\n reader.skip(2);\n const rgnSize = reader.readInt16();\n const scanCnt = reader.readInt16();\n reader.skip(2);\n // note, Rect in reverse, can't use Rect(reader) directly\n const left = reader.readInt16();\n const top = reader.readInt16();\n const right = reader.readInt16();\n const bottom = reader.readInt16();\n this.bounds = new Rect(null, left, top, right, bottom);\n this.scans = [];\n for (let i = 0; i < scanCnt; i++) {\n this.scans.push(new Scan(reader));\n }\n this._updateComplexity();\n } else if (copy != null) {\n this.bounds = copy.bounds != null ? copy.bounds.clone() : null;\n if (copy.scans != null) {\n this.scans = [];\n for (let i = 0; i < copy.scans.length; i++) {\n this.scans.push(copy.scans[i].clone());\n }\n } else {\n this.scans = null;\n }\n this.complexity = copy.complexity;\n } else {\n this.bounds = null;\n this.scans = null;\n this.complexity = 0;\n }\n }\n\n public clone() {\n return new Region(null, this);\n }\n\n public toString() {\n const _complexity = [\"null\", \"simple\", \"complex\"];\n return \"{complexity: \" + _complexity[this.complexity]\n + \" bounds: \" + (this.bounds != null ? this.bounds.toString() : \"[none]\")\n + \" #scans: \" + (this.scans != null ? this.scans.length : \"[none]\") + \"}\";\n }\n\n public _updateComplexity() {\n if (this.bounds == null) {\n this.complexity = 0;\n this.scans = null;\n } else if (this.bounds.empty()) {\n this.complexity = 0;\n this.scans = null;\n this.bounds = null;\n } else if (this.scans == null) {\n this.complexity = 1;\n } else {\n this.complexity = 2;\n if (this.scans.length === 1) {\n const scan = this.scans[0];\n if (scan.top === this.bounds.top && scan.bottom === this.bounds.bottom && scan.scanlines.length === 1) {\n const scanline = scan.scanlines[0];\n if (scanline.left === this.bounds.left && scanline.right === this.bounds.right) {\n this.scans = null;\n this.complexity = 1;\n }\n }\n }\n }\n }\n\n public subtract(rect: Rect) {\n Helper.log(\"[wmf] Region \" + this.toString() + \" subtract \" + rect.toString());\n\n if (this.bounds != null) {\n const isect = this.bounds.intersect(rect);\n if (isect != null) { // Only need to do anything if there is any chance of an overlap\n if (this.scans == null) {\n // We currently have a simple region and there is some kind of an overlap.\n // We need to create scanlines now. Simplest method is to fake one scan line\n // that equals the simple region and re-use the same logic as for complex regions\n this.scans = [];\n this.scans.push( new Scan(null, null, this.bounds.top, this.bounds.bottom,\n [{left: this.bounds.left, right: this.bounds.right}]));\n this.complexity = 2;\n }\n\n // We (now) have a complex region. First we skip any scans that are entirely above rect.top\n // The first scan that falls partially below rect.top needs to be split into two scans.\n let si = 0;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.bottom >= rect.top) {\n // We need to clone this scan into two so that we can subtract from the second one\n const cloned = scan.clone();\n scan.bottom = rect.top - 1;\n cloned.top = rect.top;\n if (scan.top >= scan.bottom) {\n this.scans[si] = cloned;\n } else {\n Helper.log(\"[wmf] Region split top scan \" + si + \" for substraction\");\n this.scans.splice(++si, 0, cloned);\n }\n break;\n }\n si++;\n }\n\n // Now find the first one that falls at least partially below rect.bottom, which needs to be\n // split if it is only partially below rect.bottom\n const first = si;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.top > rect.bottom) {\n break;\n }\n if (scan.bottom > rect.bottom) {\n // We need to clone this scan into two so that we can subtract from the first one\n const cloned = scan.clone();\n scan.bottom = rect.bottom;\n cloned.top = rect.bottom + 1;\n if (scan.top >= scan.bottom) {\n this.scans[si] = cloned;\n } else {\n Helper.log(\"[wmf] Region split bottom scan \" + si + \" for substraction\");\n this.scans.splice(++si, 0, cloned);\n }\n break;\n }\n si++;\n }\n\n // Now perform a subtraction on each scan in between rect.top and rect.bottom. Because we\n // cloned scans that partially overlapped rect.top and rect.bottom, we don't have to\n // account for this anymore.\n if (first < this.scans.length) {\n let last = si;\n si = first;\n while (si < last) {\n const scan = this.scans[si];\n if (!scan.subtract(rect.left, rect.right)) {\n Helper.log(\"[wmf] Region remove now empty scan \" + si + \" due to subtraction\");\n this.scans.splice(si, 1);\n last--;\n continue;\n }\n\n si++;\n }\n }\n\n // Update bounds\n if (this.scans != null) {\n let left;\n let top;\n let right;\n let bottom;\n const len = this.scans.length;\n for (let i = 0; i < len; i++) {\n const scan = this.scans[i];\n if (i === 0) {\n top = scan.top;\n }\n if (i === len - 1) {\n bottom = scan.bottom;\n }\n\n const slen = scan.scanlines.length;\n if (slen > 0) {\n let scanline = scan.scanlines[0];\n if (left == null || scanline.left < left) {\n left = scanline.left;\n }\n scanline = scan.scanlines[slen - 1];\n if (right == null || scanline.right > right) {\n right = scanline.right;\n }\n }\n }\n\n if (left != null && top != null && right != null && bottom != null) {\n this.bounds = new Rect(null, left, top, right, bottom);\n this._updateComplexity();\n } else {\n // This has to be a null region now\n this.bounds = null;\n this.scans = null;\n this.complexity = 0;\n }\n } else {\n this._updateComplexity();\n }\n }\n }\n\n Helper.log(\"[wmf] Region subtraction -> \" + this.toString());\n }\n\n public intersect(rect: Rect) {\n Helper.log(\"[wmf] Region \" + this.toString() + \" intersect with \" + rect.toString());\n if (this.bounds != null) {\n this.bounds = this.bounds.intersect(rect);\n if (this.bounds != null) {\n if (this.scans != null) {\n let si = 0;\n // Remove any scans that are entirely above the new bounds.top\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.bottom < this.bounds.top) {\n si++;\n } else {\n break;\n }\n }\n if (si > 0) {\n Helper.log(\"[wmf] Region remove \" + si + \" scans from top\");\n this.scans.splice(0, si);\n\n // Adjust the first scan's top to match the new bounds.top\n if (this.scans.length > 0) {\n this.scans[0].top = this.bounds.top;\n }\n }\n\n // Get rid of anything that falls outside the new bounds.left/bounds.right\n si = 0;\n while (si < this.scans.length) {\n const scan = this.scans[si];\n if (scan.top > this.bounds.bottom) {\n // Remove this and all remaining scans that fall entirely below the new bounds.bottom\n Helper.log(\"[wmf] Region remove \" + (this.scans.length - si) + \" scans from bottom\");\n this.scans.splice(si, this.scans.length - si);\n break;\n }\n if (!scan.intersect(this.bounds.left, this.bounds.right)) {\n // Remove now empty scan\n Helper.log(\"[wmf] Region remove now empty scan \" + si + \" due to intersection\");\n this.scans.splice(si, 1);\n continue;\n }\n si++;\n }\n\n // If there are any scans left, adjust the last one's bottom to the new bounds.bottom\n if (this.scans.length > 0) {\n this.scans[this.scans.length - 1].bottom = this.bounds.bottom;\n }\n\n this._updateComplexity();\n }\n } else {\n this.scans = null;\n this.complexity = 0;\n }\n }\n Helper.log(\"[wmf] Region intersection -> \" + this.toString());\n }\n\n public offset(offX: number, offY: number) {\n if (this.bounds != null) {\n this.bounds.left += offX;\n this.bounds.top += offY;\n this.bounds.right += offX;\n this.bounds.bottom += offY;\n }\n\n if (this.scans != null) {\n const slen = this.scans.length;\n for (let si = 0; si < slen; si++) {\n const scan = this.scans[si];\n scan.top += offY;\n scan.bottom += offY;\n\n const len = scan.scanlines.length;\n for (let i = 0; i < len; i++) {\n const scanline = scan.scanlines[i];\n scanline.left += offX;\n scanline.right += offX;\n }\n }\n }\n }\n}\n\nexport function CreateSimpleRegion(left: number, top: number, right: number, bottom: number) {\n const rgn = new Region(null, null);\n rgn.bounds = new Rect(null, left, top, right, bottom);\n rgn._updateComplexity();\n return rgn;\n}\n\nexport class Scan {\n public top: number;\n public bottom: number;\n public scanlines: Array<{left: number, right: number}>;\n\n constructor(reader: Blob, copy?: Scan, top?: number, bottom?: number,\n scanlines?: Array<{left: number, right: number}>) {\n if (reader != null) {\n const cnt = reader.readUint16();\n this.top = reader.readUint16();\n this.bottom = reader.readUint16();\n this.scanlines = [];\n for (let i = 0; i < cnt; i++) {\n const left = reader.readUint16();\n const right = reader.readUint16();\n this.scanlines.push({left, right});\n }\n reader.skip(2);\n } else if (copy != null) {\n this.top = copy.top;\n this.bottom = copy.bottom;\n this.scanlines = [];\n for (let i = 0; i < copy.scanlines.length; i++) {\n const scanline = copy.scanlines[i];\n this.scanlines.push({left: scanline.left, right: scanline.right});\n }\n } else {\n this.top = top;\n this.bottom = bottom;\n this.scanlines = scanlines;\n }\n }\n\n public clone() {\n return new Scan(null, this);\n }\n\n public subtract(left: number, right: number) {\n let i;\n\n // Keep everything on the left side\n i = 0;\n while (i < this.scanlines.length) {\n const scanline = this.scanlines[i];\n if (scanline.left <= left) {\n if (scanline.right >= left) {\n scanline.right = left - 1;\n if (scanline.left >= scanline.right) {\n this.scanlines.splice(i, 1);\n continue;\n }\n }\n i++;\n } else {\n break;\n }\n }\n\n // Find the first one that may exceed to the right side\n const first = i;\n let cnt = 0;\n while (i < this.scanlines.length) {\n const scanline = this.scanlines[i];\n if (scanline.right > right) {\n scanline.left = right;\n cnt = i - first;\n if (scanline.left >= scanline.right) {\n cnt++;\n }\n break;\n }\n i++;\n }\n\n // Delete everything we're subtracting\n if (cnt > 0 && first < this.scanlines.length) {\n this.scanlines.splice(first, cnt);\n }\n\n return this.scanlines.length > 0;\n }\n\n public intersect(left: number, right: number) {\n // Get rid of anything that falls entirely outside to the left\n for (let i = 0; i < this.scanlines.length; i++) {\n const scanline = this.scanlines[i];\n if (scanline.left >= left || scanline.right >= left) {\n if (i > 0) {\n this.scanlines.splice(0, i);\n }\n break;\n }\n }\n\n if (this.scanlines.length > 0) {\n // Adjust the first to match the left, if needed\n let scanline = this.scanlines[0];\n if (scanline.left < left) {\n scanline.left = left;\n }\n\n // Get rid of anything that falls entirely outside to the right\n for (let i = 0; i < this.scanlines.length; i++) {\n scanline = this.scanlines[i];\n if (scanline.left > right) {\n this.scanlines.splice(i, this.scanlines.length - i);\n break;\n }\n }\n\n if (this.scanlines.length > 0) {\n // Adjust the last to match the right, if needed\n scanline = this.scanlines[this.scanlines.length - 1];\n if (scanline.right > right) {\n scanline.right = right;\n }\n }\n }\n return this.scanlines.length > 0;\n }\n\n public toString() {\n return \"{ #scanlines: \" + this.scanlines.length + \"}\";\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\n\nexport class BitmapBase {\n public getWidth() {\n throw new WMFJSError(\"getWidth not implemented\");\n }\n\n public getHeight() {\n throw new WMFJSError(\"getHeight not implemented\");\n }\n}\n\nexport class BitmapCoreHeader {\n public width: number;\n public height: number;\n public planes: number;\n public bitcount: number;\n\n constructor(reader: Blob, skipsize: boolean) {\n if (skipsize) {\n reader.skip(4);\n }\n this.width = reader.readUint16();\n this.height = reader.readUint16();\n this.planes = reader.readUint16();\n this.bitcount = reader.readUint16();\n }\n\n public colors() {\n return this.bitcount <= 8 ? 1 << this.bitcount : 0;\n }\n}\n\nexport class BitmapInfoHeader {\n public width: number;\n public height: number;\n public planes: number;\n public bitcount: number;\n public compression: number;\n public sizeimage: number;\n public xpelspermeter: number;\n public ypelspermeter: number;\n public clrused: number;\n public clrimportant: number;\n\n constructor(reader: Blob, skipsize: boolean) {\n if (skipsize) {\n reader.skip(4);\n }\n this.width = reader.readInt32();\n this.height = reader.readInt32();\n this.planes = reader.readUint16();\n this.bitcount = reader.readUint16();\n this.compression = reader.readUint32();\n this.sizeimage = reader.readUint32();\n this.xpelspermeter = reader.readInt32();\n this.ypelspermeter = reader.readInt32();\n this.clrused = reader.readUint32();\n this.clrimportant = reader.readUint32();\n }\n\n public colors() {\n if (this.clrused !== 0) {\n return this.clrused < 256 ? this.clrused : 256;\n } else {\n return this.bitcount > 8 ? 0 : 1 << this.bitcount;\n }\n }\n}\n\nexport class BitmapInfo extends BitmapBase {\n private _reader: Blob;\n private _offset: number;\n private _usergb: boolean;\n private _infosize: number;\n private _header: BitmapCoreHeader | BitmapInfoHeader;\n\n constructor(reader: Blob, usergb: boolean) {\n super();\n this._reader = reader;\n this._offset = reader.pos;\n this._usergb = usergb;\n const hdrsize = reader.readUint32();\n this._infosize = hdrsize;\n if (hdrsize === Helper.GDI.BITMAPCOREHEADER_SIZE) {\n this._header = new BitmapCoreHeader(reader, false);\n this._infosize += this._header.colors() * (usergb ? 3 : 2);\n } else {\n this._header = new BitmapInfoHeader(reader, false);\n const masks =\n (this._header as BitmapInfoHeader).compression === Helper.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;\n if (hdrsize <= Helper.GDI.BITMAPINFOHEADER_SIZE + (masks * 4)) {\n this._infosize = Helper.GDI.BITMAPINFOHEADER_SIZE + (masks * 4);\n }\n this._infosize += this._header.colors() * (usergb ? 4 : 2);\n }\n }\n\n public getWidth() {\n return this._header.width;\n }\n\n public getHeight() {\n return Math.abs(this._header.height);\n }\n\n public infosize() {\n return this._infosize;\n }\n\n public header() {\n return this._header;\n }\n}\n\nexport class DIBitmap extends BitmapBase {\n private _reader: Blob;\n private _offset: number;\n private _size: number;\n private _info: BitmapInfo;\n\n constructor(reader: Blob, size: number) {\n super();\n this._reader = reader;\n this._offset = reader.pos;\n this._size = size;\n this._info = new BitmapInfo(reader, true);\n }\n\n public getWidth() {\n return this._info.getWidth();\n }\n\n public getHeight() {\n return this._info.getHeight();\n }\n\n public base64ref() {\n const prevpos = this._reader.pos;\n this._reader.seek(this._offset);\n let mime = \"image/bmp\";\n const header = this._info.header();\n let data;\n if (header instanceof BitmapInfoHeader && header.compression != null) {\n switch (header.compression) {\n case Helper.GDI.BitmapCompression.BI_JPEG:\n mime = \"data:image/jpeg\";\n break;\n case Helper.GDI.BitmapCompression.BI_PNG:\n mime = \"data:image/png\";\n break;\n default:\n data = this.makeBitmapFileHeader();\n break;\n }\n } else {\n data = this.makeBitmapFileHeader();\n }\n\n if (data != null) {\n data += this._reader.readBinary(this._size);\n } else {\n data = this._reader.readBinary(this._size);\n }\n\n const ref = \"data:\" + mime + \";base64,\" + btoa(data);\n this._reader.seek(prevpos);\n return ref;\n }\n\n private makeBitmapFileHeader() {\n const buf = new ArrayBuffer(14);\n const view = new Uint8Array(buf);\n view[0] = 0x42;\n view[1] = 0x4d;\n Helper._writeUint32Val(view, 2, this._size + 14);\n Helper._writeUint32Val(view, 10, this._info.infosize() + 14);\n return Helper._blobToBinary(view);\n }\n}\n\nexport class Bitmap16 extends BitmapBase {\n public type: number;\n public width: number;\n public height: number;\n public widthBytes: number;\n public planes: number;\n public bitsPixel: number;\n public bitsOffset: number;\n public bitsSize: number;\n private _reader: Blob;\n private _offset: number;\n private _size: number;\n\n constructor(reader: Blob, size: number | Bitmap16) {\n super();\n if (reader != null) {\n size = size as number;\n this._reader = reader;\n this._offset = reader.pos;\n this._size = size;\n this.type = reader.readInt16();\n this.width = reader.readInt16();\n this.height = reader.readInt16();\n this.widthBytes = reader.readInt16();\n this.planes = reader.readUint8();\n this.bitsPixel = reader.readUint8();\n this.bitsOffset = reader.pos;\n this.bitsSize = (((this.width * this.bitsPixel + 15) >> 4) << 1) * this.height;\n if (this.bitsSize > size - 10) {\n throw new WMFJSError(\"Bitmap should have \" + this.bitsSize + \" bytes, but has \" + (size - 10));\n }\n } else {\n const copy = size as Bitmap16;\n this._reader = copy._reader;\n this._offset = copy._offset;\n this._size = copy._size;\n this.type = copy.type;\n this.width = copy.width;\n this.height = copy.height;\n this.widthBytes = copy.widthBytes;\n this.planes = copy.planes;\n this.bitsPixel = copy.bitsPixel;\n this.bitsOffset = copy.bitsOffset;\n this.bitsSize = copy.bitsSize;\n }\n }\n\n public getWidth() {\n return this.width;\n }\n\n public getHeight() {\n return this.height;\n }\n\n public clone() {\n return new Bitmap16(null, this);\n }\n}\n\nexport class PatternBitmap16 extends Bitmap16 {\n constructor(reader: Blob, size: number | Bitmap16) {\n super(reader, size);\n if (reader != null) {\n this.bitsOffset += 22; // skip bits (4 bytes) + reserved (18 bytes)\n }\n }\n\n public clone(): PatternBitmap16 {\n return new PatternBitmap16(null, this);\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Bitmap16, DIBitmap, PatternBitmap16 } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { Helper } from \"./Helper\";\nimport { Obj, PointS } from \"./Primitives\";\n\nexport class ColorRef {\n public r: number;\n public g: number;\n public b: number;\n\n constructor(reader: Blob, r?: number, g?: number, b?: number) {\n if (reader != null) {\n this.r = reader.readUint8();\n this.g = reader.readUint8();\n this.b = reader.readUint8();\n reader.skip(1);\n } else {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n }\n\n public clone() {\n return new ColorRef(null, this.r, this.g, this.b);\n }\n\n public toHex() {\n const rgb = (this.r << 16) | (this.g << 8) | this.b;\n return (0x1000000 + rgb).toString(16).slice(1);\n }\n\n public toString() {\n return \"{r: \" + this.r + \", g: \" + this.g + \", b: \" + this.b + \"}\";\n }\n}\n\nexport class Font extends Obj {\n public height: number;\n public width: number;\n public escapement: number;\n public orientation: number;\n public weight: number;\n public italic: number;\n public underline: number;\n public strikeout: number;\n public charset: number;\n public outprecision: number;\n public clipprecision: number;\n public quality: number;\n public pitch: number;\n public family: number;\n public facename: string;\n\n constructor(reader: Blob, copy: Font | number) {\n super(\"font\");\n if (reader != null) {\n this.height = reader.readInt16();\n this.width = reader.readInt16();\n this.escapement = reader.readInt16();\n this.orientation = reader.readInt16();\n this.weight = reader.readInt16();\n this.italic = reader.readUint8();\n this.underline = reader.readUint8();\n this.strikeout = reader.readUint8();\n this.charset = reader.readUint8();\n this.outprecision = reader.readUint8();\n this.clipprecision = reader.readUint8();\n this.quality = reader.readUint8();\n const pitchAndFamily = reader.readUint8();\n this.pitch = pitchAndFamily & 0xf; // TODO: double check\n this.family = (pitchAndFamily >> 6) & 0x3; // TODO: double check\n\n const dataLength = copy as number;\n const start = reader.pos;\n this.facename = reader.readNullTermString(Math.min(dataLength - (reader.pos - start), 32));\n } else if (copy != null) {\n copy = copy as Font;\n this.height = copy.height;\n this.width = copy.width;\n this.escapement = copy.escapement;\n this.orientation = copy.orientation;\n this.weight = copy.weight;\n this.italic = copy.italic;\n this.underline = copy.underline;\n this.strikeout = copy.strikeout;\n this.charset = copy.charset;\n this.outprecision = copy.outprecision;\n this.clipprecision = copy.clipprecision;\n this.quality = copy.quality;\n this.pitch = copy.pitch;\n this.family = copy.family;\n this.facename = copy.facename;\n } else {\n // TODO: Values for a default font?\n this.height = -80;\n this.width = 0;\n this.escapement = 0;\n this.orientation = 0;\n this.weight = 400;\n this.italic = 0;\n this.underline = 0;\n this.strikeout = 0;\n this.charset = 0;\n this.outprecision = 0;\n this.clipprecision = 0;\n this.quality = 0;\n this.pitch = 0;\n this.family = 0;\n this.facename = \"Helvetica\";\n }\n }\n\n public clone() {\n return new Font(null, this);\n }\n\n public toString() {\n return JSON.stringify(this);\n }\n}\n\nexport class Brush extends Obj {\n public style: number;\n public color: ColorRef;\n public pattern: Bitmap16;\n public colorusage: number;\n public dibpatternpt: DIBitmap;\n public hatchstyle: number;\n\n constructor(reader: Blob, copy: Brush | number, forceDibPattern?: boolean | PatternBitmap16) {\n super(\"brush\");\n if (reader != null) {\n const dataLength = copy as number;\n const start = reader.pos;\n\n if (forceDibPattern === true || forceDibPattern === false) {\n this.style = reader.readUint16();\n if (forceDibPattern && this.style !== Helper.GDI.BrushStyle.BS_PATTERN) {\n this.style = Helper.GDI.BrushStyle.BS_DIBPATTERNPT;\n }\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n this.color = new ColorRef(reader);\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n reader.skip(forceDibPattern ? 2 : 6);\n this.pattern = new Bitmap16(reader, dataLength - (reader.pos - start));\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n this.colorusage = forceDibPattern ? reader.readUint16() : reader.readUint32();\n if (!forceDibPattern) {\n reader.skip(2);\n }\n this.dibpatternpt = new DIBitmap(reader, dataLength - (reader.pos - start));\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n this.color = new ColorRef(reader);\n this.hatchstyle = reader.readUint16();\n break;\n }\n } else if (forceDibPattern instanceof PatternBitmap16) {\n this.style = Helper.GDI.BrushStyle.BS_PATTERN;\n this.pattern = forceDibPattern;\n }\n } else if (copy != null) {\n copy = copy as Brush;\n this.style = copy.style;\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n this.color = copy.color.clone();\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n this.pattern = copy.pattern.clone();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n this.colorusage = copy.colorusage;\n this.dibpatternpt = copy.dibpatternpt;\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n this.color = copy.color.clone();\n this.hatchstyle = copy.hatchstyle;\n break;\n }\n }\n }\n\n public clone() {\n return new Brush(null, this);\n }\n\n public toString() {\n let ret = \"{style: \" + this.style;\n switch (this.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n ret += \", color: \" + this.color.toString();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n ret += \", colorusage: \" + this.colorusage;\n break;\n case Helper.GDI.BrushStyle.BS_HATCHED:\n ret += \", color: \" + this.color.toString() + \", hatchstyle: \" + this.hatchstyle;\n break;\n }\n return ret + \"}\";\n }\n}\n\nexport class Pen extends Obj {\n public style: number;\n public width: PointS;\n public color: ColorRef;\n public linecap: number;\n public join: number;\n\n constructor(reader: Blob, style?: number, width?: PointS, color?: ColorRef, linecap?: number, join?: number) {\n super(\"pen\");\n if (reader != null) {\n style = reader.readUint16();\n this.style = style & 0xFF;\n this.width = new PointS(reader);\n this.color = new ColorRef(reader);\n this.linecap = (style & (Helper.GDI.PenStyle.PS_ENDCAP_SQUARE | Helper.GDI.PenStyle.PS_ENDCAP_FLAT));\n this.join = (style & (Helper.GDI.PenStyle.PS_JOIN_BEVEL | Helper.GDI.PenStyle.PS_JOIN_MITER));\n } else {\n this.style = style;\n this.width = width;\n this.color = color;\n this.linecap = linecap;\n this.join = join;\n }\n }\n\n public clone() {\n return new Pen(null, this.style, this.width.clone(), this.color.clone(), this.linecap, this.join);\n }\n\n public toString() {\n return \"{style: \" + this.style + \", width: \" + this.width.toString() + \", color: \" + this.color.toString()\n + \", linecap: \" + this.linecap + \", join: \" + this.join + \"}\";\n }\n}\n\nexport class PaletteEntry {\n public flag: number;\n public b: number;\n public g: number;\n public r: number;\n\n constructor(reader: Blob, copy?: PaletteEntry) {\n if (reader != null) {\n this.flag = reader.readUint8();\n this.b = reader.readUint8();\n this.g = reader.readUint8();\n this.r = reader.readUint8();\n } else {\n this.flag = copy.flag;\n this.b = copy.b;\n this.g = copy.g;\n this.r = copy.r;\n }\n }\n\n public clone() {\n return new PaletteEntry(null, this);\n }\n}\n\nexport class Palette extends Obj {\n public start: number;\n public entries: PaletteEntry[];\n\n constructor(reader: Blob, copy?: Palette) {\n super(\"palette\");\n if (reader != null) {\n this.start = reader.readUint16();\n const cnt = reader.readUint16();\n this.entries = [];\n while (cnt > 0) {\n this.entries.push(new PaletteEntry(reader));\n }\n } else {\n this.start = copy.start;\n this.entries = [];\n const len = copy.entries.length;\n for (let i = 0; i < len; i++) {\n this.entries.push(copy.entries[i]);\n }\n }\n }\n\n public clone() {\n return new Palette(null, this);\n }\n\n public toString() {\n return \"{ #entries: \" + this.entries.length + \"}\"; // TODO\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { DIBitmap } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { Obj, PointS, Rect } from \"./Primitives\";\nimport { CreateSimpleRegion, Region } from \"./Region\";\nimport { Brush, ColorRef, Font, Palette, Pen } from \"./Style\";\n\nexport interface ISelectedStyle {\n brush?: Brush;\n pen?: Pen;\n font?: Font;\n palette?: Palette;\n region?: Region;\n [key: string]: Obj;\n}\n\nexport class GDIContextState {\n public _svggroup: any;\n public _svgclipChanged: boolean;\n public _svgtextbkfilter: any;\n public mapmode: number;\n public stretchmode: number;\n public textalign: number;\n public bkmode: number;\n public textcolor: ColorRef;\n public bkcolor: ColorRef;\n public polyfillmode: number;\n public wx: number;\n public wy: number;\n public ww: number;\n public wh: number;\n public vx: number;\n public vy: number;\n public vw: number;\n public vh: number;\n public x: number;\n public y: number;\n public clip: Region;\n public ownclip: boolean;\n public selected: ISelectedStyle;\n\n constructor(copy: GDIContextState, defObjects?: ISelectedStyle) {\n if (copy != null) {\n this._svggroup = copy._svggroup;\n this._svgclipChanged = copy._svgclipChanged;\n this._svgtextbkfilter = copy._svgtextbkfilter;\n this.mapmode = copy.mapmode;\n this.stretchmode = copy.stretchmode;\n this.textalign = copy.textalign;\n this.bkmode = copy.bkmode;\n this.textcolor = copy.textcolor.clone();\n this.bkcolor = copy.bkcolor.clone();\n this.polyfillmode = copy.polyfillmode;\n this.wx = copy.wx;\n this.wy = copy.wy;\n this.ww = copy.ww;\n this.wh = copy.wh;\n this.vx = copy.vx;\n this.vy = copy.vy;\n this.vw = copy.vw;\n this.vh = copy.vh;\n this.x = copy.x;\n this.y = copy.y;\n\n this.clip = copy.clip;\n this.ownclip = false;\n\n this.selected = {};\n for (const type in copy.selected) {\n this.selected[type] = copy.selected[type];\n }\n } else {\n this._svggroup = null;\n this._svgclipChanged = false;\n this._svgtextbkfilter = null;\n this.mapmode = Helper.GDI.MapMode.MM_ANISOTROPIC;\n this.stretchmode = Helper.GDI.StretchMode.COLORONCOLOR;\n this.textalign = 0; // TA_LEFT | TA_TOP | TA_NOUPDATECP\n this.bkmode = Helper.GDI.MixMode.OPAQUE;\n this.textcolor = new ColorRef(null, 0, 0, 0);\n this.bkcolor = new ColorRef(null, 255, 255, 255);\n this.polyfillmode = Helper.GDI.PolyFillMode.ALTERNATE;\n this.wx = 0;\n this.wy = 0;\n this.ww = 0;\n this.wh = 0;\n this.vx = 0;\n this.vy = 0;\n this.vw = 0;\n this.vh = 0;\n this.x = 0;\n this.y = 0;\n\n this.clip = null;\n this.ownclip = false;\n\n this.selected = {};\n for (const type in defObjects) {\n const defObj = defObjects[type];\n this.selected[type] = defObj != null ? defObj.clone() : null;\n }\n }\n }\n}\n\nexport class GDIContext {\n private _svg: any;\n private _svgdefs: any;\n private _svgPatterns: {[key: string]: Brush};\n private _svgClipPaths: {[key: string]: Region};\n private defObjects: ISelectedStyle;\n private state: GDIContextState;\n private statestack: GDIContextState[];\n private objects: {[key: string]: Obj};\n\n constructor(svg: any) {\n this._svg = svg;\n this._svgdefs = null;\n this._svgPatterns = {};\n this._svgClipPaths = {};\n\n this.defObjects = {\n brush: new Brush(null, null),\n pen: new Pen(null, Helper.GDI.PenStyle.PS_SOLID, new PointS(null, 1, 1), new ColorRef(null, 0, 0, 0), 0, 0),\n font: new Font(null, null),\n palette: null,\n region: null,\n };\n\n this.state = new GDIContextState(null, this.defObjects);\n this.statestack = [this.state];\n this.objects = {};\n }\n\n public setMapMode(mode: number) {\n Helper.log(\"[gdi] setMapMode: mode=\" + mode);\n this.state.mapmode = mode;\n this.state._svggroup = null;\n }\n\n public setWindowOrg(x: number, y: number) {\n Helper.log(\"[gdi] setWindowOrg: x=\" + x + \" y=\" + y);\n this.state.wx = x;\n this.state.wy = y;\n this.state._svggroup = null;\n }\n\n public setWindowExt(x: number, y: number) {\n Helper.log(\"[gdi] setWindowExt: x=\" + x + \" y=\" + y);\n this.state.ww = x;\n this.state.wh = y;\n this.state._svggroup = null;\n }\n\n public offsetWindowOrg(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetWindowOrg: offX=\" + offX + \" offY=\" + offY);\n this.state.wx += offX;\n this.state.wy += offY;\n this.state._svggroup = null;\n }\n\n public setViewportOrg(x: number, y: number) {\n Helper.log(\"[gdi] setViewportOrg: x=\" + x + \" y=\" + y);\n this.state.vx = x;\n this.state.vy = y;\n this.state._svggroup = null;\n }\n\n public setViewportExt(x: number, y: number) {\n Helper.log(\"[gdi] setViewportExt: x=\" + x + \" y=\" + y);\n this.state.vw = x;\n this.state.vh = y;\n this.state._svggroup = null;\n }\n\n public offsetViewportOrg(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetViewportOrg: offX=\" + offX + \" offY=\" + offY);\n this.state.vx += offX;\n this.state.vy += offY;\n this.state._svggroup = null;\n }\n\n public saveDC() {\n Helper.log(\"[gdi] saveDC\");\n const prevstate = this.state;\n this.state = new GDIContextState(this.state);\n this.statestack.push(prevstate);\n this.state._svggroup = null;\n }\n\n public restoreDC(saved: number) {\n Helper.log(\"[gdi] restoreDC: saved=\" + saved);\n if (this.statestack.length > 1) {\n if (saved === -1) {\n this.state = this.statestack.pop();\n } else if (saved < -1) {\n throw new WMFJSError(\"restoreDC: relative restore not implemented\");\n } else if (saved > 1) {\n throw new WMFJSError(\"restoreDC: absolute restore not implemented\");\n }\n } else {\n throw new WMFJSError(\"No saved contexts\");\n }\n\n this.state._svggroup = null;\n }\n\n public escape(func: number, blob: Blob, offset: number, count: number) {\n Helper.log(\"[gdi] escape: func=\" + func + \" offset=\" + offset + \" count=\" + count);\n }\n\n public setStretchBltMode(stretchMode: number) {\n Helper.log(\"[gdi] setStretchBltMode: stretchMode=\" + stretchMode);\n }\n\n public stretchDib(srcX: number, srcY: number, srcW: number, srcH: number,\n dstX: number, dstY: number, dstW: number, dstH: number,\n rasterOp: number, colorUsage: number, dib: DIBitmap) {\n Helper.log(\"[gdi] stretchDib: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n srcX = this._todevX(srcX);\n srcY = this._todevY(srcY);\n srcW = this._todevW(srcW);\n srcH = this._todevH(srcH);\n dstX = this._todevX(dstX);\n dstY = this._todevY(dstY);\n dstW = this._todevW(dstW);\n dstH = this._todevH(dstH);\n Helper.log(\"[gdi] stretchDib: TRANSLATED: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16) + \" colorUsage=0x\" + colorUsage.toString(16));\n this._pushGroup();\n this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());\n }\n\n public stretchDibBits(srcX: number, srcY: number, srcW: number, srcH: number,\n dstX: number, dstY: number, dstW: number, dstH: number,\n rasterOp: number, dib: DIBitmap) {\n Helper.log(\"[gdi] stretchDibBits: srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n srcX = this._todevX(srcX);\n srcY = this._todevY(srcY);\n srcW = this._todevW(srcW);\n srcH = this._todevH(srcH);\n dstX = this._todevX(dstX);\n dstY = this._todevY(dstY);\n dstW = this._todevW(dstW);\n dstH = this._todevH(dstH);\n Helper.log(\"[gdi] stretchDibBits: TRANSLATED:\"\n + \" srcX=\" + srcX + \" srcY=\" + srcY + \" srcW=\" + srcW + \" srcH=\" + srcH\n + \" dstX=\" + dstX + \" dstY=\" + dstY + \" dstW=\" + dstW + \" dstH=\" + dstH\n + \" rasterOp=0x\" + rasterOp.toString(16));\n this._pushGroup();\n this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());\n }\n\n public rectangle(rect: Rect, rw: number, rh: number) {\n Helper.log(\"[gdi] rectangle: rect=\" + rect.toString() + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const bottom = this._todevY(rect.bottom);\n const right = this._todevX(rect.right);\n const top = this._todevY(rect.top);\n const left = this._todevX(rect.left);\n rw = this._todevH(rw);\n rh = this._todevH(rh);\n Helper.log(\"[gdi] rectangle: TRANSLATED: bottom=\" + bottom + \" right=\" + right + \" top=\" + top\n + \" left=\" + left + \" rh=\" + rh + \" rw=\" + rw);\n this._pushGroup();\n\n const opts = this._applyOpts(null, true, true, false);\n this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);\n }\n\n public textOut(x: number, y: number, text: string) {\n Helper.log(\"[gdi] textOut: x=\" + x + \" y=\" + y + \" text=\" + text\n + \" with font \" + this.state.selected.font.toString());\n x = this._todevX(x);\n y = this._todevY(y);\n Helper.log(\"[gdi] textOut: TRANSLATED: x=\" + x + \" y=\" + y);\n this._pushGroup();\n\n const opts = this._applyOpts(null, false, false, true);\n if (this.state.selected.font.escapement !== 0) {\n opts.transform = \"rotate(\" + [(-this.state.selected.font.escapement / 10), x, y] + \")\";\n opts.style = \"dominant-baseline: middle; text-anchor: start;\";\n }\n if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {\n if (this.state._svgtextbkfilter == null) {\n const filterId = Helper._makeUniqueId(\"f\");\n const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);\n this._svg.filters.flood(filter, null, \"#\" + this.state.bkcolor.toHex(), 1.0);\n this._svg.filters.composite(filter, null, null, \"SourceGraphic\");\n this.state._svgtextbkfilter = filter;\n }\n\n opts.filter = \"url(#\" + $(this.state._svgtextbkfilter).attr(\"id\") + \")\";\n }\n this._svg.text(this.state._svggroup, x, y, text, opts);\n }\n\n public extTextOut(x: number, y: number, text: string, fwOpts: number, rect: Rect, dx: number[]) {\n Helper.log(\"[gdi] extTextOut: x=\" + x + \" y=\" + y + \" text=\" + text\n + \" with font \" + this.state.selected.font.toString());\n x = this._todevX(x);\n y = this._todevY(y);\n Helper.log(\"[gdi] extTextOut: TRANSLATED: x=\" + x + \" y=\" + y);\n this._pushGroup();\n\n const opts = this._applyOpts(null, false, false, true);\n if (this.state.selected.font.escapement !== 0) {\n opts.transform = \"rotate(\" + [(-this.state.selected.font.escapement / 10), x, y] + \")\";\n opts.style = \"dominant-baseline: middle; text-anchor: start;\";\n }\n if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {\n if (this.state._svgtextbkfilter == null) {\n const filterId = Helper._makeUniqueId(\"f\");\n const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);\n this._svg.filters.flood(filter, null, \"#\" + this.state.bkcolor.toHex(), 1.0);\n this._svg.filters.composite(filter, null, null, \"SourceGraphic\");\n this.state._svgtextbkfilter = filter;\n }\n\n opts.filter = \"url(#\" + $(this.state._svgtextbkfilter).attr(\"id\") + \")\";\n }\n this._svg.text(this.state._svggroup, x, y, text, opts);\n }\n\n public lineTo(x: number, y: number) {\n Helper.log(\"[gdi] lineTo: x=\" + x + \" y=\" + y + \" with pen \" + this.state.selected.pen.toString());\n const toX = this._todevX(x);\n const toY = this._todevY(y);\n const fromX = this._todevX(this.state.x);\n const fromY = this._todevY(this.state.y);\n\n // Update position\n this.state.x = x;\n this.state.y = y;\n\n Helper.log(\"[gdi] lineTo: TRANSLATED: toX=\" + toX + \" toY=\" + toY + \" fromX=\" + fromX + \" fromY=\" + fromY);\n this._pushGroup();\n\n const opts = this._applyOpts(null, true, false, false);\n this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);\n }\n\n public moveTo(x: number, y: number) {\n Helper.log(\"[gdi] moveTo: x=\" + x + \" y=\" + y);\n this.state.x = x;\n this.state.y = y;\n }\n\n public polygon(points: PointS[], first: boolean) {\n Helper.log(\"[gdi] polygon: points=\" + points + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const pts = [];\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n pts.push([this._todevX(point.x), this._todevY(point.y)]);\n }\n Helper.log(\"[gdi] polygon: TRANSLATED: pts=\" + pts);\n if (first) {\n this._pushGroup();\n }\n const opts = {\n \"fill-rule\": this.state.polyfillmode === Helper.GDI.PolyFillMode.ALTERNATE ? \"evenodd\" : \"nonzero\",\n };\n this._applyOpts(opts, true, true, false);\n this._svg.polygon(this.state._svggroup, pts, opts);\n }\n\n public polyPolygon(polygons: PointS[][]) {\n Helper.log(\"[gdi] polyPolygon: polygons.length=\" + polygons.length\n + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n\n const cnt = polygons.length;\n for (let i = 0; i < cnt; i++) {\n this.polygon(polygons[i], i === 0);\n }\n }\n\n public polyline(points: PointS[]) {\n Helper.log(\"[gdi] polyline: points=\" + points + \" with pen \" + this.state.selected.pen.toString());\n const pts = [];\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n pts.push([this._todevX(point.x), this._todevY(point.y)]);\n }\n Helper.log(\"[gdi] polyline: TRANSLATED: pts=\" + pts);\n this._pushGroup();\n const opts = this._applyOpts({fill: \"none\"}, true, false, false);\n this._svg.polyline(this.state._svggroup, pts, opts);\n }\n\n public ellipse(rect: Rect) {\n Helper.log(\"[gdi] ellipse: rect=\" + rect.toString() + \" with pen \" + this.state.selected.pen.toString()\n + \" and brush \" + this.state.selected.brush.toString());\n const bottom = this._todevY(rect.bottom);\n const right = this._todevX(rect.right);\n const top = this._todevY(rect.top);\n const left = this._todevX(rect.left);\n Helper.log(\"[gdi] ellipse: TRANSLATED: bottom=\" + bottom + \" right=\" + right + \" top=\" + top + \" left=\" + left);\n this._pushGroup();\n const width2 = (right - left) / 2;\n const height2 = (bottom - top) / 2;\n const opts = this._applyOpts(null, true, true, false);\n this._svg.ellipse(this.state._svggroup, left + width2, top + height2, width2, height2, opts);\n }\n\n public excludeClipRect(rect: Rect) {\n Helper.log(\"[gdi] excludeClipRect: rect=\" + rect.toString());\n this._getClipRgn().subtract(rect);\n }\n\n public intersectClipRect(rect: Rect) {\n Helper.log(\"[gdi] intersectClipRect: rect=\" + rect.toString());\n this._getClipRgn().intersect(rect);\n }\n\n public offsetClipRgn(offX: number, offY: number) {\n Helper.log(\"[gdi] offsetClipRgn: offX=\" + offX + \" offY=\" + offY);\n this._getClipRgn().offset(offX, offY);\n }\n\n public setTextAlign(textAlignmentMode: number) {\n Helper.log(\"[gdi] setTextAlign: textAlignmentMode=0x\" + textAlignmentMode.toString(16));\n this.state.textalign = textAlignmentMode;\n }\n\n public setBkMode(bkMode: number) {\n Helper.log(\"[gdi] setBkMode: bkMode=0x\" + bkMode.toString(16));\n this.state.bkmode = bkMode;\n }\n\n public setTextColor(textColor: ColorRef) {\n Helper.log(\"[gdi] setTextColor: textColor=\" + textColor.toString());\n this.state.textcolor = textColor;\n }\n\n public setBkColor(bkColor: ColorRef) {\n Helper.log(\"[gdi] setBkColor: bkColor=\" + bkColor.toString());\n this.state.bkcolor = bkColor;\n this.state._svgtextbkfilter = null;\n }\n\n public setPolyFillMode(polyFillMode: number) {\n Helper.log(\"[gdi] setPolyFillMode: polyFillMode=\" + polyFillMode);\n this.state.polyfillmode = polyFillMode;\n }\n\n public createBrush(brush: Brush) {\n const idx = this._storeObject(brush);\n Helper.log(\"[gdi] createBrush: brush=\" + brush.toString() + \" with handle \" + idx);\n }\n\n public createFont(font: Font) {\n const idx = this._storeObject(font);\n Helper.log(\"[gdi] createFont: font=\" + font.toString() + \" with handle \" + idx);\n }\n\n public createPen(pen: Pen) {\n const idx = this._storeObject(pen);\n Helper.log(\"[gdi] createPen: pen=\" + pen.toString() + \" width handle \" + idx);\n }\n\n public createPalette(palette: Palette) {\n const idx = this._storeObject(palette);\n Helper.log(\"[gdi] createPalette: palette=\" + palette.toString() + \" width handle \" + idx);\n }\n\n public createRegion(region: Region) {\n const idx = this._storeObject(region);\n Helper.log(\"[gdi] createRegion: region=\" + region.toString() + \" width handle \" + idx);\n }\n\n public createPatternBrush(patternBrush: Brush) {\n const idx = this._storeObject(patternBrush);\n Helper.log(\"[gdi] createRegion: region=\" + patternBrush.toString() + \" width handle \" + idx);\n }\n\n public selectObject(objIdx: number, checkType: string) {\n const obj = this._getObject(objIdx);\n if (obj != null && (checkType == null || obj.type === checkType)) {\n this._selectObject(obj);\n Helper.log(\"[gdi] selectObject: objIdx=\" + objIdx\n + (obj ? \" selected \" + obj.type + \": \" + obj.toString() : \"[invalid index]\"));\n } else {\n Helper.log(\"[gdi] selectObject: objIdx=\" + objIdx\n + (obj ? \" invalid object type: \" + obj.type : \"[invalid index]\"));\n }\n }\n\n public deleteObject(objIdx: number) {\n const ret = this._deleteObject(objIdx);\n Helper.log(\"[gdi] deleteObject: objIdx=\" + objIdx + (ret ? \" deleted object\" : \"[invalid index]\"));\n }\n\n private _pushGroup() {\n if (this.state._svggroup == null || this.state._svgclipChanged) {\n this.state._svgclipChanged = false;\n this.state._svgtextbkfilter = null;\n\n const settings: any = {\n viewBox: [this.state.vx, this.state.vy, this.state.vw, this.state.vh].join(\" \"),\n preserveAspectRatio: \"none\",\n };\n if (this.state.clip != null) {\n Helper.log(\"[gdi] new svg x=\" + this.state.vx + \" y=\" + this.state.vy\n + \" width=\" + this.state.vw + \" height=\" + this.state.vh + \" with clipping\");\n settings[\"clip-path\"] = \"url(#\" + this._getSvgClipPathForRegion(this.state.clip) + \")\";\n } else {\n Helper.log(\"[gdi] new svg x=\" + this.state.vx + \" y=\" + this.state.vy\n + \" width=\" + this.state.vw + \" height=\" + this.state.vh + \" without clipping\");\n }\n this.state._svggroup = this._svg.svg(this.state._svggroup,\n this.state.vx, this.state.vy, this.state.vw, this.state.vh, settings);\n }\n }\n\n private _storeObject(obj: Obj) {\n let i = 0;\n while (this.objects[i.toString()] != null && i <= 65535) {\n i++;\n }\n if (i > 65535) {\n Helper.log(\"[gdi] Too many objects!\");\n return -1;\n }\n\n this.objects[i.toString()] = obj;\n return i;\n }\n\n private _getObject(objIdx: number) {\n const obj = this.objects[objIdx.toString()];\n if (obj == null) {\n Helper.log(\"[gdi] No object with handle \" + objIdx);\n }\n return obj;\n }\n\n private _getSvgDef() {\n if (this._svgdefs == null) {\n this._svgdefs = this._svg.defs();\n }\n return this._svgdefs;\n }\n\n private _getSvgClipPathForRegion(region: Region) {\n for (const existingId in this._svgClipPaths) {\n const rgn = this._svgClipPaths[existingId];\n if (rgn === region) {\n return existingId;\n }\n }\n\n const id = Helper._makeUniqueId(\"c\");\n const sclip = this._svg.clipPath(this._getSvgDef(), id, \"userSpaceOnUse\");\n switch (region.complexity) {\n case 1:\n this._svg.rect(sclip, this._todevX(region.bounds.left), this._todevY(region.bounds.top),\n this._todevW(region.bounds.right - region.bounds.left),\n this._todevH(region.bounds.bottom - region.bounds.top),\n { fill: \"black\", strokeWidth: 0 });\n break;\n case 2:\n for (let i = 0; i < region.scans.length; i++) {\n const scan = region.scans[i];\n for (let j = 0; j < scan.scanlines.length; j++) {\n const scanline = scan.scanlines[j];\n this._svg.rect(sclip, this._todevX(scanline.left), this._todevY(scan.top),\n this._todevW(scanline.right - scanline.left), this._todevH(scan.bottom - scan.top),\n { fill: \"black\", strokeWidth: 0 });\n }\n }\n break;\n }\n this._svgClipPaths[id] = region;\n return id;\n }\n\n private _getSvgPatternForBrush(brush: Brush) {\n for (const existingId in this._svgPatterns) {\n const pat = this._svgPatterns[existingId];\n if (pat === brush) {\n return existingId;\n }\n }\n\n let width;\n let height;\n let img;\n switch (brush.style) {\n case Helper.GDI.BrushStyle.BS_PATTERN:\n width = brush.pattern.getWidth();\n height = brush.pattern.getHeight();\n break;\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n width = brush.dibpatternpt.getWidth();\n height = brush.dibpatternpt.getHeight();\n img = brush.dibpatternpt.base64ref();\n break;\n default:\n throw new WMFJSError(\"Invalid brush style\");\n }\n\n const id = Helper._makeUniqueId(\"p\");\n const spat = this._svg.pattern(this._getSvgDef(), id, 0, 0, width, height, {patternUnits: \"userSpaceOnUse\"});\n this._svg.image(spat, 0, 0, width, height, img);\n this._svgPatterns[id] = brush;\n return id;\n }\n\n private _selectObject(obj: Obj) {\n this.state.selected[obj.type] = obj;\n if (obj.type === \"region\") {\n this.state._svgclipChanged = true;\n }\n }\n\n private _deleteObject(objIdx: number) {\n const obj = this.objects[objIdx.toString()];\n if (obj != null) {\n for (let i = 0; i < this.statestack.length; i++) {\n const state = this.statestack[i];\n if (state.selected[obj.type] === obj) {\n state.selected[obj.type] = this.defObjects[obj.type].clone();\n }\n }\n delete this.objects[objIdx.toString()];\n return true;\n }\n\n Helper.log(\"[gdi] Cannot delete object with invalid handle \" + objIdx);\n return false;\n }\n\n private _getClipRgn() {\n if (this.state.clip != null) {\n if (!this.state.ownclip) {\n this.state.clip = this.state.clip.clone();\n }\n } else {\n if (this.state.selected.region != null) {\n this.state.clip = this.state.selected.region.clone();\n } else {\n this.state.clip = CreateSimpleRegion(this.state.wx, this.state.wy, this.state.wx + this.state.ww,\n this.state.wy + this.state.wh);\n }\n }\n this.state.ownclip = true;\n return this.state.clip;\n }\n\n private _todevX(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.wx) * (this.state.vw / this.state.ww)) + this.state.vx;\n }\n\n private _todevY(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.wy) * (this.state.vh / this.state.wh)) + this.state.vy;\n }\n\n private _todevW(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val * (this.state.vw / this.state.ww)) + this.state.vx;\n }\n\n private _todevH(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val * (this.state.vh / this.state.wh)) + this.state.vy;\n }\n\n private _tologicalX(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.vx) / (this.state.vw / this.state.ww)) + this.state.wx;\n }\n\n private _tologicalY(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor((val - this.state.vy) / (this.state.vh / this.state.wh)) + this.state.wy;\n }\n\n private _tologicalW(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val / (this.state.vw / this.state.ww)) + this.state.wx;\n }\n\n private _tologicalH(val: number) {\n // http://wvware.sourceforge.net/caolan/mapmode.html\n // logical -> device\n return Math.floor(val / (this.state.vh / this.state.wh)) + this.state.wy;\n }\n\n private _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {\n if (opts == null) {\n opts = {};\n }\n if (usePen) {\n const pen = this.state.selected.pen;\n if (pen.style !== Helper.GDI.PenStyle.PS_NULL) {\n opts.stroke = \"#\" + pen.color.toHex(), // TODO: pen style\n opts.strokeWidth = this._todevW(pen.width.x); // TODO: is .y ever used?\n\n let dotWidth;\n if ((pen.linecap & Helper.GDI.PenStyle.PS_ENDCAP_SQUARE) !== 0) {\n opts[\"stroke-linecap\"] = \"square\";\n dotWidth = 1;\n } else if ((pen.linecap & Helper.GDI.PenStyle.PS_ENDCAP_FLAT) !== 0) {\n opts[\"stroke-linecap\"] = \"butt\";\n dotWidth = opts.strokeWidth;\n } else {\n opts[\"stroke-linecap\"] = \"round\";\n dotWidth = 1;\n }\n\n if ((pen.join & Helper.GDI.PenStyle.PS_JOIN_BEVEL) !== 0) {\n opts[\"stroke-linejoin\"] = \"bevel\";\n } else if ((pen.join & Helper.GDI.PenStyle.PS_JOIN_MITER) !== 0) {\n opts[\"stroke-linejoin\"] = \"miter\";\n } else {\n opts[\"stroke-linejoin\"] = \"round\";\n }\n\n const dashWidth = opts.strokeWidth * 4;\n const dotSpacing = opts.strokeWidth * 2;\n switch (pen.style) {\n case Helper.GDI.PenStyle.PS_DASH:\n opts[\"stroke-dasharray\"] = [dashWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DOT:\n opts[\"stroke-dasharray\"] = [dotWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DASHDOT:\n opts[\"stroke-dasharray\"] = [dashWidth, dotSpacing, dotWidth, dotSpacing].toString();\n break;\n case Helper.GDI.PenStyle.PS_DASHDOTDOT:\n opts[\"stroke-dasharray\"]\n = [dashWidth, dotSpacing, dotWidth, dotSpacing, dotWidth, dotSpacing].toString();\n break;\n }\n }\n }\n if (useBrush) {\n const brush = this.state.selected.brush;\n switch (brush.style) {\n case Helper.GDI.BrushStyle.BS_SOLID:\n opts.fill = \"#\" + brush.color.toHex();\n break;\n case Helper.GDI.BrushStyle.BS_PATTERN:\n case Helper.GDI.BrushStyle.BS_DIBPATTERNPT:\n opts.fill = \"url(#\" + this._getSvgPatternForBrush(brush) + \")\";\n break;\n case Helper.GDI.BrushStyle.BS_NULL:\n opts.fill = \"none\";\n break;\n default:\n Helper.log(\"[gdi] unsupported brush style: \" + brush.style);\n opts.fill = \"none\";\n break;\n }\n }\n if (useFont) {\n const font = this.state.selected.font;\n opts[\"font-family\"] = font.facename;\n opts[\"font-size\"] = this._todevH(Math.abs(font.height));\n opts.fill = \"#\" + this.state.textcolor.toHex();\n }\n return opts;\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { DIBitmap, PatternBitmap16 } from \"./Bitmap\";\nimport { Blob } from \"./Blob\";\nimport { GDIContext } from \"./GDIContext\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { PointS, Rect } from \"./Primitives\";\nimport { Region } from \"./Region\";\nimport { Brush, ColorRef, Font, Palette, Pen } from \"./Style\";\n\nexport class WMFRecords {\n private _records: Array<(gdi: GDIContext) => void>;\n\n constructor(reader: Blob, first: number) {\n this._records = [];\n\n let all = false;\n let curpos = first;\n main_loop: while (!all) {\n reader.seek(curpos);\n const size = reader.readUint32();\n if (size < 3) {\n throw new WMFJSError(\"Invalid record size\");\n }\n const type = reader.readUint16();\n switch (type) {\n case Helper.GDI.RecordType.META_EOF:\n all = true;\n break main_loop;\n case Helper.GDI.RecordType.META_SETMAPMODE: {\n const mapMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setMapMode(mapMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETWINDOWORG: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setWindowOrg(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETWINDOWEXT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setWindowExt(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETWINDOWORG: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetWindowOrg(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETVIEWPORTORG: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setViewportOrg(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETVIEWPORTEXT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.setViewportExt(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETVIEWPORTORG: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetViewportOrg(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SAVEDC: {\n this._records.push((gdi) => {\n gdi.saveDC();\n });\n break;\n }\n case Helper.GDI.RecordType.META_RESTOREDC: {\n const saved = reader.readInt16();\n this._records.push((gdi) => {\n gdi.restoreDC(saved);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETSTRETCHBLTMODE: {\n const stretchMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setStretchBltMode(stretchMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_DIBSTRETCHBLT: {\n const haveSrcDib = ((type >> 8) + 3 !== size);\n const rasterOp = reader.readUint16() | (reader.readUint16() << 16);\n const srcH = reader.readInt16();\n const srcW = reader.readInt16();\n const srcY = reader.readInt16();\n const srcX = reader.readInt16();\n const destH = reader.readInt16();\n const destW = reader.readInt16();\n const destY = reader.readInt16();\n const destX = reader.readInt16();\n const datalength = size * 2 - (reader.pos - curpos);\n const dib = new DIBitmap(reader, datalength);\n this._records.push((gdi) => {\n gdi.stretchDibBits(srcX, srcY, srcW, srcH, destX, destY, destW, destH, rasterOp, dib);\n });\n break;\n }\n case Helper.GDI.RecordType.META_STRETCHDIB: {\n const rasterOp = reader.readUint16() | (reader.readUint16() << 16);\n const colorUsage = reader.readInt16();\n const srcH = reader.readInt16();\n const srcW = reader.readInt16();\n const srcY = reader.readInt16();\n const srcX = reader.readInt16();\n const destH = reader.readInt16();\n const destW = reader.readInt16();\n const destY = reader.readInt16();\n const destX = reader.readInt16();\n const datalength = size * 2 - (reader.pos - curpos);\n const dib = new DIBitmap(reader, datalength);\n this._records.push((gdi) => {\n gdi.stretchDib(srcX, srcY, srcW, srcH, destX, destY, destW, destH, rasterOp, colorUsage, dib);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ESCAPE: {\n const func = reader.readUint16();\n const count = reader.readUint16();\n const offset = reader.pos;\n const blob = new Blob(reader, offset);\n this._records.push((gdi) => {\n gdi.escape(func, blob, offset, count);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETTEXTALIGN: {\n const textAlign = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setTextAlign(textAlign);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETBKMODE: {\n const bkMode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setBkMode(bkMode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETTEXTCOLOR: {\n const textColor = new ColorRef(reader);\n this._records.push((gdi) => {\n gdi.setTextColor(textColor);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETBKCOLOR: {\n const bkColor = new ColorRef(reader);\n this._records.push((gdi) => {\n gdi.setBkColor(bkColor);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEBRUSHINDIRECT: {\n const datalength = size * 2 - (reader.pos - curpos);\n const brush = new Brush(reader, datalength, false);\n this._records.push((gdi) => {\n gdi.createBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_DIBCREATEPATTERNBRUSH: {\n const datalength = size * 2 - (reader.pos - curpos);\n const brush = new Brush(reader, datalength, true);\n this._records.push((gdi) => {\n gdi.createBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPENINDIRECT: {\n const pen = new Pen(reader);\n this._records.push((gdi) => {\n gdi.createPen(pen);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEFONTINDIRECT: {\n const datalength = size * 2 - (reader.pos - curpos);\n const font = new Font(reader, datalength);\n this._records.push((gdi) => {\n gdi.createFont(font);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTOBJECT: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, null);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTPALETTE: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, \"palette\");\n });\n break;\n }\n case Helper.GDI.RecordType.META_SELECTCLIPREGION: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.selectObject(idx, \"region\");\n });\n break;\n }\n case Helper.GDI.RecordType.META_DELETEOBJECT: {\n const idx = reader.readUint16();\n this._records.push((gdi) => {\n gdi.deleteObject(idx);\n });\n break;\n }\n case Helper.GDI.RecordType.META_RECTANGLE: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.rectangle(rect, 0, 0);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ROUNDRECT: {\n const rh = reader.readInt16();\n const rw = reader.readInt16();\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.rectangle(rect, rw, rh);\n });\n break;\n }\n case Helper.GDI.RecordType.META_LINETO: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.lineTo(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_MOVETO: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.moveTo(x, y);\n });\n break;\n }\n case Helper.GDI.RecordType.META_TEXTOUT: {\n const len = reader.readInt16();\n if (len > 0) {\n const text = reader.readString(len);\n reader.skip(len % 2);\n const y = reader.readInt16();\n const x = reader.readInt16();\n this._records.push((gdi) => {\n gdi.textOut(x, y, text);\n });\n }\n break;\n }\n case Helper.GDI.RecordType.META_EXTTEXTOUT: {\n const y = reader.readInt16();\n const x = reader.readInt16();\n const len = reader.readInt16();\n const fwOpts = reader.readUint16();\n\n let hasRect = null;\n let hasDx = null;\n if (size * 2 === 14 + len + len % 2) {\n hasRect = false;\n hasDx = false;\n }\n if (size * 2 === 14 + 8 + len + len % 2) {\n hasRect = true;\n hasDx = false;\n }\n if (size * 2 === 14 + len + len % 2 + len * 2) {\n hasRect = false;\n hasDx = true;\n }\n if (size * 2 === 14 + 8 + len + len % 2 + len * 2) {\n hasRect = true;\n hasDx = true;\n }\n\n const rect = hasRect ? new Rect(reader) : null;\n if (len > 0) {\n const text = reader.readString(len);\n reader.skip(len % 2);\n\n const dx: number[] = [];\n if (hasDx) {\n for (let i = 0; i < text.length; i++) {\n dx.push(reader.readInt16());\n }\n }\n\n this._records.push((gdi) => {\n gdi.extTextOut(x, y, text, fwOpts, rect, dx);\n });\n }\n break;\n }\n case Helper.GDI.RecordType.META_EXCLUDECLIPRECT: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.excludeClipRect(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_INTERSECTCLIPRECT: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.intersectClipRect(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYGON: {\n let cnt = reader.readInt16();\n const points: PointS[] = [];\n while (cnt > 0) {\n points.push(new PointS(reader));\n cnt--;\n }\n this._records.push((gdi) => {\n gdi.polygon(points, true);\n });\n break;\n }\n case Helper.GDI.RecordType.META_SETPOLYFILLMODE: {\n const polyfillmode = reader.readUint16();\n this._records.push((gdi) => {\n gdi.setPolyFillMode(polyfillmode);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYPOLYGON: {\n const cnt = reader.readUint16();\n const polygonsPtCnts = [];\n for (let i = 0; i < cnt; i++) {\n polygonsPtCnts.push(reader.readUint16());\n }\n\n const polygons: PointS[][] = [];\n for (let i = 0; i < cnt; i++) {\n const ptCnt = polygonsPtCnts[i];\n\n const p = [];\n for (let ip = 0; ip < ptCnt; ip++) {\n p.push(new PointS(reader));\n }\n polygons.push(p);\n }\n this._records.push((gdi) => {\n gdi.polyPolygon(polygons);\n });\n break;\n }\n case Helper.GDI.RecordType.META_POLYLINE: {\n let cnt = reader.readInt16();\n const points: PointS[] = [];\n while (cnt > 0) {\n points.push(new PointS(reader));\n cnt--;\n }\n this._records.push((gdi) => {\n gdi.polyline(points);\n });\n break;\n }\n case Helper.GDI.RecordType.META_ELLIPSE: {\n const rect = new Rect(reader);\n this._records.push((gdi) => {\n gdi.ellipse(rect);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPALETTE: {\n const palette = new Palette(reader);\n this._records.push((gdi) => {\n gdi.createPalette(palette);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEREGION: {\n const region = new Region(reader);\n this._records.push((gdi) => {\n gdi.createRegion(region);\n });\n break;\n }\n case Helper.GDI.RecordType.META_CREATEPATTERNBRUSH: {\n const datalength = size * 2 - (reader.pos - curpos);\n const patternBitmap = new PatternBitmap16(reader, datalength);\n const brush = new Brush(reader, datalength, patternBitmap);\n this._records.push((gdi) => {\n gdi.createPatternBrush(brush);\n });\n break;\n }\n case Helper.GDI.RecordType.META_OFFSETCLIPRGN: {\n const offY = reader.readInt16();\n const offX = reader.readInt16();\n this._records.push((gdi) => {\n gdi.offsetClipRgn(offX, offY);\n });\n break;\n }\n case Helper.GDI.RecordType.META_REALIZEPALETTE:\n case Helper.GDI.RecordType.META_SETPALENTRIES:\n case Helper.GDI.RecordType.META_SETROP2:\n case Helper.GDI.RecordType.META_SETRELABS:\n case Helper.GDI.RecordType.META_SETTEXTCHAREXTRA:\n case Helper.GDI.RecordType.META_RESIZEPALETTE:\n case Helper.GDI.RecordType.META_SETLAYOUT:\n case Helper.GDI.RecordType.META_FILLREGION:\n case Helper.GDI.RecordType.META_SETMAPPERFLAGS:\n case Helper.GDI.RecordType.META_SETTEXTJUSTIFICATION:\n case Helper.GDI.RecordType.META_SCALEWINDOWEXT:\n case Helper.GDI.RecordType.META_SCALEVIEWPORTEXT:\n case Helper.GDI.RecordType.META_FLOODFILL:\n case Helper.GDI.RecordType.META_FRAMEREGION:\n case Helper.GDI.RecordType.META_ANIMATEPALETTE:\n case Helper.GDI.RecordType.META_EXTFLOODFILL:\n case Helper.GDI.RecordType.META_SETPIXEL:\n case Helper.GDI.RecordType.META_PATBLT:\n case Helper.GDI.RecordType.META_PIE:\n case Helper.GDI.RecordType.META_STRETCHBLT:\n case Helper.GDI.RecordType.META_INVERTREGION:\n case Helper.GDI.RecordType.META_PAINTREGION:\n case Helper.GDI.RecordType.META_ARC:\n case Helper.GDI.RecordType.META_CHORD:\n case Helper.GDI.RecordType.META_BITBLT:\n case Helper.GDI.RecordType.META_SETDIBTODEV:\n case Helper.GDI.RecordType.META_DIBBITBLT:\n default: {\n let recordName = \"UNKNOWN\";\n for (const name in Helper.GDI.RecordType) {\n const recordTypes: any = Helper.GDI.RecordType;\n if (recordTypes[name] === type) {\n recordName = name;\n break;\n }\n }\n Helper.log(\"[WMF] \" + recordName + \" record (0x\" + type.toString(16) + \") at offset 0x\"\n + curpos.toString(16) + \" with \" + (size * 2) + \" bytes\");\n break;\n }\n }\n\n curpos += size * 2;\n }\n\n if (!all) {\n throw new WMFJSError(\"Could not read all records\");\n }\n }\n\n public play(gdi: GDIContext) {\n const len = this._records.length;\n for (let i = 0; i < len; i++) {\n this._records[i](gdi);\n }\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nimport { Blob } from \"./Blob\";\nimport { GDIContext } from \"./GDIContext\";\nimport { Helper, WMFJSError } from \"./Helper\";\nimport { WMFRecords } from \"./WMFRecords\";\n\nexport interface IRendererSettings {\n width: string;\n height: string;\n xExt: number;\n yExt: number;\n mapMode: number;\n}\n\nexport class Renderer {\n private _img: WMF;\n\n constructor(blob: ArrayBuffer) {\n this.parse(blob);\n Helper.log(\"WMFJS.Renderer instantiated\");\n }\n\n public render(info: IRendererSettings) {\n const img = ($(\"
\") as any).svg({\n onLoad: (svg: any) => {\n return this._render(svg, info.mapMode, info.xExt, info.yExt);\n },\n settings: {\n viewBox: [0, 0, info.xExt, info.yExt].join(\" \"),\n preserveAspectRatio: \"none\", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC\n },\n });\n const svgContainer = ($(img[0]) as any).svg(\"get\");\n return $(svgContainer.root()).attr(\"width\", info.width).attr(\"height\", info.height);\n }\n\n private parse(blob: ArrayBuffer) {\n this._img = null;\n\n const reader = new Blob(blob);\n\n let type;\n let size;\n let placable;\n let headerstart;\n const key = reader.readUint32();\n if (key === 0x9ac6cdd7) {\n placable = new WMFPlacable(reader);\n headerstart = reader.pos;\n type = reader.readUint16();\n size = reader.readUint16();\n } else {\n headerstart = 0;\n type = key & 0xffff;\n size = (key >>> 16) & 0xffff;\n }\n switch (type) {\n case Helper.GDI.MetafileType.MEMORYMETAFILE:\n case Helper.GDI.MetafileType.DISKMETAFILE:\n if (size === Helper.GDI.METAHEADER_SIZE / 2) {\n const version = reader.readUint16();\n switch (version) {\n case Helper.GDI.MetafileVersion.METAVERSION100:\n case Helper.GDI.MetafileVersion.METAVERSION300:\n this._img = new WMF(reader, placable, version, headerstart + (size * 2));\n break;\n }\n }\n break;\n }\n\n if (this._img == null) {\n throw new WMFJSError(\"Format not recognized\");\n }\n }\n\n private _render(svg: any, mapMode: number, xExt: number, yExt: number) {\n // See https://www-user.tu-chemnitz.de/~ygu/petzold/ch18b.htm\n const gdi = new GDIContext(svg);\n gdi.setViewportExt(xExt, yExt);\n gdi.setMapMode(mapMode);\n Helper.log(\"[WMF] BEGIN RENDERING --->\");\n this._img.render(gdi);\n Helper.log(\"[WMF] <--- DONE RENDERING\");\n }\n}\n\nexport class WMFRect16 {\n private left: number;\n private top: number;\n private right: number;\n private bottom: number;\n\n constructor(reader: Blob) {\n this.left = reader.readInt16();\n this.top = reader.readInt16();\n this.right = reader.readInt16();\n this.bottom = reader.readInt16();\n }\n\n public toString() {\n return \"{left: \" + this.left + \", top: \" + this.top + \", right: \" + this.right\n + \", bottom: \" + this.bottom + \"}\";\n }\n}\n\nexport class WMFPlacable {\n private boundingBox: WMFRect16;\n private unitsPerInch: number;\n\n constructor(reader: Blob) {\n reader.skip(2);\n this.boundingBox = new WMFRect16(reader);\n this.unitsPerInch = reader.readInt16();\n reader.skip(4);\n reader.skip(2); // TODO: checksum\n Helper.log(\"Got bounding box \" + this.boundingBox + \" and \" + this.unitsPerInch + \" units/inch\");\n }\n}\n\nexport class WMF {\n private _reader: Blob;\n private _version: number;\n private _hdrsize: number;\n private _placable: WMFPlacable;\n private _records: WMFRecords;\n\n constructor(reader: Blob, placable: WMFPlacable, version: number, hdrsize: number) {\n this._reader = reader;\n this._version = version;\n this._hdrsize = hdrsize;\n this._placable = placable;\n this._records = new WMFRecords(reader, this._hdrsize);\n }\n\n public render(gdi: GDIContext) {\n this._records.play(gdi);\n }\n}\n","/*\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Thomas Bluemel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nexport * from \"./Renderer\";\nexport { WMFJSError as Error, loggingEnabled } from \"./Helper\";\n"],"names":["__extends"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,UAAU,GAAG,UAA2B,OAAe;IAChE,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,KAAK,CAAC;CACa,CAAC;AACnD,UAAU,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;AAEnC,IAAI,gBAAgB,GAAG,IAAI,CAAC;AAC5B,wBAA+B,OAAgB;IAC3C,gBAAgB,GAAG,OAAO,CAAC;CAC9B;AAED;IAAA;KAmQC;IA1BiB,UAAG,GAAjB,UAAkB,OAAe;QAC7B,IAAI,gBAAgB,EAAE;;YAElB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SACxB;KACJ;IAEa,oBAAa,GAA3B,UAA4B,MAAc;QACtC,OAAO,QAAQ,GAAG,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;KACjD;IAEa,sBAAe,GAA7B,UAA8B,QAAoB,EAAE,GAAW,EAAE,GAAW;QACxE,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;QAC7B,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC;QACrC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC;QACtC,QAAQ,CAAC,GA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AM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACzD;IAEM,oBAAM,GAAb,UAAc,GAAe;QACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC3B;IACL,UAAC;CAAA;;ACnKD;;;;;;;;;;;;;;;;;;;;;;;;EAwBE;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/src/emfjs/Bitmap.ts b/src/emfjs/Bitmap.ts
index 8501f5b..25e5de4 100644
--- a/src/emfjs/Bitmap.ts
+++ b/src/emfjs/Bitmap.ts
@@ -29,19 +29,19 @@ import { Blob } from "./Blob";
import { EMFJSError, Helper } from "./Helper";
export class BitmapBase {
- getWidth() {
+ public getWidth() {
throw new EMFJSError("getWidth not implemented");
}
- getHeight() {
+ public getHeight() {
throw new EMFJSError("getHeight not implemented");
}
}
export class BitmapCoreHeader {
- width: number;
- height: number;
- planes: number;
- bitcount: number;
+ public width: number;
+ public height: number;
+ public planes: number;
+ public bitcount: number;
constructor(reader: Blob, skipsize: boolean) {
if (skipsize) {
@@ -53,22 +53,22 @@ export class BitmapCoreHeader {
this.bitcount = reader.readUint16();
}
- colors() {
+ public colors() {
return this.bitcount <= 8 ? 1 << this.bitcount : 0;
}
}
export class BitmapInfoHeader {
- width: number;
- height: number;
- planes: number;
- bitcount: number;
- compression: number;
- sizeimage: number;
- xpelspermeter: number;
- ypelspermeter: number;
- clrused: number;
- clrimportant: number;
+ public width: number;
+ public height: number;
+ public planes: number;
+ public bitcount: number;
+ public compression: number;
+ public sizeimage: number;
+ public xpelspermeter: number;
+ public ypelspermeter: number;
+ public clrused: number;
+ public clrimportant: number;
constructor(reader: Blob, skipsize: boolean) {
if (skipsize) {
@@ -86,7 +86,7 @@ export class BitmapInfoHeader {
this.clrimportant = reader.readUint32();
}
- colors() {
+ public colors() {
if (this.clrused !== 0) {
return this.clrused < 256 ? this.clrused : 256;
} else {
@@ -96,11 +96,11 @@ export class BitmapInfoHeader {
}
export class BitmapInfo extends BitmapBase {
- _reader: Blob;
- _offset: number;
- _usergb: boolean;
- _infosize: number;
- _header: BitmapCoreHeader | BitmapInfoHeader;
+ private _reader: Blob;
+ private _offset: number;
+ private _usergb: boolean;
+ private _infosize: number;
+ private _header: BitmapCoreHeader | BitmapInfoHeader;
constructor(reader: Blob, usergb: boolean) {
super();
@@ -123,28 +123,28 @@ export class BitmapInfo extends BitmapBase {
}
}
- getWidth() {
+ public getWidth() {
return this._header.width;
}
- getHeight() {
+ public getHeight() {
return Math.abs(this._header.height);
}
- infosize() {
+ public infosize() {
return this._infosize;
}
- header() {
+ public header() {
return this._header;
}
}
export class DIBitmap extends BitmapBase {
- _reader: Blob;
- _offset: number;
- _location: any;
- _info: BitmapInfo;
+ private _reader: Blob;
+ private _offset: number;
+ private _location: any;
+ private _info: BitmapInfo;
constructor(reader: Blob, bitmapInfo?: any) {
super();
@@ -154,19 +154,19 @@ export class DIBitmap extends BitmapBase {
this._info = new BitmapInfo(reader, true);
}
- getWidth() {
+ public getWidth() {
return this._info.getWidth();
}
- getHeight() {
+ public getHeight() {
return this._info.getHeight();
}
- totalSize() {
+ public totalSize() {
return this._location.header.size + this._location.data.size;
}
- makeBitmapFileHeader() {
+ public makeBitmapFileHeader() {
const buf = new ArrayBuffer(14);
const view = new Uint8Array(buf);
view[0] = 0x42;
@@ -176,7 +176,7 @@ export class DIBitmap extends BitmapBase {
return Helper._blobToBinary(view);
}
- base64ref() {
+ public base64ref() {
const prevpos = this._reader.pos;
this._reader.seek(this._offset);
let mime = "image/bmp";
diff --git a/src/emfjs/Blob.ts b/src/emfjs/Blob.ts
index a4db889..d26c49a 100644
--- a/src/emfjs/Blob.ts
+++ b/src/emfjs/Blob.ts
@@ -28,9 +28,9 @@ SOFTWARE.
import { EMFJSError } from "./Helper";
export class Blob {
- blob: Blob | ArrayBuffer;
- data: Uint8Array;
- pos: number;
+ public pos: number;
+ private blob: Blob | ArrayBuffer;
+ private data: Uint8Array;
constructor(blob: Blob | ArrayBuffer, offset?: number) {
if (blob instanceof Blob) {
@@ -44,18 +44,18 @@ export class Blob {
}
}
- eof() {
+ public eof() {
return this.pos >= this.data.length;
}
- seek(newpos: number) {
+ public seek(newpos: number) {
if (newpos < 0 || newpos > this.data.length) {
throw new EMFJSError("Invalid seek position");
}
this.pos = newpos;
}
- skip(cnt: number) {
+ public skip(cnt: number) {
const newPos = this.pos + cnt;
if (newPos > this.data.length) {
throw new EMFJSError("Unexpected end of file");
@@ -63,7 +63,7 @@ export class Blob {
this.pos = newPos;
}
- readBinary(cnt: number) {
+ public readBinary(cnt: number) {
const end = this.pos + cnt;
if (end > this.data.length) {
throw new EMFJSError("Unexpected end of file");
@@ -75,18 +75,18 @@ export class Blob {
return ret;
}
- readInt8() {
+ public readInt8() {
if (this.pos + 1 > this.data.length) {
throw new EMFJSError("Unexpected end of file");
}
return this.data[this.pos++];
}
- readUint8() {
+ public readUint8() {
return this.readInt8() >>> 0;
}
- readInt32() {
+ public readInt32() {
if (this.pos + 4 > this.data.length) {
throw new EMFJSError("Unexpected end of file");
}
@@ -97,11 +97,11 @@ export class Blob {
return val;
}
- readUint32() {
+ public readUint32() {
return this.readInt32() >>> 0;
}
- readUint16() {
+ public readUint16() {
if (this.pos + 2 > this.data.length) {
throw new EMFJSError("Unexpected end of file");
}
@@ -110,7 +110,7 @@ export class Blob {
return val;
}
- readInt16() {
+ public readInt16() {
let val = this.readUint16();
if (val > 32767) {
val -= 65536;
@@ -118,7 +118,7 @@ export class Blob {
return val;
}
- readString(length: number) {
+ public readString(length: number) {
if (this.pos + length > this.data.length) {
throw new EMFJSError("Unexpected end of file");
}
@@ -129,7 +129,7 @@ export class Blob {
return ret;
}
- readNullTermString(maxSize: number) {
+ public readNullTermString(maxSize: number) {
let ret = "";
if (maxSize > 0) {
maxSize--;
@@ -147,7 +147,7 @@ export class Blob {
return ret;
}
- readFixedSizeUnicodeString(fixedSizeChars: number) {
+ public readFixedSizeUnicodeString(fixedSizeChars: number) {
let ret = "";
for (let i = 0; i < fixedSizeChars; i++) {
const charCode = this.readUint16();
diff --git a/src/emfjs/EMFRecords.ts b/src/emfjs/EMFRecords.ts
index eaac177..f921ea2 100644
--- a/src/emfjs/EMFRecords.ts
+++ b/src/emfjs/EMFRecords.ts
@@ -33,17 +33,17 @@ import { Region } from "./Region";
import { Brush, ColorRef, Pen } from "./Style";
export class EmfHeader {
- size: number;
- bounds: RectL;
- frame: RectL;
- nPalEntries: number;
- refDevCx: number;
- refDevCy: number;
- refDevCxMm: number;
- refDevCyMm: number;
- description: string;
- displayDevCxUm: number;
- displayDevCyUm: number;
+ private size: number;
+ private bounds: RectL;
+ private frame: RectL;
+ private nPalEntries: number;
+ private refDevCx: number;
+ private refDevCy: number;
+ private refDevCxMm: number;
+ private refDevCyMm: number;
+ private description: string;
+ private displayDevCxUm: number;
+ private displayDevCyUm: number;
constructor(reader: Blob, headerSize: number) {
const recordStart = reader.pos - 8;
@@ -116,15 +116,15 @@ export class EmfHeader {
}
}
- toString() {
+ public toString() {
return "{bounds: " + this.bounds.toString() + ", frame: " + this.frame.toString()
+ ", description: " + this.description + "}";
}
}
export class EMFRecords {
- _records: Array<(gdi: GDIContext) => void>;
- _header: EmfHeader;
+ private _records: Array<(gdi: GDIContext) => void>;
+ private _header: EmfHeader;
constructor(reader: Blob, first: number) {
this._records = [];
@@ -584,7 +584,7 @@ export class EMFRecords {
}
}
- play(gdi: GDIContext) {
+ public play(gdi: GDIContext) {
const len = this._records.length;
for (let i = 0; i < len; i++) {
this._records[i](gdi);
diff --git a/src/emfjs/GDIContext.ts b/src/emfjs/GDIContext.ts
index 3b21934..857c1e5 100644
--- a/src/emfjs/GDIContext.ts
+++ b/src/emfjs/GDIContext.ts
@@ -40,7 +40,7 @@ export interface ISelectedStyle {
}
export class Path extends Obj {
- svgPath: any;
+ public svgPath: any;
constructor(svgPath: any, copy?: Path) {
super("path");
@@ -51,11 +51,11 @@ export class Path extends Obj {
}
}
- clone() {
+ public clone() {
return new Path(null, this.svgPath);
}
- toString() {
+ public toString() {
return "{[path]}";
}
}
@@ -105,34 +105,34 @@ function createStockObjects(): {[key: string]: Obj} {
export const _StockObjects = createStockObjects();
export class GDIContextState {
- _svggroup: any;
- _svgclipChanged: boolean;
- _svgtextbkfilter: any;
- mapmode: number;
- stretchmode: number;
- textalign: number;
- bkmode: number;
- textcolor: ColorRef;
- bkcolor: ColorRef;
- polyfillmode: number;
- miterlimit: number;
- wx: number;
- wy: number;
- ww: number;
- wh: number;
- vx: number;
- vy: number;
- vw: number;
- vh: number;
- x: number;
- y: number;
- nextbrx: number;
- nextbry: number;
- brx: number;
- bry: number;
- clip: Region;
- ownclip: boolean;
- selected: ISelectedStyle;
+ public _svggroup: any;
+ public _svgclipChanged: boolean;
+ public _svgtextbkfilter: any;
+ public mapmode: number;
+ public stretchmode: number;
+ public textalign: number;
+ public bkmode: number;
+ public textcolor: ColorRef;
+ public bkcolor: ColorRef;
+ public polyfillmode: number;
+ public miterlimit: number;
+ public wx: number;
+ public wy: number;
+ public ww: number;
+ public wh: number;
+ public vx: number;
+ public vy: number;
+ public vw: number;
+ public vh: number;
+ public x: number;
+ public y: number;
+ public nextbrx: number;
+ public nextbry: number;
+ public brx: number;
+ public bry: number;
+ public clip: Region;
+ public ownclip: boolean;
+ public selected: ISelectedStyle;
constructor(copy: GDIContextState, defObjects?: ISelectedStyle) {
if (copy != null) {
@@ -209,15 +209,15 @@ export class GDIContextState {
}
export class GDIContext {
- _svg: any;
- _svgdefs: any;
- _svgPatterns: {[key: string]: Brush};
- _svgClipPaths: {[key: string]: Region};
- _svgPath: any;
- defObjects: ISelectedStyle;
- state: GDIContextState;
- statestack: GDIContextState[];
- objects: {[key: string]: Obj};
+ private _svg: any;
+ private _svgdefs: any;
+ private _svgPatterns: {[key: string]: Brush};
+ private _svgClipPaths: {[key: string]: Region};
+ private _svgPath: any;
+ private defObjects: ISelectedStyle;
+ private state: GDIContextState;
+ private statestack: GDIContextState[];
+ private objects: {[key: string]: Obj};
constructor(svg: any) {
this._svg = svg;
@@ -242,7 +242,374 @@ export class GDIContext {
this.objects = {};
}
- _pushGroup() {
+ public setMapMode(mode: number) {
+ Helper.log("[gdi] setMapMode: mode=" + mode);
+ this.state.mapmode = mode;
+ this.state._svggroup = null;
+ }
+
+ public setWindowOrgEx(x: number, y: number) {
+ Helper.log("[gdi] setWindowOrgEx: x=" + x + " y=" + y);
+ this.state.wx = x;
+ this.state.wy = y;
+ this.state._svggroup = null;
+ }
+
+ public setWindowExtEx(x: number, y: number) {
+ Helper.log("[gdi] setWindowExtEx: x=" + x + " y=" + y);
+ this.state.ww = x;
+ this.state.wh = y;
+ this.state._svggroup = null;
+ }
+
+ public setViewportOrgEx(x: number, y: number) {
+ Helper.log("[gdi] setViewportOrgEx: x=" + x + " y=" + y);
+ this.state.vx = x;
+ this.state.vy = y;
+ this.state._svggroup = null;
+ }
+
+ public setViewportExtEx(x: number, y: number) {
+ Helper.log("[gdi] setViewportExtEx: x=" + x + " y=" + y);
+ this.state.vw = x;
+ this.state.vh = y;
+ this.state._svggroup = null;
+ }
+
+ public setBrushOrgEx(origin: PointL) {
+ Helper.log("[gdi] setBrushOrgEx: x=" + origin.x + " y=" + origin.y);
+ this.state.nextbrx = origin.x;
+ this.state.nextbry = origin.y;
+ }
+
+ public saveDC() {
+ Helper.log("[gdi] saveDC");
+ const prevstate = this.state;
+ this.state = new GDIContextState(this.state);
+ this.statestack.push(prevstate);
+ this.state._svggroup = null;
+ }
+
+ public restoreDC(saved: number) {
+ Helper.log("[gdi] restoreDC: saved=" + saved);
+ if (this.statestack.length > 1) {
+ if (saved === -1) {
+ this.state = this.statestack.pop();
+ } else if (saved < -1) {
+ throw new EMFJSError("restoreDC: relative restore not implemented");
+ } else if (saved > 1) {
+ throw new EMFJSError("restoreDC: absolute restore not implemented");
+ }
+ } else {
+ throw new EMFJSError("No saved contexts");
+ }
+
+ this.state._svggroup = null;
+ }
+
+ public setStretchBltMode(stretchMode: number) {
+ Helper.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
+ }
+
+ public rectangle(rect: RectL, rw: number, rh: number) {
+ Helper.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+ const bottom = this._todevY(rect.bottom);
+ const right = this._todevX(rect.right);
+ const top = this._todevY(rect.top);
+ const left = this._todevX(rect.left);
+ rw = this._todevH(rw);
+ rh = this._todevH(rh);
+ Helper.log("[gdi] rectangle: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top
+ + " left=" + left + " rh=" + rh + " rw=" + rw);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, true, true, false);
+ this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);
+ }
+
+ public lineTo(x: number, y: number) {
+ Helper.log("[gdi] lineTo: x=" + x + " y=" + y + " with pen " + this.state.selected.pen.toString());
+ const toX = this._todevX(x);
+ const toY = this._todevY(y);
+ const fromX = this._todevX(this.state.x);
+ const fromY = this._todevY(this.state.y);
+
+ // Update position
+ this.state.x = x;
+ this.state.y = y;
+
+ Helper.log("[gdi] lineTo: TRANSLATED: toX=" + toX + " toY=" + toY + " fromX=" + fromX + " fromY=" + fromY);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, true, false, false);
+ this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);
+ }
+
+ public moveToEx(x: number, y: number) {
+ Helper.log("[gdi] moveToEx: x=" + x + " y=" + y);
+ this.state.x = x;
+ this.state.y = y;
+ if (this._svgPath != null) {
+ this._svgPath.move(this.state.x, this.state.y);
+ Helper.log("[gdi] new path: " + this._svgPath.path());
+ }
+ }
+
+ public polygon(points: PointS[] | PointL[], bounds: RectL, first: boolean) {
+ Helper.log("[gdi] polygon: points=" + points + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+ const pts = [];
+ for (let i = 0; i < points.length; i++) {
+ const point = points[i];
+ pts.push([this._todevX(point.x), this._todevY(point.y)]);
+ }
+ if (first) {
+ this._pushGroup();
+ }
+ const opts = {
+ "fill-rule": this.state.polyfillmode === Helper.GDI.PolygonFillMode.ALTERNATE ? "evenodd" : "nonzero",
+ };
+ this._applyOpts(opts, true, true, false);
+ this._svg.polygon(this.state._svggroup, pts, opts);
+ }
+
+ public polyPolygon(polygons: PointS[][] | PointL[][], bounds: RectL) {
+ Helper.log("[gdi] polyPolygon: polygons.length=" + polygons.length
+ + " with pen " + this.state.selected.pen.toString() + " and brush " + this.state.selected.brush.toString());
+
+ const cnt = polygons.length;
+ for (let i = 0; i < cnt; i++) {
+ this.polygon(polygons[i], bounds, i === 0);
+ }
+ }
+
+ public polyline(isLineTo: boolean, points: PointS[], bounds: RectL) {
+ Helper.log("[gdi] polyline: isLineTo=" + isLineTo.toString() + ", points=" + points
+ + ", bounds=" + bounds.toString() + " with pen " + this.state.selected.pen.toString());
+ const pts = [];
+ for (let i = 0; i < points.length; i++) {
+ const point = points[i];
+ pts.push([this._todevX(point.x), this._todevY(point.y)]);
+ }
+
+ if (this._svgPath != null) {
+ if (!isLineTo || pts.length === 0) {
+ this._svgPath.move(this._todevX(this.state.x), this._todevY(this.state.y));
+ } else {
+ const firstPts = pts[0];
+ this._svgPath.move(firstPts[0], firstPts[1]);
+ }
+ this._svgPath.line(pts);
+ Helper.log("[gdi] new path: " + this._svgPath.path());
+ } else {
+ this._pushGroup();
+ const opts = this._applyOpts(null, true, false, false);
+ if (isLineTo && points.length > 0) {
+ const firstPt = points[0];
+ if (firstPt.x !== this.state.x || firstPt.y !== this.state.y) {
+ pts.unshift([this._todevX(this.state.x), this._todevY(this.state.y)]);
+ }
+ }
+ this._svg.polyline(this.state._svggroup, pts, opts);
+ }
+
+ if (points.length > 0) {
+ const lastPt = points[points.length - 1];
+ this.state.x = lastPt.x;
+ this.state.y = lastPt.y;
+ }
+ }
+
+ public polybezier(isPolyBezierTo: boolean, points: PointS[], bounds: RectL) {
+ Helper.log("[gdi] polybezier: isPolyBezierTo=" + isPolyBezierTo.toString() + ", points=" + points
+ + ", bounds=" + bounds.toString() + " with pen " + this.state.selected.pen.toString());
+ const pts = [];
+ for (let i = 0; i < points.length; i++) {
+ const point = points[i];
+ pts.push({ x: this._todevX(point.x), y: this._todevY(point.y)});
+ }
+
+ if (this._svgPath != null) {
+ if (isPolyBezierTo && pts.length > 0) {
+ const firstPts = pts[0];
+ this._svgPath.move(firstPts.x, firstPts.y);
+ } else {
+ this._svgPath.move(this._todevX(this.state.x), this._todevY(this.state.y));
+ }
+
+ if (pts.length < (isPolyBezierTo ? 3 : 4)) {
+ throw new EMFJSError("Not enough points to draw bezier");
+ }
+
+ for (let i = isPolyBezierTo ? 1 : 0; i + 3 <= pts.length; i += 3) {
+ const cp1 = pts[i];
+ const cp2 = pts[i + 1];
+ const ep = pts[i + 2];
+ this._svgPath.curveC(cp1.x, cp1.y, cp2.x, cp2.y, ep.x, ep.y);
+ }
+
+ Helper.log("[gdi] new path: " + this._svgPath.path());
+ } else {
+ throw new EMFJSError("polybezier not implemented (not a path)");
+ }
+
+ if (points.length > 0) {
+ const lastPt = points[points.length - 1];
+ this.state.x = lastPt.x;
+ this.state.y = lastPt.y;
+ }
+ }
+
+ public selectClipPath(rgnMode: number) {
+ Helper.log("[gdi] selectClipPath: rgnMode=0x" + rgnMode.toString(16));
+ }
+
+ public selectClipRgn(rgnMode: number, region: Region) {
+ Helper.log("[gdi] selectClipRgn: rgnMode=0x" + rgnMode.toString(16));
+ if (rgnMode === Helper.GDI.RegionMode.RGN_COPY) {
+ this.state.selected.region = region;
+ this.state.clip = null;
+ this.state.ownclip = false;
+ } else {
+ if (region == null) {
+ throw new EMFJSError("No clip region to select");
+ }
+
+ throw new EMFJSError("Not implemented: rgnMode=0x" + rgnMode.toString(16));
+ }
+ this.state._svgclipChanged = true;
+ }
+
+ public offsetClipRgn(offset: PointL) {
+ Helper.log("[gdi] offsetClipRgn: offset=" + offset.toString());
+ this._getClipRgn().offset(offset.x, offset.y);
+ }
+
+ public setTextAlign(textAlignmentMode: number) {
+ Helper.log("[gdi] setTextAlign: textAlignmentMode=0x" + textAlignmentMode.toString(16));
+ this.state.textalign = textAlignmentMode;
+ }
+
+ public setMiterLimit(miterLimit: number) {
+ Helper.log("[gdi] setMiterLimit: miterLimit=" + miterLimit);
+ this.state.miterlimit = miterLimit;
+ }
+
+ public setBkMode(bkMode: number) {
+ Helper.log("[gdi] setBkMode: bkMode=0x" + bkMode.toString(16));
+ this.state.bkmode = bkMode;
+ }
+
+ public setBkColor(bkColor: ColorRef) {
+ Helper.log("[gdi] setBkColor: bkColor=" + bkColor.toString());
+ this.state.bkcolor = bkColor;
+ this.state._svgtextbkfilter = null;
+ }
+
+ public setPolyFillMode(polyFillMode: number) {
+ Helper.log("[gdi] setPolyFillMode: polyFillMode=" + polyFillMode);
+ this.state.polyfillmode = polyFillMode;
+ }
+
+ public createBrush(index: number, brush: Brush) {
+ const idx = this._storeObject(brush, index);
+ Helper.log("[gdi] createBrush: brush=" + brush.toString() + " with handle " + idx);
+ }
+
+ public createPen(index: number, pen: Pen) {
+ const idx = this._storeObject(pen, index);
+ Helper.log("[gdi] createPen: pen=" + pen.toString() + " width handle " + idx);
+ }
+
+ public createPenEx(index: number, pen: Pen) {
+ const idx = this._storeObject(pen, index);
+ Helper.log("[gdi] createPenEx: pen=" + pen.toString() + " width handle " + idx);
+ }
+
+ public selectObject(objIdx: number, checkType: string) {
+ const obj = this._getObject(objIdx);
+ if (obj != null && (checkType == null || obj.type === checkType)) {
+ this._selectObject(obj);
+ Helper.log("[gdi] selectObject: objIdx=" + objIdx
+ + (obj ? " selected " + obj.type + ": " + obj.toString() : "[invalid index]"));
+ } else {
+ Helper.log("[gdi] selectObject: objIdx=" + objIdx
+ + (obj ? " invalid object type: " + obj.type : "[invalid index]"));
+ }
+ }
+
+ public abortPath() {
+ Helper.log("[gdi] abortPath");
+ if (this._svgPath != null) {
+ this._svgPath = null;
+ }
+ }
+
+ public beginPath() {
+ Helper.log("[gdi] beginPath");
+
+ if (this._svgPath != null) {
+ this._svgPath = null;
+ }
+
+ this._svgPath = this._svg.createPath();
+ }
+
+ public closeFigure() {
+ Helper.log("[gdi] closeFigure");
+ if (this._svgPath == null) {
+ throw new EMFJSError("No path bracket: cannot close figure");
+ }
+
+ this._svgPath.close();
+ }
+
+ public fillPath(bounds: RectL) {
+ Helper.log("[gdi] fillPath");
+ if (this.state.selected.path == null) {
+ throw new EMFJSError("No path selected");
+ }
+
+ const selPath = this.state.selected.path;
+ const opts = this._applyOpts(null, true, true, false);
+ this._svg.path(this.state._svggroup, selPath.svgPath, opts);
+
+ this._pushGroup();
+ this.state.selected.path = null;
+ }
+
+ public strokePath(bounds: RectL) {
+ Helper.log("[gdi] strokePath");
+ if (this.state.selected.path == null) {
+ throw new EMFJSError("No path selected");
+ }
+
+ const selPath = this.state.selected.path;
+ const opts = this._applyOpts({fill: "none"}, true, false, false);
+ this._svg.path(this.state._svggroup, selPath.svgPath, opts);
+
+ this._pushGroup();
+ this.state.selected.path = null;
+ }
+
+ public endPath() {
+ Helper.log("[gdi] endPath");
+ if (this._svgPath == null) {
+ throw new EMFJSError("No path bracket: cannot end path");
+ }
+
+ this._pushGroup();
+ this._selectObject(new Path(this._svgPath));
+ this._svgPath = null;
+ }
+
+ public deleteObject(objIdx: number) {
+ const ret = this._deleteObject(objIdx);
+ Helper.log("[gdi] deleteObject: objIdx=" + objIdx + (ret ? " deleted object" : "[invalid index]"));
+ }
+
+ private _pushGroup() {
if (this.state._svggroup == null || this.state._svgclipChanged) {
this.state._svgclipChanged = false;
this.state._svgtextbkfilter = null;
@@ -264,18 +631,18 @@ export class GDIContext {
}
}
- _getStockObject(idx: number) {
+ private _getStockObject(idx: number) {
if (idx >= 0x80000000 && idx <= 0x80000011) {
return _StockObjects[(idx - 0x80000000).toString()];
} else if (idx === Helper.GDI.StockObject.DC_BRUSH) {
return this.state.selected.brush;
- } else if (idx === Helper.GDI.StockObject.DC_PEN) {
+ } else if (idx === Helper.GDI.StockObject.DC_PEN) {
return this.state.selected.pen;
- }
+ }
return null;
}
- _storeObject(obj: Obj, idx: number) {
+ private _storeObject(obj: Obj, idx: number) {
if (!idx) {
idx = 0;
while (this.objects[idx.toString()] != null && idx <= 65535) {
@@ -291,7 +658,7 @@ export class GDIContext {
return idx;
}
- _getObject(objIdx: number) {
+ private _getObject(objIdx: number) {
let obj = this.objects[objIdx.toString()];
if (obj == null) {
obj = this._getStockObject(objIdx);
@@ -302,14 +669,14 @@ export class GDIContext {
return obj;
}
- _getSvgDef() {
+ private _getSvgDef() {
if (this._svgdefs == null) {
this._svgdefs = this._svg.defs();
}
return this._svgdefs;
}
- _getSvgClipPathForRegion(region: Region) {
+ private _getSvgClipPathForRegion(region: Region) {
for (const existingId in this._svgClipPaths) {
const rgn = this._svgClipPaths[existingId];
if (rgn === region) {
@@ -344,7 +711,7 @@ export class GDIContext {
return id;
}
- _getSvgPatternForBrush(brush: Brush) {
+ private _getSvgPatternForBrush(brush: Brush) {
for (const existingId in this._svgPatterns) {
const pat = this._svgPatterns[existingId];
if (pat === brush) {
@@ -377,7 +744,7 @@ export class GDIContext {
return id;
}
- _selectObject(obj: Obj) {
+ private _selectObject(obj: Obj) {
this.state.selected[obj.type] = obj;
switch (obj.type) {
case "region":
@@ -390,7 +757,7 @@ export class GDIContext {
}
}
- _deleteObject(objIdx: number) {
+ private _deleteObject(objIdx: number) {
const obj = this.objects[objIdx.toString()];
if (obj != null) {
for (let i = 0; i < this.statestack.length; i++) {
@@ -407,7 +774,7 @@ export class GDIContext {
return false;
}
- _getClipRgn() {
+ private _getClipRgn() {
if (this.state.clip != null) {
if (!this.state.ownclip) {
this.state.clip = this.state.clip.clone();
@@ -424,124 +791,55 @@ export class GDIContext {
return this.state.clip;
}
- _todevX(val: number) {
+ private _todevX(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.wx) * (this.state.vw / this.state.ww)) + this.state.vx;
}
- _todevY(val: number) {
+ private _todevY(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.wy) * (this.state.vh / this.state.wh)) + this.state.vy;
}
- _todevW(val: number) {
+ private _todevW(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val * (this.state.vw / this.state.ww)) + this.state.vx;
}
- _todevH(val: number) {
+ private _todevH(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val * (this.state.vh / this.state.wh)) + this.state.vy;
}
- _tologicalX(val: number) {
+ private _tologicalX(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.vx) / (this.state.vw / this.state.ww)) + this.state.wx;
}
- _tologicalY(val: number) {
+ private _tologicalY(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.vy) / (this.state.vh / this.state.wh)) + this.state.wy;
}
- _tologicalW(val: number) {
+ private _tologicalW(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val / (this.state.vw / this.state.ww)) + this.state.wx;
}
- _tologicalH(val: number) {
+ private _tologicalH(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val / (this.state.vh / this.state.wh)) + this.state.wy;
}
- setMapMode(mode: number) {
- Helper.log("[gdi] setMapMode: mode=" + mode);
- this.state.mapmode = mode;
- this.state._svggroup = null;
- }
-
- setWindowOrgEx(x: number, y: number) {
- Helper.log("[gdi] setWindowOrgEx: x=" + x + " y=" + y);
- this.state.wx = x;
- this.state.wy = y;
- this.state._svggroup = null;
- }
-
- setWindowExtEx(x: number, y: number) {
- Helper.log("[gdi] setWindowExtEx: x=" + x + " y=" + y);
- this.state.ww = x;
- this.state.wh = y;
- this.state._svggroup = null;
- }
-
- setViewportOrgEx(x: number, y: number) {
- Helper.log("[gdi] setViewportOrgEx: x=" + x + " y=" + y);
- this.state.vx = x;
- this.state.vy = y;
- this.state._svggroup = null;
- }
-
- setViewportExtEx(x: number, y: number) {
- Helper.log("[gdi] setViewportExtEx: x=" + x + " y=" + y);
- this.state.vw = x;
- this.state.vh = y;
- this.state._svggroup = null;
- }
-
- setBrushOrgEx(origin: PointL) {
- Helper.log("[gdi] setBrushOrgEx: x=" + origin.x + " y=" + origin.y);
- this.state.nextbrx = origin.x;
- this.state.nextbry = origin.y;
- }
-
- saveDC() {
- Helper.log("[gdi] saveDC");
- const prevstate = this.state;
- this.state = new GDIContextState(this.state);
- this.statestack.push(prevstate);
- this.state._svggroup = null;
- }
-
- restoreDC(saved: number) {
- Helper.log("[gdi] restoreDC: saved=" + saved);
- if (this.statestack.length > 1) {
- if (saved === -1) {
- this.state = this.statestack.pop();
- } else if (saved < -1) {
- throw new EMFJSError("restoreDC: relative restore not implemented");
- } else if (saved > 1) {
- throw new EMFJSError("restoreDC: absolute restore not implemented");
- }
- } else {
- throw new EMFJSError("No saved contexts");
- }
-
- this.state._svggroup = null;
- }
-
- setStretchBltMode(stretchMode: number) {
- Helper.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
- }
-
- _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {
+ private _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {
if (opts == null) {
opts = {};
}
@@ -605,304 +903,4 @@ export class GDIContext {
}
return opts;
}
-
- rectangle(rect: RectL, rw: number, rh: number) {
- Helper.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
- const bottom = this._todevY(rect.bottom);
- const right = this._todevX(rect.right);
- const top = this._todevY(rect.top);
- const left = this._todevX(rect.left);
- rw = this._todevH(rw);
- rh = this._todevH(rh);
- Helper.log("[gdi] rectangle: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top
- + " left=" + left + " rh=" + rh + " rw=" + rw);
- this._pushGroup();
-
- const opts = this._applyOpts(null, true, true, false);
- this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);
- }
-
- lineTo(x: number, y: number) {
- Helper.log("[gdi] lineTo: x=" + x + " y=" + y + " with pen " + this.state.selected.pen.toString());
- const toX = this._todevX(x);
- const toY = this._todevY(y);
- const fromX = this._todevX(this.state.x);
- const fromY = this._todevY(this.state.y);
-
- // Update position
- this.state.x = x;
- this.state.y = y;
-
- Helper.log("[gdi] lineTo: TRANSLATED: toX=" + toX + " toY=" + toY + " fromX=" + fromX + " fromY=" + fromY);
- this._pushGroup();
-
- const opts = this._applyOpts(null, true, false, false);
- this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);
- }
-
- moveToEx(x: number, y: number) {
- Helper.log("[gdi] moveToEx: x=" + x + " y=" + y);
- this.state.x = x;
- this.state.y = y;
- if (this._svgPath != null) {
- this._svgPath.move(this.state.x, this.state.y);
- Helper.log("[gdi] new path: " + this._svgPath.path());
- }
- }
-
- polygon(points: PointS[] | PointL[], bounds: RectL, first: boolean) {
- Helper.log("[gdi] polygon: points=" + points + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
- const pts = [];
- for (let i = 0; i < points.length; i++) {
- const point = points[i];
- pts.push([this._todevX(point.x), this._todevY(point.y)]);
- }
- if (first) {
- this._pushGroup();
- }
- const opts = {
- "fill-rule": this.state.polyfillmode === Helper.GDI.PolygonFillMode.ALTERNATE ? "evenodd" : "nonzero",
- };
- this._applyOpts(opts, true, true, false);
- this._svg.polygon(this.state._svggroup, pts, opts);
- }
-
- polyPolygon(polygons: PointS[][] | PointL[][], bounds: RectL) {
- Helper.log("[gdi] polyPolygon: polygons.length=" + polygons.length
- + " with pen " + this.state.selected.pen.toString() + " and brush " + this.state.selected.brush.toString());
-
- const cnt = polygons.length;
- for (let i = 0; i < cnt; i++) {
- this.polygon(polygons[i], bounds, i === 0);
- }
- }
-
- polyline(isLineTo: boolean, points: PointS[], bounds: RectL) {
- Helper.log("[gdi] polyline: isLineTo=" + isLineTo.toString() + ", points=" + points
- + ", bounds=" + bounds.toString() + " with pen " + this.state.selected.pen.toString());
- const pts = [];
- for (let i = 0; i < points.length; i++) {
- const point = points[i];
- pts.push([this._todevX(point.x), this._todevY(point.y)]);
- }
-
- if (this._svgPath != null) {
- if (!isLineTo || pts.length === 0) {
- this._svgPath.move(this._todevX(this.state.x), this._todevY(this.state.y));
- } else {
- const firstPts = pts[0];
- this._svgPath.move(firstPts[0], firstPts[1]);
- }
- this._svgPath.line(pts);
- Helper.log("[gdi] new path: " + this._svgPath.path());
- } else {
- this._pushGroup();
- const opts = this._applyOpts(null, true, false, false);
- if (isLineTo && points.length > 0) {
- const firstPt = points[0];
- if (firstPt.x !== this.state.x || firstPt.y !== this.state.y) {
- pts.unshift([this._todevX(this.state.x), this._todevY(this.state.y)]);
- }
- }
- this._svg.polyline(this.state._svggroup, pts, opts);
- }
-
- if (points.length > 0) {
- const lastPt = points[points.length - 1];
- this.state.x = lastPt.x;
- this.state.y = lastPt.y;
- }
- }
-
- polybezier(isPolyBezierTo: boolean, points: PointS[], bounds: RectL) {
- Helper.log("[gdi] polybezier: isPolyBezierTo=" + isPolyBezierTo.toString() + ", points=" + points
- + ", bounds=" + bounds.toString() + " with pen " + this.state.selected.pen.toString());
- const pts = [];
- for (let i = 0; i < points.length; i++) {
- const point = points[i];
- pts.push({ x: this._todevX(point.x), y: this._todevY(point.y)});
- }
-
- if (this._svgPath != null) {
- if (isPolyBezierTo && pts.length > 0) {
- const firstPts = pts[0];
- this._svgPath.move(firstPts.x, firstPts.y);
- } else {
- this._svgPath.move(this._todevX(this.state.x), this._todevY(this.state.y));
- }
-
- if (pts.length < (isPolyBezierTo ? 3 : 4)) {
- throw new EMFJSError("Not enough points to draw bezier");
- }
-
- for (let i = isPolyBezierTo ? 1 : 0; i + 3 <= pts.length; i += 3) {
- const cp1 = pts[i];
- const cp2 = pts[i + 1];
- const ep = pts[i + 2];
- this._svgPath.curveC(cp1.x, cp1.y, cp2.x, cp2.y, ep.x, ep.y);
- }
-
- Helper.log("[gdi] new path: " + this._svgPath.path());
- } else {
- throw new EMFJSError("polybezier not implemented (not a path)");
- }
-
- if (points.length > 0) {
- const lastPt = points[points.length - 1];
- this.state.x = lastPt.x;
- this.state.y = lastPt.y;
- }
- }
-
- selectClipPath(rgnMode: number) {
- Helper.log("[gdi] selectClipPath: rgnMode=0x" + rgnMode.toString(16));
- }
-
- selectClipRgn(rgnMode: number, region: Region) {
- Helper.log("[gdi] selectClipRgn: rgnMode=0x" + rgnMode.toString(16));
- if (rgnMode === Helper.GDI.RegionMode.RGN_COPY) {
- this.state.selected.region = region;
- this.state.clip = null;
- this.state.ownclip = false;
- } else {
- if (region == null) {
- throw new EMFJSError("No clip region to select");
- }
-
- throw new EMFJSError("Not implemented: rgnMode=0x" + rgnMode.toString(16));
- }
- this.state._svgclipChanged = true;
- }
-
- offsetClipRgn(offset: PointL) {
- Helper.log("[gdi] offsetClipRgn: offset=" + offset.toString());
- this._getClipRgn().offset(offset.x, offset.y);
- }
-
- setTextAlign(textAlignmentMode: number) {
- Helper.log("[gdi] setTextAlign: textAlignmentMode=0x" + textAlignmentMode.toString(16));
- this.state.textalign = textAlignmentMode;
- }
-
- setMiterLimit(miterLimit: number) {
- Helper.log("[gdi] setMiterLimit: miterLimit=" + miterLimit);
- this.state.miterlimit = miterLimit;
- }
-
- setBkMode(bkMode: number) {
- Helper.log("[gdi] setBkMode: bkMode=0x" + bkMode.toString(16));
- this.state.bkmode = bkMode;
- }
-
- setBkColor(bkColor: ColorRef) {
- Helper.log("[gdi] setBkColor: bkColor=" + bkColor.toString());
- this.state.bkcolor = bkColor;
- this.state._svgtextbkfilter = null;
- }
-
- setPolyFillMode(polyFillMode: number) {
- Helper.log("[gdi] setPolyFillMode: polyFillMode=" + polyFillMode);
- this.state.polyfillmode = polyFillMode;
- }
-
- createBrush(index: number, brush: Brush) {
- const idx = this._storeObject(brush, index);
- Helper.log("[gdi] createBrush: brush=" + brush.toString() + " with handle " + idx);
- }
-
- createPen(index: number, pen: Pen) {
- const idx = this._storeObject(pen, index);
- Helper.log("[gdi] createPen: pen=" + pen.toString() + " width handle " + idx);
- }
-
- createPenEx(index: number, pen: Pen) {
- const idx = this._storeObject(pen, index);
- Helper.log("[gdi] createPenEx: pen=" + pen.toString() + " width handle " + idx);
- }
-
- selectObject(objIdx: number, checkType: string) {
- const obj = this._getObject(objIdx);
- if (obj != null && (checkType == null || obj.type === checkType)) {
- this._selectObject(obj);
- Helper.log("[gdi] selectObject: objIdx=" + objIdx
- + (obj ? " selected " + obj.type + ": " + obj.toString() : "[invalid index]"));
- } else {
- Helper.log("[gdi] selectObject: objIdx=" + objIdx
- + (obj ? " invalid object type: " + obj.type : "[invalid index]"));
- }
- }
-
- _abortPath() {
- if (this._svgPath != null) {
- this._svgPath = null;
- }
- }
-
- abortPath() {
- Helper.log("[gdi] abortPath");
- this._abortPath();
- }
-
- beginPath() {
- Helper.log("[gdi] beginPath");
-
- this._abortPath();
-
- this._svgPath = this._svg.createPath();
- }
-
- closeFigure() {
- Helper.log("[gdi] closeFigure");
- if (this._svgPath == null) {
- throw new EMFJSError("No path bracket: cannot close figure");
- }
-
- this._svgPath.close();
- }
-
- fillPath(bounds: RectL) {
- Helper.log("[gdi] fillPath");
- if (this.state.selected.path == null) {
- throw new EMFJSError("No path selected");
- }
-
- const selPath = this.state.selected.path;
- const opts = this._applyOpts(null, true, true, false);
- this._svg.path(this.state._svggroup, selPath.svgPath, opts);
-
- this._pushGroup();
- this.state.selected.path = null;
- }
-
- strokePath(bounds: RectL) {
- Helper.log("[gdi] strokePath");
- if (this.state.selected.path == null) {
- throw new EMFJSError("No path selected");
- }
-
- const selPath = this.state.selected.path;
- const opts = this._applyOpts({fill: "none"}, true, false, false);
- this._svg.path(this.state._svggroup, selPath.svgPath, opts);
-
- this._pushGroup();
- this.state.selected.path = null;
- }
-
- endPath() {
- Helper.log("[gdi] endPath");
- if (this._svgPath == null) {
- throw new EMFJSError("No path bracket: cannot end path");
- }
-
- this._pushGroup();
- this._selectObject(new Path(this._svgPath));
- this._svgPath = null;
- }
-
- deleteObject(objIdx: number) {
- const ret = this._deleteObject(objIdx);
- Helper.log("[gdi] deleteObject: objIdx=" + objIdx + (ret ? " deleted object" : "[invalid index]"));
- }
}
diff --git a/src/emfjs/Helper.ts b/src/emfjs/Helper.ts
index 5c0a9b5..4ea777f 100644
--- a/src/emfjs/Helper.ts
+++ b/src/emfjs/Helper.ts
@@ -46,7 +46,7 @@ export function loggingEnabled(enabled: boolean) {
}
export class Helper {
- static GDI = {
+ public static GDI = {
FormatSignature: {
ENHMETA_SIGNATURE: 0x464D4520,
EPS_SIGNATURE: 0x46535045,
@@ -328,27 +328,27 @@ export class Helper {
},
};
- static _uniqueId = 0;
+ public static _uniqueId = 0;
- static log(message: string) {
+ public static log(message: string) {
if (isLoggingEnabled) {
// tslint:disable-next-line:no-console
console.log(message);
}
}
- static _makeUniqueId(prefix: string) {
+ public static _makeUniqueId(prefix: string) {
return "EMFJS_" + prefix + (this._uniqueId++);
}
- static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {
+ public static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {
uint8arr[pos++] = val & 0xff;
uint8arr[pos++] = (val >>> 8) & 0xff;
uint8arr[pos++] = (val >>> 16) & 0xff;
uint8arr[pos++] = (val >>> 24) & 0xff;
}
- static _blobToBinary(blob: Uint8Array) {
+ public static _blobToBinary(blob: Uint8Array) {
let ret = "";
const len = blob.length;
for (let i = 0; i < len; i++) {
diff --git a/src/emfjs/Primitives.ts b/src/emfjs/Primitives.ts
index 938d87f..4c2a56c 100644
--- a/src/emfjs/Primitives.ts
+++ b/src/emfjs/Primitives.ts
@@ -29,8 +29,8 @@ import { Blob } from "./Blob";
import { EMFJSError } from "./Helper";
export class PointS {
- x: number;
- y: number;
+ public x: number;
+ public y: number;
constructor(reader: Blob, x?: number, y?: number) {
if (reader != null) {
@@ -42,18 +42,18 @@ export class PointS {
}
}
- clone() {
+ public clone() {
return new PointS(null, this.x, this.y);
}
- toString() {
+ public toString() {
return "{x: " + this.x + ", y: " + this.y + "}";
}
}
export class PointL {
- x: number;
- y: number;
+ public x: number;
+ public y: number;
constructor(reader: Blob, x?: number, y?: number) {
if (reader != null) {
@@ -65,20 +65,20 @@ export class PointL {
}
}
- clone() {
+ public clone() {
return new PointL(null, this.x, this.y);
}
- toString() {
+ public toString() {
return "{x: " + this.x + ", y: " + this.y + "}";
}
}
export class RectL {
- left: number;
- top: number;
- right: number;
- bottom: number;
+ public left: number;
+ public top: number;
+ public right: number;
+ public bottom: number;
constructor(reader: Blob, left?: number, top?: number, right?: number, bottom?: number) {
if (reader != null) {
@@ -94,20 +94,20 @@ export class RectL {
}
}
- clone() {
+ public clone() {
return new RectL(null, this.left, this.top, this.right, this.bottom);
}
- toString() {
+ public toString() {
return "{left: " + this.left + ", top: " + this.top + ", right: " + this.right
+ ", bottom: " + this.bottom + "}";
}
- empty() {
+ public empty() {
return this.left >= this.right || this.top >= this.bottom;
}
- intersect(rectL: RectL) {
+ public intersect(rectL: RectL) {
if (this.empty() || rectL.empty()) {
return null;
}
@@ -121,8 +121,8 @@ export class RectL {
}
export class SizeL {
- cx: number;
- cy: number;
+ public cx: number;
+ public cy: number;
constructor(reader: Blob, cx?: number, cy?: number) {
if (reader != null) {
@@ -134,27 +134,27 @@ export class SizeL {
}
}
- clone() {
+ public clone() {
return new SizeL(null, this.cx, this.cy);
}
- toString() {
+ public toString() {
return "{cx: " + this.cx + ", cy: " + this.cy + "}";
}
}
export class Obj {
- type: string;
+ public type: string;
constructor(type: string) {
this.type = type;
}
- clone(): Obj {
+ public clone(): Obj {
throw new EMFJSError("clone not implemented");
}
- toString() {
+ public toString() {
throw new EMFJSError("toString not implemented");
}
}
diff --git a/src/emfjs/Region.ts b/src/emfjs/Region.ts
index bbefae4..9d6c6a0 100644
--- a/src/emfjs/Region.ts
+++ b/src/emfjs/Region.ts
@@ -30,9 +30,9 @@ import { EMFJSError, Helper } from "./Helper";
import { Obj, RectL } from "./Primitives";
export class Region extends Obj {
- bounds: RectL;
- scans: Scan[];
- complexity: number;
+ public bounds: RectL;
+ public scans: Scan[];
+ public complexity: number;
constructor(reader: Blob, copy?: Region) {
super("region");
@@ -79,18 +79,18 @@ export class Region extends Obj {
}
}
- clone() {
+ public clone() {
return new Region(null, this);
}
- toString() {
+ public toString() {
const _complexity = ["null", "simple", "complex"];
return "{complexity: " + _complexity[this.complexity]
+ " bounds: " + (this.bounds != null ? this.bounds.toString() : "[none]")
+ " #scans: " + (this.scans != null ? this.scans.length : "[none]") + "}";
}
- _updateComplexity() {
+ public _updateComplexity() {
if (this.bounds == null) {
this.complexity = 0;
this.scans = null;
@@ -115,7 +115,7 @@ export class Region extends Obj {
}
}
- subtract(rect: RectL) {
+ public subtract(rect: RectL) {
Helper.log("[emf] Region " + this.toString() + " subtract " + rect.toString());
if (this.bounds != null) {
@@ -242,7 +242,7 @@ export class Region extends Obj {
Helper.log("[emf] Region subtraction -> " + this.toString());
}
- intersect(rect: RectL) {
+ public intersect(rect: RectL) {
Helper.log("[emf] Region " + this.toString() + " intersect with " + rect.toString());
if (this.bounds != null) {
this.bounds = this.bounds.intersect(rect);
@@ -302,7 +302,7 @@ export class Region extends Obj {
Helper.log("[emf] Region intersection -> " + this.toString());
}
- offset(offX: number, offY: number) {
+ public offset(offX: number, offY: number) {
if (this.bounds != null) {
this.bounds.left += offX;
this.bounds.top += offY;
@@ -336,9 +336,9 @@ export function CreateSimpleRegion(left: number, top: number, right: number, bot
}
export class Scan {
- top: number;
- bottom: number;
- scanlines: Array<{left: number, right: number}>;
+ public top: number;
+ public bottom: number;
+ public scanlines: Array<{left: number, right: number}>;
constructor(r: RectL, copy?: Scan) {
if (r != null) {
@@ -356,15 +356,15 @@ export class Scan {
}
}
- clone() {
+ public clone() {
return new Scan(null, this);
}
- append(r: RectL) {
+ public append(r: RectL) {
this.scanlines.push({left: r.left, right: r.right});
}
- subtract(left: number, right: number) {
+ public subtract(left: number, right: number) {
let i;
// Keep everything on the left side
@@ -409,7 +409,7 @@ export class Scan {
return this.scanlines.length > 0;
}
- intersect(left: number, right: number) {
+ public intersect(left: number, right: number) {
// Get rid of anything that falls entirely outside to the left
for (let i = 0; i < this.scanlines.length; i++) {
const scanline = this.scanlines[i];
diff --git a/src/emfjs/Renderer.ts b/src/emfjs/Renderer.ts
index 6a7e41e..35f4fb0 100644
--- a/src/emfjs/Renderer.ts
+++ b/src/emfjs/Renderer.ts
@@ -30,7 +30,7 @@ import { EMFRecords } from "./EMFRecords";
import { GDIContext } from "./GDIContext";
import { EMFJSError, Helper } from "./Helper";
-export class RendererSettings {
+export interface IRendererSettings {
width: string;
height: string;
wExt: number;
@@ -41,14 +41,28 @@ export class RendererSettings {
}
export class Renderer {
- _img: EMF;
+ private _img: EMF;
constructor(blob: ArrayBuffer) {
this.parse(blob);
Helper.log("EMFJS.Renderer instantiated");
}
- parse(blob: ArrayBuffer) {
+ public render(info: IRendererSettings) {
+ const img = ($("
") as any).svg({
+ onLoad: (svg: any) => {
+ return this._render(svg, info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
+ },
+ settings: {
+ viewBox: [0, 0, info.xExt, info.yExt].join(" "),
+ preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
+ },
+ });
+ const svgContainer = ($(img[0]) as any).svg("get");
+ return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
+ }
+
+ private parse(blob: ArrayBuffer) {
this._img = null;
const reader = new Blob(blob);
@@ -69,7 +83,7 @@ export class Renderer {
}
}
- _render(svg: any, mapMode: number, w: number, h: number, xExt: number, yExt: number) {
+ private _render(svg: any, mapMode: number, w: number, h: number, xExt: number, yExt: number) {
const gdi = new GDIContext(svg);
gdi.setWindowExtEx(w, h);
gdi.setViewportExtEx(xExt, yExt);
@@ -78,26 +92,12 @@ export class Renderer {
this._img.render(gdi);
Helper.log("[EMF] <--- DONE RENDERING");
}
-
- render(info: RendererSettings) {
- const img = ($("
") as any).svg({
- onLoad: (svg: any) => {
- return this._render(svg, info.mapMode, info.wExt, info.hExt, info.xExt, info.yExt);
- },
- settings: {
- viewBox: [0, 0, info.xExt, info.yExt].join(" "),
- preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
- },
- });
- const svgContainer = ($(img[0]) as any).svg("get");
- return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
- }
}
export class EMF {
- _reader: Blob;
- _hdrsize: number;
- _records: EMFRecords;
+ private _reader: Blob;
+ private _hdrsize: number;
+ private _records: EMFRecords;
constructor(reader: Blob, hdrsize: number) {
this._reader = reader;
@@ -105,7 +105,7 @@ export class EMF {
this._records = new EMFRecords(reader, this._hdrsize);
}
- render(gdi: GDIContext) {
+ public render(gdi: GDIContext) {
this._records.play(gdi);
}
}
diff --git a/src/emfjs/Style.ts b/src/emfjs/Style.ts
index db614cb..d7beee9 100644
--- a/src/emfjs/Style.ts
+++ b/src/emfjs/Style.ts
@@ -31,9 +31,9 @@ import { Helper } from "./Helper";
import { Obj, PointL } from "./Primitives";
export class ColorRef {
- r: number;
- g: number;
- b: number;
+ public r: number;
+ public g: number;
+ public b: number;
constructor(reader: Blob, r?: number, g?: number, b?: number) {
if (reader != null) {
@@ -48,36 +48,36 @@ export class ColorRef {
}
}
- clone() {
+ public clone() {
return new ColorRef(null, this.r, this.g, this.b);
}
- toHex() {
+ public toHex() {
const rgb = (this.r << 16) | (this.g << 8) | this.b;
return (0x1000000 + rgb).toString(16).slice(1);
}
- toString() {
+ public toString() {
return "{r: " + this.r + ", g: " + this.g + ", b: " + this.b + "}";
}
}
export class Font extends Obj {
- height: number;
- width: number;
- escapement: number;
- orientation: number;
- weight: number;
- italic: number;
- underline: number;
- strikeout: number;
- charset: number;
- outprecision: number;
- clipprecision: number;
- quality: number;
- pitch: number;
- family: number;
- facename: string;
+ public height: number;
+ public width: number;
+ public escapement: number;
+ public orientation: number;
+ public weight: number;
+ public italic: number;
+ public underline: number;
+ public strikeout: number;
+ public charset: number;
+ public outprecision: number;
+ public clipprecision: number;
+ public quality: number;
+ public pitch: number;
+ public family: number;
+ public facename: string;
constructor(reader: Blob, copy: Font | number) {
super("font");
@@ -138,21 +138,21 @@ export class Font extends Obj {
}
}
- clone() {
+ public clone() {
return new Font(null, this);
}
- toString() {
+ public toString() {
return JSON.stringify(this);
}
}
export class Brush extends Obj {
- style: number;
- color: ColorRef;
- pattern: DIBitmap;
- dibpatternpt: DIBitmap;
- hatchstyle: number;
+ public style: number;
+ public color: ColorRef;
+ public pattern: DIBitmap;
+ public dibpatternpt: DIBitmap;
+ public hatchstyle: number;
constructor(reader: Blob, copy?: {style?: number, color?: ColorRef, pattern?: DIBitmap,
dibpatternpt?: DIBitmap, hatchstyle?: number}) {
@@ -198,11 +198,11 @@ export class Brush extends Obj {
}
}
- clone() {
+ public clone() {
return new Brush(null, this);
}
- toString() {
+ public toString() {
let ret = "{style: " + this.style;
switch (this.style) {
case Helper.GDI.BrushStyle.BS_SOLID:
@@ -217,10 +217,10 @@ export class Brush extends Obj {
}
export class Pen extends Obj {
- style: number | {header: {off: number, size: number}, data: {off: number, size: number}};
- width: number;
- brush: Brush;
- color: ColorRef;
+ public style: number | {header: {off: number, size: number}, data: {off: number, size: number}};
+ public width: number;
+ public brush: Brush;
+ public color: ColorRef;
constructor(reader: Blob, style?: number | {header: {off: number, size: number}, data: {off: number, size: number}},
width?: number, color?: ColorRef, brush?: Brush) {
@@ -253,12 +253,12 @@ export class Pen extends Obj {
}
}
- clone() {
+ public clone() {
return new Pen(null, this.style, this.width, this.color != null ? this.color.clone() : null,
this.brush != null ? this.brush.clone() : null);
}
- toString() {
+ public toString() {
return "{style: " + this.style + ", width: " + this.width
+ ", color: " + (this.color != null ? this.color.toString() : "none") + "}";
}
diff --git a/src/rtfjs/Document.ts b/src/rtfjs/Document.ts
index 5608241..be86018 100644
--- a/src/rtfjs/Document.ts
+++ b/src/rtfjs/Document.ts
@@ -35,13 +35,13 @@ export interface ISettings {
width?: number, height?: number}) => void): void;
}
export class Document {
- _settings: ISettings;
- _meta: {[key: string]: any};
- _fonts: FonttblDestinationSub[];
- _colors: IColor[];
- _autoColor: number;
- _stylesheets: Array<{index: number, name: string}>;
- _ins: Array
void)>;
+ public _settings: ISettings;
+ public _meta: {[key: string]: any};
+ public _fonts: FonttblDestinationSub[];
+ public _colors: IColor[];
+ public _autoColor: number;
+ public _stylesheets: Array<{index: number, name: string}>;
+ public _ins: Array void)>;
constructor(settings: ISettings) {
this._settings = settings || {};
@@ -53,7 +53,7 @@ export class Document {
this._ins = [];
}
- _lookupColor(idx: number) {
+ public _lookupColor(idx: number) {
if (idx === 0) {
if (this._autoColor == null) {
return null;
@@ -66,7 +66,7 @@ export class Document {
return this._colors[idx];
}
- addIns(ins: string | ((this: Renderer) => void)) {
+ public addIns(ins: string | ((this: Renderer) => void)) {
this._ins.push(ins);
}
diff --git a/src/rtfjs/DocumentFacade.ts b/src/rtfjs/DocumentFacade.ts
index 6a457de..3f0a302 100644
--- a/src/rtfjs/DocumentFacade.ts
+++ b/src/rtfjs/DocumentFacade.ts
@@ -30,9 +30,9 @@ import { Parser } from "./parser/Parser";
import { Renderer } from "./Renderer";
export class DocumentFacade {
- _document: Document;
- _renderer: Renderer;
- _parsed: Promise;
+ private _document: Document;
+ private _renderer: Renderer;
+ private _parsed: Promise;
constructor(blob: ArrayBuffer, settings: ISettings) {
this._document = new Document(settings);
@@ -41,11 +41,11 @@ export class DocumentFacade {
this._parsed = parser.parse();
}
- metadata() {
+ public metadata() {
return this._document._meta;
}
- render(): Promise {
+ public render(): Promise {
return this._parsed
.then(() => {
return this._renderer.buildDom();
diff --git a/src/rtfjs/Helper.ts b/src/rtfjs/Helper.ts
index f5fd6f6..c8f8c34 100644
--- a/src/rtfjs/Helper.ts
+++ b/src/rtfjs/Helper.ts
@@ -47,36 +47,27 @@ export function loggingEnabled(enabled: boolean) {
}
export class Helper {
- static _A = "A".charCodeAt(0);
- static _a = "a".charCodeAt(0);
- static _F = "F".charCodeAt(0);
- static _f = "f".charCodeAt(0);
- static _Z = "Z".charCodeAt(0);
- static _z = "z".charCodeAt(0);
- static _0 = "0".charCodeAt(0);
- static _9 = "9".charCodeAt(0);
-
- static JUSTIFICATION = {
+ public static JUSTIFICATION = {
LEFT: "left",
CENTER: "center",
RIGHT: "right",
JUSTIFY: "justify",
};
- static BREAKTYPE = {
+ public static BREAKTYPE = {
NONE: "none",
COL: "col", // TODO: ???
EVEN: "even",
ODD: "odd",
PAGE: "page",
};
- static PAGENUMBER = {
+ public static PAGENUMBER = {
DECIMAL: "decimal",
UROM: "urom", // TODO: ???
LROM: "lrom", // TODO: ???
ULTR: "ultr", // TODO: ???
LLTR: "lltr", // TODO: ???
};
- static UNDERLINE = {
+ public static UNDERLINE = {
NONE: "none",
CONTINUOUS: "continuous",
DOTTED: "dotted",
@@ -96,18 +87,135 @@ export class Helper {
WORD: "word",
WAVE: "wave",
};
- static FONTPITCH = {
+ public static FONTPITCH = {
DEFAULT: 0,
FIXED: 1,
VARIABLE: 2,
};
- static CHARACTER_TYPE = {
+ public static CHARACTER_TYPE = {
LOWANSI: "loch",
HIGHANSI: "hich",
DOUBLE: "dbch",
};
- static _charsetMap: {[key: string]: number} = {
+ public static log(message: string) {
+ if (isLoggingEnabled) {
+ // tslint:disable-next-line:no-console
+ console.log(message);
+ }
+ }
+
+ public static _isalpha(str: string): boolean {
+ const len = str.length;
+ for (let i = 0; i < len; i++) {
+ const ch = str.charCodeAt(i);
+ if (!((ch >= this._A && ch <= this._Z) ||
+ (ch >= this._a && ch <= this._z))) {
+ return false;
+ }
+ }
+ return len > 0;
+ }
+
+ public static _isdigit(str: string): boolean {
+ const len = str.length;
+ for (let i = 0; i < len; i++) {
+ const ch = str.charCodeAt(i);
+ if (ch < this._0 || ch > this._9) {
+ return false;
+ }
+ }
+ return len > 0;
+ }
+
+ public static _parseHex(str: string): number {
+ const len = str.length;
+ for (let i = 0; i < len; i++) {
+ const ch = str.charCodeAt(i);
+ if (!((ch >= this._0 && ch <= this._9) ||
+ (ch >= this._a && ch <= this._f) ||
+ (ch >= this._A && ch <= this._F))) {
+ return NaN;
+ }
+ }
+ if (len > 0) {
+ return parseInt(str, 16);
+ }
+ return NaN;
+ }
+
+ public static _blobToBinary(blob: ArrayBuffer): string {
+ const view = new Uint8Array(blob);
+ let ret = "";
+ const len = view.length;
+ for (let i = 0; i < len; i++) {
+ ret += String.fromCharCode(view[i]);
+ }
+ return ret;
+ }
+
+ public static _hexToBlob(str: string): ArrayBuffer {
+ let len = str.length;
+ const buf = new ArrayBuffer(Math.floor(len-- / 2));
+ const view = new Uint8Array(buf);
+ let d = 0;
+ for (let i = 0; i < len; i += 2) {
+ const val = this._parseHex(str.substr(i, 2));
+ if (isNaN(val)) {
+ return null;
+ }
+ view[d++] = val;
+ }
+ return buf;
+ }
+
+ public static _hexToBinary(str: string): string {
+ let bin = "";
+ const len = str.length - 1;
+ for (let i = 0; i < len; i += 2) {
+ const val = this._parseHex(str.substr(i, 2));
+ if (isNaN(val)) {
+ return null;
+ }
+ bin += String.fromCharCode(val);
+ }
+ return bin;
+ }
+
+ public static _mapCharset(idx: number): number {
+ return this._charsetMap[idx.toString()];
+ }
+
+ public static _mapColorTheme(name: string) {
+ return this._colorThemeMap[name];
+ }
+
+ public static _colorToStr(color: IColor) {
+ return "rgb(" + color.r + "," + color.g + "," + color.b + ")";
+ }
+
+ public static _twipsToPt(twips: number) {
+ return Math.floor(twips / 20);
+ }
+
+ public static _twipsToPx(twips: number) {
+ return Math.floor(twips / 20 * 96 / 72);
+ }
+
+ public static _pxToTwips(px: number) {
+ return Math.floor(px * 20 * 72 / 96);
+ }
+
+ private static _A = "A".charCodeAt(0);
+ private static _a = "a".charCodeAt(0);
+ private static _F = "F".charCodeAt(0);
+ private static _f = "f".charCodeAt(0);
+ private static _Z = "Z".charCodeAt(0);
+ private static _z = "z".charCodeAt(0);
+ private static _0 = "0".charCodeAt(0);
+ private static _9 = "9".charCodeAt(0);
+
+ private static _charsetMap: {[key: string]: number} = {
0: 1252, // ANSI_CHARSET
77: 10000, // Mac Roman
78: 10001, // Mac Shift Jis
@@ -139,7 +247,7 @@ export class Helper {
255: 850, // OEM
};
- static _colorThemeMap: {[key: string]: null} = {
+ private static _colorThemeMap: {[key: string]: null} = {
// TODO
maindarkone: null,
mainlightone: null,
@@ -158,112 +266,4 @@ export class Helper {
backgroundtwo: null,
texttwo: null,
};
-
- static log(message: string) {
- if (isLoggingEnabled) {
- // tslint:disable-next-line:no-console
- console.log(message);
- }
- }
-
- static _isalpha(str: string): boolean {
- const len = str.length;
- for (let i = 0; i < len; i++) {
- const ch = str.charCodeAt(i);
- if (!((ch >= this._A && ch <= this._Z) ||
- (ch >= this._a && ch <= this._z))) {
- return false;
- }
- }
- return len > 0;
- }
-
- static _isdigit(str: string): boolean {
- const len = str.length;
- for (let i = 0; i < len; i++) {
- const ch = str.charCodeAt(i);
- if (ch < this._0 || ch > this._9) {
- return false;
- }
- }
- return len > 0;
- }
-
- static _parseHex(str: string): number {
- const len = str.length;
- for (let i = 0; i < len; i++) {
- const ch = str.charCodeAt(i);
- if (!((ch >= this._0 && ch <= this._9) ||
- (ch >= this._a && ch <= this._f) ||
- (ch >= this._A && ch <= this._F))) {
- return NaN;
- }
- }
- if (len > 0) {
- return parseInt(str, 16);
- }
- return NaN;
- }
-
- static _blobToBinary(blob: ArrayBuffer): string {
- const view = new Uint8Array(blob);
- let ret = "";
- const len = view.length;
- for (let i = 0; i < len; i++) {
- ret += String.fromCharCode(view[i]);
- }
- return ret;
- }
-
- static _hexToBlob(str: string): ArrayBuffer {
- let len = str.length;
- const buf = new ArrayBuffer(Math.floor(len-- / 2));
- const view = new Uint8Array(buf);
- let d = 0;
- for (let i = 0; i < len; i += 2) {
- const val = this._parseHex(str.substr(i, 2));
- if (isNaN(val)) {
- return null;
- }
- view[d++] = val;
- }
- return buf;
- }
-
- static _hexToBinary(str: string): string {
- let bin = "";
- const len = str.length - 1;
- for (let i = 0; i < len; i += 2) {
- const val = this._parseHex(str.substr(i, 2));
- if (isNaN(val)) {
- return null;
- }
- bin += String.fromCharCode(val);
- }
- return bin;
- }
-
- static _mapCharset(idx: number): number {
- return this._charsetMap[idx.toString()];
- }
-
- static _mapColorTheme(name: string) {
- return this._colorThemeMap[name];
- }
-
- static _colorToStr(color: IColor) {
- return "rgb(" + color.r + "," + color.g + "," + color.b + ")";
- }
-
- static _twipsToPt(twips: number) {
- return Math.floor(twips / 20);
- }
-
- static _twipsToPx(twips: number) {
- return Math.floor(twips / 20 * 96 / 72);
- }
-
- static _pxToTwips(px: number) {
- return Math.floor(px * 20 * 72 / 96);
- }
}
diff --git a/src/rtfjs/Renderer.ts b/src/rtfjs/Renderer.ts
index cd20b7c..6176f8a 100644
--- a/src/rtfjs/Renderer.ts
+++ b/src/rtfjs/Renderer.ts
@@ -35,14 +35,14 @@ export interface IContainerElement {
}
export class Renderer {
- _doc: Document;
- _dom: JQuery[];
+ public _doc: Document;
+ private _dom: JQuery[];
- _curRChp: RenderChp;
- _curRPap: RenderPap;
- _curpar: JQuery;
- _cursubpar: JQuery;
- _curcont: IContainerElement[];
+ private _curRChp: RenderChp;
+ private _curRPap: RenderPap;
+ private _curpar: JQuery;
+ private _cursubpar: JQuery;
+ private _curcont: IContainerElement[];
constructor(doc: Document) {
this._doc = doc;
@@ -55,7 +55,7 @@ export class Renderer {
this._curcont = [];
}
- pushContainer(contel: IContainerElement) {
+ public pushContainer(contel: IContainerElement) {
if (this._curpar == null) {
this.startPar();
}
@@ -73,18 +73,18 @@ export class Renderer {
}
}
- popContainer() {
+ public popContainer() {
const contel = this._curcont.pop();
if (contel == null) {
throw new RTFJSError("No container on rendering stack");
}
}
- buildHyperlinkElement(url: string): JQuery {
+ public buildHyperlinkElement(url: string): JQuery {
return $("").attr("href", url);
}
- _appendToPar(el: JQuery, newsubpar?: boolean) {
+ public _appendToPar(el: JQuery, newsubpar?: boolean) {
if (this._curpar == null) {
this.startPar();
}
@@ -116,7 +116,7 @@ export class Renderer {
}
}
- startPar() {
+ public startPar() {
this._curpar = $("");
if (this._curRPap != null) {
this._curRPap.apply(this._doc, this._curpar, this._curRChp, true);
@@ -127,15 +127,15 @@ export class Renderer {
this._dom.push(this._curpar);
}
- lineBreak() {
+ public lineBreak() {
this._appendToPar(null, true);
}
- setChp(rchp: RenderChp) {
+ public setChp(rchp: RenderChp) {
this._curRChp = rchp;
}
- setPap(rpap: RenderPap) {
+ public setPap(rpap: RenderPap) {
this._curRPap = rpap;
if (this._cursubpar != null) {
this._curRPap.apply(this._doc, this._cursubpar, null, false);
@@ -146,22 +146,22 @@ export class Renderer {
}
}
- appendElement(element: JQuery) {
+ public appendElement(element: JQuery) {
this._appendToPar(element);
}
- buildRenderedPicture(element: JQuery): JQuery {
+ public buildRenderedPicture(element: JQuery): JQuery {
if (element == null) {
element = $("
").text("[failed to render image]");
}
return element;
}
- renderedPicture(element: JQuery) {
+ public renderedPicture(element: JQuery) {
this._appendToPar(this.buildRenderedPicture(element));
}
- buildPicture(mime: string, data: string): JQuery {
+ public buildPicture(mime: string, data: string): JQuery {
if (data != null) {
return $("
", {
src: "data:" + mime + ";base64," + btoa(data),
@@ -175,11 +175,11 @@ export class Renderer {
}
}
- picture(mime: string, data: string) {
+ public picture(mime: string, data: string) {
this._appendToPar(this.buildPicture(mime, data));
}
- buildDom(): JQuery[] {
+ public buildDom(): JQuery[] {
if (this._dom != null) {
return this._dom;
}
diff --git a/src/rtfjs/parser/Containers.ts b/src/rtfjs/parser/Containers.ts
index 722a78c..e477e6c 100644
--- a/src/rtfjs/parser/Containers.ts
+++ b/src/rtfjs/parser/Containers.ts
@@ -29,14 +29,14 @@ import { Renderer } from "../Renderer";
import { IDestination } from "./Destinations";
export class Chp {
- bold: boolean;
- underline: string;
- italic: boolean;
- strikethrough: boolean;
- dblstrikethrough: boolean;
- colorindex: number;
- fontsize: number;
- fontfamily: number;
+ public bold: boolean;
+ public underline: string;
+ public italic: boolean;
+ public strikethrough: boolean;
+ public dblstrikethrough: boolean;
+ public colorindex: number;
+ public fontsize: number;
+ public fontfamily: number;
constructor(parent: Chp) {
if (parent != null) {
@@ -61,11 +61,11 @@ export class Chp {
}
export class Pap {
- indent: {left: number, right: number, firstline: number};
- justification: string;
- spacebefore: number;
- spaceafter: number;
- charactertype: string;
+ public indent: {left: number, right: number, firstline: number};
+ public justification: string;
+ public spacebefore: number;
+ public spaceafter: number;
+ public charactertype: string;
constructor(parent: Pap) {
if (parent != null) {
@@ -92,10 +92,10 @@ export class Pap {
}
export class Sep {
- columns: number;
- breaktype: string;
- pagenumber: {x: number, y: number};
- pagenumberformat: string;
+ public columns: number;
+ public breaktype: string;
+ public pagenumber: {x: number, y: number};
+ public pagenumberformat: string;
constructor(parent: Sep) {
if (parent != null) {
@@ -119,12 +119,12 @@ export class Sep {
}
export class Dop {
- width: number;
- height: number;
- margin: {left: number, top: number, right: number, bottom: number};
- pagenumberstart: number;
- facingpages: boolean;
- landscape: boolean;
+ public width: number;
+ public height: number;
+ public margin: {left: number, top: number, right: number, bottom: number};
+ public pagenumberstart: number;
+ public facingpages: boolean;
+ public landscape: boolean;
constructor(parent: Dop) {
if (parent != null) {
@@ -156,18 +156,18 @@ export class Dop {
}
export class State {
- parent: State;
- first: boolean;
- skipchars: number;
- bindata: number;
- chp: Chp;
- pap: Pap;
- sep: Sep;
- dop: Dop;
- destination: IDestination;
- skipunknowndestination: boolean;
- skipdestination: boolean;
- ucn: number;
+ public parent: State;
+ public first: boolean;
+ public skipchars: number;
+ public bindata: number;
+ public chp: Chp;
+ public pap: Pap;
+ public sep: Sep;
+ public dop: Dop;
+ public destination: IDestination;
+ public skipunknowndestination: boolean;
+ public skipdestination: boolean;
+ public ucn: number;
[key: string]: any;
constructor(parent: State) {
@@ -198,16 +198,16 @@ export class State {
}
export class GlobalState {
- data: Uint8Array;
- pos: number;
- line: number;
- column: number;
- state: State;
- version: number;
- text: string;
- codepage: number;
- _asyncTasks: Array>;
- renderer: Renderer;
+ public data: Uint8Array;
+ public pos: number;
+ public line: number;
+ public column: number;
+ public state: State;
+ public version: number;
+ public text: string;
+ public codepage: number;
+ public _asyncTasks: Array>;
+ public renderer: Renderer;
constructor(blob: ArrayBuffer, renderer: Renderer) {
this.data = new Uint8Array(blob);
diff --git a/src/rtfjs/parser/Destinations.ts b/src/rtfjs/parser/Destinations.ts
index 03c2035..937a4ef 100644
--- a/src/rtfjs/parser/Destinations.ts
+++ b/src/rtfjs/parser/Destinations.ts
@@ -34,9 +34,9 @@ import { RenderChp } from "./RenderChp";
import { RenderPap } from "./RenderPap";
export abstract class DestinationFactory {
- class: { new (parser: GlobalState, inst: Document, name: string, param: number): T; };
+ public class: { new (parser: GlobalState, inst: Document, name: string, param: number): T; };
- newDestination(parser: GlobalState, inst: Document, name: string, param: number): T {
+ public newDestination(parser: GlobalState, inst: Document, name: string, param: number): T {
return new this.class(parser, inst, name, param);
}
}
@@ -67,7 +67,7 @@ const findParentDestination = (parser: GlobalState, dest: string) => {
};
export class DestinationBase implements IDestination {
- _name: string;
+ public _name: string;
constructor(name: string) {
this._name = name;
@@ -75,23 +75,23 @@ export class DestinationBase implements IDestination {
}
export class DestinationTextBase implements IDestination {
- _name: string;
- text: string;
+ public _name: string;
+ public text: string;
constructor(name: string) {
this._name = name;
this.text = "";
}
- appendText(text: string) {
+ public appendText(text: string) {
this.text += text;
}
}
export abstract class DestinationFormattedTextBase implements IDestination {
- parser: GlobalState;
- _name: string;
- _records: Array<(rtf: RtfDestination) => void>;
+ public _name: string;
+ protected parser: GlobalState;
+ private _records: Array<(rtf: RtfDestination) => void>;
constructor(parser: GlobalState, name: string) {
this.parser = parser;
@@ -99,19 +99,19 @@ export abstract class DestinationFormattedTextBase implements IDestination {
this._records = [];
}
- appendText(text: string) {
+ public appendText(text: string) {
this._records.push((rtf: RtfDestination) => {
rtf.appendText(text);
});
}
- handleKeyword(keyword: string, param: number) {
+ public handleKeyword(keyword: string, param: number) {
this._records.push((rtf: RtfDestination) => {
return rtf.handleKeyword(keyword, param);
});
}
- apply() {
+ public apply() {
const rtf = findParentDestination(this.parser, "rtf") as any as RtfDestination;
if (rtf == null) {
throw new RTFJSError("IDestination " + this._name + " is not child of rtf destination");
@@ -134,16 +134,16 @@ export abstract class DestinationFormattedTextBase implements IDestination {
delete this._records;
}
- abstract renderBegin(rtf: RtfDestination, records: number): boolean;
+ public abstract renderBegin(rtf: RtfDestination, records: number): boolean;
- abstract renderEnd(rtf: RtfDestination, records: number): void;
+ public abstract renderEnd(rtf: RtfDestination, records: number): void;
}
export class RtfDestination extends DestinationBase {
- _metadata: {[key: string]: any};
- parser: GlobalState;
- inst: Document;
- _charFormatHandlers: {[key: string]: (param: number) => void} = {
+ private _metadata: {[key: string]: any};
+ private parser: GlobalState;
+ private inst: Document;
+ private _charFormatHandlers: {[key: string]: (param: number) => void} = {
ansicpg: (param: number) => {
// if the value is 0, use the default charset as 0 is not valid
if (param > 0) {
@@ -248,26 +248,47 @@ export class RtfDestination extends DestinationBase {
this.inst = inst;
}
- addIns(func: (this: Renderer) => void) {
+ public addIns(func: (this: Renderer) => void) {
this.inst.addIns(func);
}
- appendText(text: string) {
+ public appendText(text: string) {
Helper.log("[rtf] output: " + text);
this.inst.addIns(text);
}
- sub() {
+ public sub() {
Helper.log("[rtf].sub()");
}
- _addInsHandler(func: (this: Renderer) => void) {
+ public handleKeyword(keyword: string, param: number) {
+ const handler = this._charFormatHandlers[keyword];
+ if (handler != null) {
+ handler(param);
+ return true;
+ }
+ return false;
+ }
+
+ public apply() {
+ Helper.log("[rtf] apply()");
+ for (const prop in this._metadata) {
+ this.inst._meta[prop] = this._metadata[prop];
+ }
+ delete this._metadata;
+ }
+
+ public setMetadata(prop: string, val: any) {
+ this._metadata[prop] = val;
+ }
+
+ private _addInsHandler(func: (this: Renderer) => void) {
return (param: number) => {
this.inst.addIns(func);
};
}
- _addFormatIns(ptype: string, props: Chp | Pap) {
+ private _addFormatIns(ptype: string, props: Chp | Pap) {
switch (ptype) {
case "chp":
const rchp = new RenderChp(new Chp(props as Chp));
@@ -284,7 +305,7 @@ export class RtfDestination extends DestinationBase {
}
}
- _genericFormatSetNoParam(ptype: string, prop: string, val: any) {
+ private _genericFormatSetNoParam(ptype: string, prop: string, val: any) {
return (param: number) => {
const props = this.parser.state[ptype];
props[prop] = val;
@@ -293,7 +314,7 @@ export class RtfDestination extends DestinationBase {
};
}
- _genericFormatOnOff(ptype: string, prop: string, onval?: string, offval?: string) {
+ private _genericFormatOnOff(ptype: string, prop: string, onval?: string, offval?: string) {
return (param: number) => {
const props = this.parser.state[ptype];
props[prop] = (param == null || param !== 0)
@@ -302,7 +323,7 @@ export class RtfDestination extends DestinationBase {
this._addFormatIns(ptype, props);
};
}
- _genericFormatSetVal(ptype: string, prop: string, defaultval: number) {
+ private _genericFormatSetVal(ptype: string, prop: string, defaultval: number) {
return (param: number) => {
const props = this.parser.state[ptype];
props[prop] = (param == null) ? defaultval : param;
@@ -310,7 +331,7 @@ export class RtfDestination extends DestinationBase {
this._addFormatIns(ptype, props);
};
}
- _genericFormatSetValRequired(ptype: string, prop: string) {
+ private _genericFormatSetValRequired(ptype: string, prop: string) {
return (param: number) => {
if (param == null) {
throw new RTFJSError("Keyword without required param");
@@ -321,7 +342,7 @@ export class RtfDestination extends DestinationBase {
this._addFormatIns(ptype, props);
};
}
- _genericFormatSetMemberVal(ptype: string, prop: string, member: string, defaultval: number) {
+ private _genericFormatSetMemberVal(ptype: string, prop: string, member: string, defaultval: number) {
return (param: number) => {
const props = this.parser.state[ptype];
const members = props[prop];
@@ -330,48 +351,28 @@ export class RtfDestination extends DestinationBase {
this._addFormatIns(ptype, props);
};
}
-
- handleKeyword(keyword: string, param: number) {
- const handler = this._charFormatHandlers[keyword];
- if (handler != null) {
- handler(param);
- return true;
- }
- return false;
- }
-
- apply() {
- Helper.log("[rtf] apply()");
- for (const prop in this._metadata) {
- this.inst._meta[prop] = this._metadata[prop];
- }
- delete this._metadata;
- }
- setMetadata(prop: string, val: any) {
- this._metadata[prop] = val;
- }
}
export interface IGenericPropertyDestination extends IDestination {
apply(): void;
}
export class GenericPropertyDestinationFactory extends DestinationFactory {
- parentdest: string;
- metaprop: string;
+ private parentdest: string;
+ private metaprop: string;
constructor(parentdest: string, metaprop: string) {
super();
this.parentdest = parentdest;
this.metaprop = metaprop;
this.class = class extends DestinationTextBase implements IGenericPropertyDestination {
- parser: GlobalState;
+ private parser: GlobalState;
constructor(parser: GlobalState, inst: Document, name: string) {
super(name);
this.parser = parser;
}
- apply() {
+ public apply() {
const dest = findParentDestination(this.parser, parentdest);
if (dest == null) {
throw new RTFJSError("IDestination " + this._name + " must be within "
@@ -387,8 +388,8 @@ export class GenericPropertyDestinationFactory extends DestinationFactory {
- metaprop: string;
+ private metaprop: string;
constructor(metaprop: string) {
super();
this.metaprop = metaprop;
this.class = class extends DestinationTextBase implements IMetaPropertyDestination {
- parser: GlobalState;
+ private parser: GlobalState;
constructor(parser: GlobalState, inst: Document, name: string) {
super(name);
this.parser = parser;
}
- apply() {
+ public apply() {
const info = findParentDestination(this.parser, "info");
if (info == null) {
throw new RTFJSError("IDestination " + this._name + " must be within info destination");
@@ -441,19 +442,19 @@ export interface IMetaPropertyTimeDestination extends IDestination {
apply(): void;
}
export class MetaPropertyTimeDestinationFactory extends DestinationFactory {
- metaprop: string;
+ private metaprop: string;
constructor(metaprop: string) {
super();
this.metaprop = metaprop;
this.class = class extends DestinationBase implements IMetaPropertyTimeDestination {
- _yr: number;
- _mo: number;
- _dy: number;
- _hr: number;
- _min: number;
- _sec: number;
- parser: GlobalState;
+ private _yr: number;
+ private _mo: number;
+ private _dy: number;
+ private _hr: number;
+ private _min: number;
+ private _sec: number;
+ private parser: GlobalState;
constructor(parser: GlobalState, inst: Document, name: string) {
super(name);
@@ -466,7 +467,7 @@ export class MetaPropertyTimeDestinationFactory extends DestinationFactory {
- name: string;
- parentDest: string;
- propOrFunc: string;
+ private name: string;
+ private parentDest: string;
+ private propOrFunc: string;
constructor(name: string, parentDest: string, propOrFunc: string) {
super();
@@ -677,14 +678,14 @@ export class GenericSubTextPropertyDestinationFactory extends DestinationFactory
this.parentDest = parentDest;
this.propOrFunc = propOrFunc;
this.class = class extends DestinationTextBase implements IGenericSubTextPropertyDestination {
- parser: GlobalState;
+ private parser: GlobalState;
constructor(parser: GlobalState) {
super(name);
this.parser = parser;
}
- apply() {
+ public apply() {
const dest = findParentDestination(this.parser, parentDest);
if (dest == null) {
throw new RTFJSError(this._name + " destination must be child of " + parentDest + " destination");
@@ -713,10 +714,10 @@ export interface IColor {
}
export class ColortblDestination extends DestinationBase {
- _colors: IColor[];
- _current: IColor;
- _autoIndex: number;
- inst: Document;
+ private _colors: IColor[];
+ private _current: IColor;
+ private _autoIndex: number;
+ private inst: Document;
constructor(parser: GlobalState, inst: Document) {
super("colortbl");
@@ -726,19 +727,7 @@ export class ColortblDestination extends DestinationBase {
this.inst = inst;
}
- _startNewColor() {
- this._current = {
- r: 0,
- g: 0,
- b: 0,
- tint: 255,
- shade: 255,
- theme: null,
- };
- return this._current;
- }
-
- appendText(text: string) {
+ public appendText(text: string) {
const len = text.length;
for (let i = 0; i < len; i++) {
if (text[i] !== ";") {
@@ -760,17 +749,7 @@ export class ColortblDestination extends DestinationBase {
}
}
- _validateColorValueRange(keyword: string, param: number) {
- if (param == null) {
- throw new RTFJSError(keyword + " has no param");
- }
- if (param < 0 || param > 255) {
- throw new RTFJSError(keyword + " has invalid param value");
- }
- return param;
- }
-
- handleKeyword(keyword: string, param: number) {
+ public handleKeyword(keyword: string, param: number) {
if (this._current == null) {
this._startNewColor();
}
@@ -803,7 +782,7 @@ export class ColortblDestination extends DestinationBase {
return false;
}
- apply() {
+ public apply() {
Helper.log("[colortbl] apply()");
if (this._autoIndex == null) {
this._autoIndex = 0;
@@ -820,14 +799,36 @@ export class ColortblDestination extends DestinationBase {
this.inst._autoColor = this._autoIndex;
delete this._colors;
}
+
+ private _startNewColor() {
+ this._current = {
+ r: 0,
+ g: 0,
+ b: 0,
+ tint: 255,
+ shade: 255,
+ theme: null,
+ };
+ return this._current;
+ }
+
+ private _validateColorValueRange(keyword: string, param: number) {
+ if (param == null) {
+ throw new RTFJSError(keyword + " has no param");
+ }
+ if (param < 0 || param > 255) {
+ throw new RTFJSError(keyword + " has invalid param value");
+ }
+ return param;
+ }
}
export class StylesheetDestinationSub extends DestinationBase {
- _stylesheet: StylesheetDestination;
- index: number;
- name: string;
- handler: (keyword: string, param: number) => boolean;
- paragraph?: null;
+ private _stylesheet: StylesheetDestination;
+ private index: number;
+ private name: string;
+ private handler: (keyword: string, param: number) => boolean;
+ private paragraph?: null;
constructor(stylesheet: StylesheetDestination) {
super("stylesheet:sub");
@@ -837,14 +838,7 @@ export class StylesheetDestinationSub extends DestinationBase {
this.handler = this._handleKeywordCommon("paragraph");
}
- _handleKeywordCommon(member: string) {
- return (keyword: string, param: number) => {
- Helper.log("[stylesheet:sub]." + member + ": unhandled keyword: " + keyword + " param: " + param);
- return false;
- };
- }
-
- handleKeyword(keyword: string, param: number) {
+ public handleKeyword(keyword: string, param: number) {
switch (keyword) {
case "s":
this.index = param;
@@ -869,7 +863,7 @@ export class StylesheetDestinationSub extends DestinationBase {
return this.handler(keyword, param);
}
- appendText(text: string) {
+ public appendText(text: string) {
if (this.name == null) {
this.name = text;
} else {
@@ -877,18 +871,25 @@ export class StylesheetDestinationSub extends DestinationBase {
}
}
- apply() {
+ public apply() {
this._stylesheet.addSub({
index: this.index,
name: this.name,
});
delete this._stylesheet;
}
+
+ private _handleKeywordCommon(member: string) {
+ return (keyword: string, param: number) => {
+ Helper.log("[stylesheet:sub]." + member + ": unhandled keyword: " + keyword + " param: " + param);
+ return false;
+ };
+ }
}
export class StylesheetDestination extends DestinationBase {
- _stylesheets: Array<{index: number, name: string}>;
- inst: Document;
+ private _stylesheets: Array<{index: number, name: string}>;
+ private inst: Document;
constructor(parser: GlobalState, inst: Document) {
super("stylesheet");
@@ -896,11 +897,11 @@ export class StylesheetDestination extends DestinationBase {
this.inst = inst;
}
- sub() {
+ public sub() {
return new StylesheetDestinationSub(this);
}
- apply() {
+ public apply() {
Helper.log("[stylesheet] apply()");
for (const idx in this._stylesheets) {
Helper.log("[stylesheet] [" + idx + "] name: " + this._stylesheets[idx].name);
@@ -909,7 +910,7 @@ export class StylesheetDestination extends DestinationBase {
delete this._stylesheets;
}
- addSub(sub: {index: number, name: string}) {
+ public addSub(sub: {index: number, name: string}) {
// Some documents will redefine stylesheets
// if (this._stylesheets[sub.index] != null)
// throw new RTFJSError("Cannot redefine stylesheet with index " + sub.index);
@@ -923,9 +924,9 @@ export interface IField {
}
export class FieldDestination extends DestinationBase {
- _haveInst: boolean;
- _parsedInst: IField;
- _result: FldrsltDestination;
+ private _haveInst: boolean;
+ private _parsedInst: IField;
+ private _result: FldrsltDestination;
constructor() {
super("field");
@@ -934,7 +935,7 @@ export class FieldDestination extends DestinationBase {
this._result = null;
}
- apply() {
+ public apply() {
if (!this._haveInst) {
throw new RTFJSError("IField has no fldinst destination");
}
@@ -943,7 +944,7 @@ export class FieldDestination extends DestinationBase {
// throw new RTFJSError("IField has no fldrslt destination");
}
- setInst(inst: IField | Promise) {
+ public setInst(inst: IField | Promise) {
this._haveInst = true;
if (this._parsedInst != null) {
throw new RTFJSError("IField cannot have multiple fldinst destinations");
@@ -960,11 +961,11 @@ export class FieldDestination extends DestinationBase {
}
}
- getInst() {
+ public getInst() {
return this._parsedInst;
}
- setResult(inst: FldrsltDestination) {
+ public setResult(inst: FldrsltDestination) {
if (this._result != null) {
throw new RTFJSError("IField cannot have multiple fldrslt destinations");
}
@@ -973,13 +974,13 @@ export class FieldDestination extends DestinationBase {
}
export class FieldBase {
- _fldinst: FldinstDestination;
+ private _fldinst: FldinstDestination;
constructor(fldinst: FldinstDestination) {
this._fldinst = fldinst;
}
- renderFieldEnd(field: FieldDestination, rtf: RtfDestination, records: number) {
+ public renderFieldEnd(field: FieldDestination, rtf: RtfDestination, records: number) {
if (records > 0) {
rtf.addIns(function() {
this.popContainer();
@@ -989,8 +990,8 @@ export class FieldBase {
}
export class FieldHyperlink extends FieldBase {
- _url: string;
- inst: Document;
+ private _url: string;
+ private inst: Document;
constructor(inst: Document, fldinst: FldinstDestination, data: string) {
super(fldinst);
@@ -998,11 +999,11 @@ export class FieldHyperlink extends FieldBase {
this.inst = inst;
}
- url() {
+ public url() {
return this._url;
}
- renderFieldBegin(field: FieldDestination, rtf: RtfDestination, records: number) {
+ public renderFieldBegin(field: FieldDestination, rtf: RtfDestination, records: number) {
const self = this;
if (records > 0) {
rtf.addIns(function() {
@@ -1031,8 +1032,8 @@ export class FieldHyperlink extends FieldBase {
}
export class FldinstDestination extends DestinationTextBase {
- parser: GlobalState;
- inst: Document;
+ private parser: GlobalState;
+ private inst: Document;
constructor(parser: GlobalState, inst: Document) {
super("fldinst");
@@ -1040,7 +1041,7 @@ export class FldinstDestination extends DestinationTextBase {
this.inst = inst;
}
- apply() {
+ public apply() {
const field = findParentDestination(this.parser, "field") as FieldDestination;
if (field == null) {
throw new RTFJSError("fldinst destination must be child of field destination");
@@ -1048,7 +1049,7 @@ export class FldinstDestination extends DestinationTextBase {
field.setInst(this.parseType());
}
- parseType() {
+ private parseType() {
const sep = this.text.indexOf(" ");
if (sep > 0) {
let data = this.text.substr(sep + 1);
@@ -1143,7 +1144,7 @@ export class FldrsltDestination extends DestinationFormattedTextBase {
super(parser, "fldrslt");
}
- apply() {
+ public apply() {
const field = findParentDestination(this.parser, "field") as FieldDestination;
if (field != null) {
field.setResult(this);
@@ -1152,7 +1153,7 @@ export class FldrsltDestination extends DestinationFormattedTextBase {
super.apply();
}
- renderBegin(rtf: RtfDestination, records: number) {
+ public renderBegin(rtf: RtfDestination, records: number) {
const field = findParentDestination(this.parser, "field") as FieldDestination;
if (field != null) {
const inst = field.getInst();
@@ -1163,7 +1164,7 @@ export class FldrsltDestination extends DestinationFormattedTextBase {
return false;
}
- renderEnd(rtf: RtfDestination, records: number) {
+ public renderEnd(rtf: RtfDestination, records: number) {
const field = findParentDestination(this.parser, "field") as FieldDestination;
if (field != null) {
const inst = field.getInst();
@@ -1178,20 +1179,20 @@ export interface IPictGroupDestination extends IDestination {
isLegacy(): boolean;
}
export class PictGroupDestinationFactory extends DestinationFactory {
- legacy: boolean;
+ private legacy: boolean;
constructor(legacy: boolean) {
super();
this.legacy = legacy;
this.class = class extends DestinationTextBase implements IPictGroupDestination {
- _legacy: boolean;
+ private _legacy: boolean;
constructor() {
super("pict-group");
this._legacy = legacy;
}
- isLegacy() {
+ public isLegacy() {
return this._legacy;
}
};
@@ -1199,22 +1200,22 @@ export class PictGroupDestinationFactory extends DestinationFactory any);
- _blob: ArrayBuffer;
- _displaysize: {width: number, height: number};
- _size: {width: number, height: number};
- parser: GlobalState;
- inst: Document;
+ public _displaysize: {width: number, height: number};
+ public _size: {width: number, height: number};
+ private _type: string | (() => any);
+ private _blob: ArrayBuffer;
+ private parser: GlobalState;
+ private inst: Document;
[key: string]: any;
- _pictHandlers: {[key: string]: (param: number) => void} = {
+ private _pictHandlers: {[key: string]: (param: number) => void} = {
picw: this._setPropValueRequired("_size", "width"),
pich: this._setPropValueRequired("_size", "height"),
picwgoal: this._setPropValueRequired("_displaysize", "width"),
pichgoal: this._setPropValueRequired("_displaysize", "height"),
};
- _pictTypeHandler
+ private _pictTypeHandler
: {[key: string]: string | ((param?: number) => {load: () => any, render: (img: any) => JQuery})} = {
emfblip: (() => {
if (typeof EMFJS !== "undefined") {
@@ -1305,18 +1306,7 @@ export class PictDestination extends DestinationTextBase {
this.inst = inst;
}
- _setPropValueRequired(member: string, prop: string) {
- return (param: number) => {
- if (param == null) {
- throw new RTFJSError("Picture property has no value");
- }
- Helper.log("[pict] set " + member + "." + prop + " = " + param);
- const obj = (member != null ? this[member] : this);
- obj[prop] = param;
- };
- }
-
- handleKeyword(keyword: string, param: number) {
+ public handleKeyword(keyword: string, param: number) {
const handler = this._pictHandlers[keyword];
if (handler != null) {
handler(param);
@@ -1349,11 +1339,11 @@ export class PictDestination extends DestinationTextBase {
return false;
}
- handleBlob(blob: ArrayBuffer) {
+ public handleBlob(blob: ArrayBuffer) {
this._blob = blob;
}
- apply(rendering= false) {
+ public apply(rendering= false) {
if (this._type == null) {
throw new RTFJSError("Picture type unknown or not specified");
}
@@ -1468,13 +1458,24 @@ export class PictDestination extends DestinationTextBase {
delete this.text;
}
+
+ private _setPropValueRequired(member: string, prop: string) {
+ return (param: number) => {
+ if (param == null) {
+ throw new RTFJSError("Picture property has no value");
+ }
+ Helper.log("[pict] set " + member + "." + prop + " = " + param);
+ const obj = (member != null ? this[member] : this);
+ obj[prop] = param;
+ };
+ }
}
// tslint:disable-next-line:no-empty-interface
export interface IRequiredDestination extends IDestination {
}
export class RequiredDestinationFactory extends DestinationFactory {
- name: string;
+ private name: string;
constructor(name: string) {
super();
diff --git a/src/rtfjs/parser/RenderChp.ts b/src/rtfjs/parser/RenderChp.ts
index 160ba45..a191820 100644
--- a/src/rtfjs/parser/RenderChp.ts
+++ b/src/rtfjs/parser/RenderChp.ts
@@ -29,13 +29,13 @@ import { Helper } from "../Helper";
import { Chp } from "./Containers";
export class RenderChp {
- _chp: Chp;
+ public _chp: Chp;
constructor(chp: Chp) {
this._chp = chp;
}
- apply(doc: Document, el: JQuery) {
+ public apply(doc: Document, el: JQuery) {
if (this._chp.bold) {
el.css("font-weight", "bold");
}
diff --git a/src/rtfjs/parser/RenderPap.ts b/src/rtfjs/parser/RenderPap.ts
index 2516713..fa187ac 100644
--- a/src/rtfjs/parser/RenderPap.ts
+++ b/src/rtfjs/parser/RenderPap.ts
@@ -30,13 +30,13 @@ import { Pap } from "./Containers";
import { RenderChp } from "./RenderChp";
export class RenderPap {
- _pap: Pap;
+ private _pap: Pap;
constructor(pap: Pap) {
this._pap = pap;
}
- apply(doc: Document, el: JQuery, rchp: RenderChp, ismaindiv: boolean) {
+ public apply(doc: Document, el: JQuery, rchp: RenderChp, ismaindiv: boolean) {
if (ismaindiv) {
if (this._pap.spacebefore !== 0) {
el.css("margin-top", Helper._twipsToPt(this._pap.spacebefore) + "pt");
diff --git a/src/wmfjs/Bitmap.ts b/src/wmfjs/Bitmap.ts
index 5913ef3..104b468 100644
--- a/src/wmfjs/Bitmap.ts
+++ b/src/wmfjs/Bitmap.ts
@@ -28,20 +28,20 @@ import { Blob } from "./Blob";
import { Helper, WMFJSError } from "./Helper";
export class BitmapBase {
- getWidth() {
+ public getWidth() {
throw new WMFJSError("getWidth not implemented");
}
- getHeight() {
+ public getHeight() {
throw new WMFJSError("getHeight not implemented");
}
}
export class BitmapCoreHeader {
- width: number;
- height: number;
- planes: number;
- bitcount: number;
+ public width: number;
+ public height: number;
+ public planes: number;
+ public bitcount: number;
constructor(reader: Blob, skipsize: boolean) {
if (skipsize) {
@@ -53,22 +53,22 @@ export class BitmapCoreHeader {
this.bitcount = reader.readUint16();
}
- colors() {
+ public colors() {
return this.bitcount <= 8 ? 1 << this.bitcount : 0;
}
}
export class BitmapInfoHeader {
- width: number;
- height: number;
- planes: number;
- bitcount: number;
- compression: number;
- sizeimage: number;
- xpelspermeter: number;
- ypelspermeter: number;
- clrused: number;
- clrimportant: number;
+ public width: number;
+ public height: number;
+ public planes: number;
+ public bitcount: number;
+ public compression: number;
+ public sizeimage: number;
+ public xpelspermeter: number;
+ public ypelspermeter: number;
+ public clrused: number;
+ public clrimportant: number;
constructor(reader: Blob, skipsize: boolean) {
if (skipsize) {
@@ -86,7 +86,7 @@ export class BitmapInfoHeader {
this.clrimportant = reader.readUint32();
}
- colors() {
+ public colors() {
if (this.clrused !== 0) {
return this.clrused < 256 ? this.clrused : 256;
} else {
@@ -96,11 +96,11 @@ export class BitmapInfoHeader {
}
export class BitmapInfo extends BitmapBase {
- _reader: Blob;
- _offset: number;
- _usergb: boolean;
- _infosize: number;
- _header: BitmapCoreHeader | BitmapInfoHeader;
+ private _reader: Blob;
+ private _offset: number;
+ private _usergb: boolean;
+ private _infosize: number;
+ private _header: BitmapCoreHeader | BitmapInfoHeader;
constructor(reader: Blob, usergb: boolean) {
super();
@@ -123,28 +123,28 @@ export class BitmapInfo extends BitmapBase {
}
}
- getWidth() {
+ public getWidth() {
return this._header.width;
}
- getHeight() {
+ public getHeight() {
return Math.abs(this._header.height);
}
- infosize() {
+ public infosize() {
return this._infosize;
}
- header() {
+ public header() {
return this._header;
}
}
export class DIBitmap extends BitmapBase {
- _reader: Blob;
- _offset: number;
- _size: number;
- _info: BitmapInfo;
+ private _reader: Blob;
+ private _offset: number;
+ private _size: number;
+ private _info: BitmapInfo;
constructor(reader: Blob, size: number) {
super();
@@ -154,25 +154,15 @@ export class DIBitmap extends BitmapBase {
this._info = new BitmapInfo(reader, true);
}
- getWidth() {
+ public getWidth() {
return this._info.getWidth();
}
- getHeight() {
+ public getHeight() {
return this._info.getHeight();
}
- makeBitmapFileHeader() {
- const buf = new ArrayBuffer(14);
- const view = new Uint8Array(buf);
- view[0] = 0x42;
- view[1] = 0x4d;
- Helper._writeUint32Val(view, 2, this._size + 14);
- Helper._writeUint32Val(view, 10, this._info.infosize() + 14);
- return Helper._blobToBinary(view);
- }
-
- base64ref() {
+ public base64ref() {
const prevpos = this._reader.pos;
this._reader.seek(this._offset);
let mime = "image/bmp";
@@ -204,20 +194,31 @@ export class DIBitmap extends BitmapBase {
this._reader.seek(prevpos);
return ref;
}
+
+ private makeBitmapFileHeader() {
+ const buf = new ArrayBuffer(14);
+ const view = new Uint8Array(buf);
+ view[0] = 0x42;
+ view[1] = 0x4d;
+ Helper._writeUint32Val(view, 2, this._size + 14);
+ Helper._writeUint32Val(view, 10, this._info.infosize() + 14);
+ return Helper._blobToBinary(view);
+ }
}
export class Bitmap16 extends BitmapBase {
- _reader: Blob;
- _offset: number;
- _size: number;
- type: number;
- width: number;
- height: number;
- widthBytes: number;
- planes: number;
- bitsPixel: number;
- bitsOffset: number;
- bitsSize: number;
+ public type: number;
+ public width: number;
+ public height: number;
+ public widthBytes: number;
+ public planes: number;
+ public bitsPixel: number;
+ public bitsOffset: number;
+ public bitsSize: number;
+ private _reader: Blob;
+ private _offset: number;
+ private _size: number;
+
constructor(reader: Blob, size: number | Bitmap16) {
super();
if (reader != null) {
@@ -252,15 +253,15 @@ export class Bitmap16 extends BitmapBase {
}
}
- getWidth() {
+ public getWidth() {
return this.width;
}
- getHeight() {
+ public getHeight() {
return this.height;
}
- clone() {
+ public clone() {
return new Bitmap16(null, this);
}
}
@@ -273,7 +274,7 @@ export class PatternBitmap16 extends Bitmap16 {
}
}
- clone(): PatternBitmap16 {
+ public clone(): PatternBitmap16 {
return new PatternBitmap16(null, this);
}
}
diff --git a/src/wmfjs/Blob.ts b/src/wmfjs/Blob.ts
index 16d59cd..9c76713 100644
--- a/src/wmfjs/Blob.ts
+++ b/src/wmfjs/Blob.ts
@@ -27,9 +27,9 @@ SOFTWARE.
import { WMFJSError } from "./Helper";
export class Blob {
- blob: Blob | ArrayBuffer;
- data: Uint8Array;
- pos: number;
+ public pos: number;
+ private blob: Blob | ArrayBuffer;
+ private data: Uint8Array;
constructor(blob: Blob | ArrayBuffer, offset?: number) {
if (blob instanceof Blob) {
@@ -43,18 +43,18 @@ export class Blob {
}
}
- eof() {
+ public eof() {
return this.pos >= this.data.length;
}
- seek(newpos: number) {
+ public seek(newpos: number) {
if (newpos < 0 || newpos > this.data.length) {
throw new WMFJSError("Invalid seek position");
}
this.pos = newpos;
}
- skip(cnt: number) {
+ public skip(cnt: number) {
const newPos = this.pos + cnt;
if (newPos > this.data.length) {
throw new WMFJSError("Unexpected end of file");
@@ -62,7 +62,7 @@ export class Blob {
this.pos = newPos;
}
- readBinary(cnt: number) {
+ public readBinary(cnt: number) {
const end = this.pos + cnt;
if (end > this.data.length) {
throw new WMFJSError("Unexpected end of file");
@@ -74,18 +74,18 @@ export class Blob {
return ret;
}
- readInt8() {
+ public readInt8() {
if (this.pos + 1 > this.data.length) {
throw new WMFJSError("Unexpected end of file");
}
return this.data[this.pos++];
}
- readUint8() {
+ public readUint8() {
return this.readInt8() >>> 0;
}
- readInt32() {
+ public readInt32() {
if (this.pos + 4 > this.data.length) {
throw new WMFJSError("Unexpected end of file");
}
@@ -96,11 +96,11 @@ export class Blob {
return val;
}
- readUint32() {
+ public readUint32() {
return this.readInt32() >>> 0;
}
- readUint16() {
+ public readUint16() {
if (this.pos + 2 > this.data.length) {
throw new WMFJSError("Unexpected end of file");
}
@@ -109,7 +109,7 @@ export class Blob {
return val;
}
- readInt16() {
+ public readInt16() {
let val = this.readUint16();
if (val > 32767) {
val -= 65536;
@@ -117,7 +117,7 @@ export class Blob {
return val;
}
- readString(length: number) {
+ public readString(length: number) {
if (this.pos + length > this.data.length) {
throw new WMFJSError("Unexpected end of file");
}
@@ -128,7 +128,7 @@ export class Blob {
return ret;
}
- readNullTermString(maxSize: number) {
+ public readNullTermString(maxSize: number) {
let ret = "";
if (maxSize > 0) {
maxSize--;
diff --git a/src/wmfjs/GDIContext.ts b/src/wmfjs/GDIContext.ts
index b07754e..338cb0f 100644
--- a/src/wmfjs/GDIContext.ts
+++ b/src/wmfjs/GDIContext.ts
@@ -41,29 +41,29 @@ export interface ISelectedStyle {
}
export class GDIContextState {
- _svggroup: any;
- _svgclipChanged: boolean;
- _svgtextbkfilter: any;
- mapmode: number;
- stretchmode: number;
- textalign: number;
- bkmode: number;
- textcolor: ColorRef;
- bkcolor: ColorRef;
- polyfillmode: number;
- wx: number;
- wy: number;
- ww: number;
- wh: number;
- vx: number;
- vy: number;
- vw: number;
- vh: number;
- x: number;
- y: number;
- clip: Region;
- ownclip: boolean;
- selected: ISelectedStyle;
+ public _svggroup: any;
+ public _svgclipChanged: boolean;
+ public _svgtextbkfilter: any;
+ public mapmode: number;
+ public stretchmode: number;
+ public textalign: number;
+ public bkmode: number;
+ public textcolor: ColorRef;
+ public bkcolor: ColorRef;
+ public polyfillmode: number;
+ public wx: number;
+ public wy: number;
+ public ww: number;
+ public wh: number;
+ public vx: number;
+ public vy: number;
+ public vw: number;
+ public vh: number;
+ public x: number;
+ public y: number;
+ public clip: Region;
+ public ownclip: boolean;
+ public selected: ISelectedStyle;
constructor(copy: GDIContextState, defObjects?: ISelectedStyle) {
if (copy != null) {
@@ -130,14 +130,14 @@ export class GDIContextState {
}
export class GDIContext {
- _svg: any;
- _svgdefs: any;
- _svgPatterns: {[key: string]: Brush};
- _svgClipPaths: {[key: string]: Region};
- defObjects: ISelectedStyle;
- state: GDIContextState;
- statestack: GDIContextState[];
- objects: {[key: string]: Obj};
+ private _svg: any;
+ private _svgdefs: any;
+ private _svgPatterns: {[key: string]: Brush};
+ private _svgClipPaths: {[key: string]: Region};
+ private defObjects: ISelectedStyle;
+ private state: GDIContextState;
+ private statestack: GDIContextState[];
+ private objects: {[key: string]: Obj};
constructor(svg: any) {
this._svg = svg;
@@ -158,7 +158,372 @@ export class GDIContext {
this.objects = {};
}
- _pushGroup() {
+ public setMapMode(mode: number) {
+ Helper.log("[gdi] setMapMode: mode=" + mode);
+ this.state.mapmode = mode;
+ this.state._svggroup = null;
+ }
+
+ public setWindowOrg(x: number, y: number) {
+ Helper.log("[gdi] setWindowOrg: x=" + x + " y=" + y);
+ this.state.wx = x;
+ this.state.wy = y;
+ this.state._svggroup = null;
+ }
+
+ public setWindowExt(x: number, y: number) {
+ Helper.log("[gdi] setWindowExt: x=" + x + " y=" + y);
+ this.state.ww = x;
+ this.state.wh = y;
+ this.state._svggroup = null;
+ }
+
+ public offsetWindowOrg(offX: number, offY: number) {
+ Helper.log("[gdi] offsetWindowOrg: offX=" + offX + " offY=" + offY);
+ this.state.wx += offX;
+ this.state.wy += offY;
+ this.state._svggroup = null;
+ }
+
+ public setViewportOrg(x: number, y: number) {
+ Helper.log("[gdi] setViewportOrg: x=" + x + " y=" + y);
+ this.state.vx = x;
+ this.state.vy = y;
+ this.state._svggroup = null;
+ }
+
+ public setViewportExt(x: number, y: number) {
+ Helper.log("[gdi] setViewportExt: x=" + x + " y=" + y);
+ this.state.vw = x;
+ this.state.vh = y;
+ this.state._svggroup = null;
+ }
+
+ public offsetViewportOrg(offX: number, offY: number) {
+ Helper.log("[gdi] offsetViewportOrg: offX=" + offX + " offY=" + offY);
+ this.state.vx += offX;
+ this.state.vy += offY;
+ this.state._svggroup = null;
+ }
+
+ public saveDC() {
+ Helper.log("[gdi] saveDC");
+ const prevstate = this.state;
+ this.state = new GDIContextState(this.state);
+ this.statestack.push(prevstate);
+ this.state._svggroup = null;
+ }
+
+ public restoreDC(saved: number) {
+ Helper.log("[gdi] restoreDC: saved=" + saved);
+ if (this.statestack.length > 1) {
+ if (saved === -1) {
+ this.state = this.statestack.pop();
+ } else if (saved < -1) {
+ throw new WMFJSError("restoreDC: relative restore not implemented");
+ } else if (saved > 1) {
+ throw new WMFJSError("restoreDC: absolute restore not implemented");
+ }
+ } else {
+ throw new WMFJSError("No saved contexts");
+ }
+
+ this.state._svggroup = null;
+ }
+
+ public escape(func: number, blob: Blob, offset: number, count: number) {
+ Helper.log("[gdi] escape: func=" + func + " offset=" + offset + " count=" + count);
+ }
+
+ public setStretchBltMode(stretchMode: number) {
+ Helper.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
+ }
+
+ public stretchDib(srcX: number, srcY: number, srcW: number, srcH: number,
+ dstX: number, dstY: number, dstW: number, dstH: number,
+ rasterOp: number, colorUsage: number, dib: DIBitmap) {
+ Helper.log("[gdi] stretchDib: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
+ + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
+ + " rasterOp=0x" + rasterOp.toString(16));
+ srcX = this._todevX(srcX);
+ srcY = this._todevY(srcY);
+ srcW = this._todevW(srcW);
+ srcH = this._todevH(srcH);
+ dstX = this._todevX(dstX);
+ dstY = this._todevY(dstY);
+ dstW = this._todevW(dstW);
+ dstH = this._todevH(dstH);
+ Helper.log("[gdi] stretchDib: TRANSLATED: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
+ + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
+ + " rasterOp=0x" + rasterOp.toString(16) + " colorUsage=0x" + colorUsage.toString(16));
+ this._pushGroup();
+ this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
+ }
+
+ public stretchDibBits(srcX: number, srcY: number, srcW: number, srcH: number,
+ dstX: number, dstY: number, dstW: number, dstH: number,
+ rasterOp: number, dib: DIBitmap) {
+ Helper.log("[gdi] stretchDibBits: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
+ + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
+ + " rasterOp=0x" + rasterOp.toString(16));
+ srcX = this._todevX(srcX);
+ srcY = this._todevY(srcY);
+ srcW = this._todevW(srcW);
+ srcH = this._todevH(srcH);
+ dstX = this._todevX(dstX);
+ dstY = this._todevY(dstY);
+ dstW = this._todevW(dstW);
+ dstH = this._todevH(dstH);
+ Helper.log("[gdi] stretchDibBits: TRANSLATED:"
+ + " srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
+ + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
+ + " rasterOp=0x" + rasterOp.toString(16));
+ this._pushGroup();
+ this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
+ }
+
+ public rectangle(rect: Rect, rw: number, rh: number) {
+ Helper.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+ const bottom = this._todevY(rect.bottom);
+ const right = this._todevX(rect.right);
+ const top = this._todevY(rect.top);
+ const left = this._todevX(rect.left);
+ rw = this._todevH(rw);
+ rh = this._todevH(rh);
+ Helper.log("[gdi] rectangle: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top
+ + " left=" + left + " rh=" + rh + " rw=" + rw);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, true, true, false);
+ this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);
+ }
+
+ public textOut(x: number, y: number, text: string) {
+ Helper.log("[gdi] textOut: x=" + x + " y=" + y + " text=" + text
+ + " with font " + this.state.selected.font.toString());
+ x = this._todevX(x);
+ y = this._todevY(y);
+ Helper.log("[gdi] textOut: TRANSLATED: x=" + x + " y=" + y);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, false, false, true);
+ if (this.state.selected.font.escapement !== 0) {
+ opts.transform = "rotate(" + [(-this.state.selected.font.escapement / 10), x, y] + ")";
+ opts.style = "dominant-baseline: middle; text-anchor: start;";
+ }
+ if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {
+ if (this.state._svgtextbkfilter == null) {
+ const filterId = Helper._makeUniqueId("f");
+ const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);
+ this._svg.filters.flood(filter, null, "#" + this.state.bkcolor.toHex(), 1.0);
+ this._svg.filters.composite(filter, null, null, "SourceGraphic");
+ this.state._svgtextbkfilter = filter;
+ }
+
+ opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
+ }
+ this._svg.text(this.state._svggroup, x, y, text, opts);
+ }
+
+ public extTextOut(x: number, y: number, text: string, fwOpts: number, rect: Rect, dx: number[]) {
+ Helper.log("[gdi] extTextOut: x=" + x + " y=" + y + " text=" + text
+ + " with font " + this.state.selected.font.toString());
+ x = this._todevX(x);
+ y = this._todevY(y);
+ Helper.log("[gdi] extTextOut: TRANSLATED: x=" + x + " y=" + y);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, false, false, true);
+ if (this.state.selected.font.escapement !== 0) {
+ opts.transform = "rotate(" + [(-this.state.selected.font.escapement / 10), x, y] + ")";
+ opts.style = "dominant-baseline: middle; text-anchor: start;";
+ }
+ if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {
+ if (this.state._svgtextbkfilter == null) {
+ const filterId = Helper._makeUniqueId("f");
+ const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);
+ this._svg.filters.flood(filter, null, "#" + this.state.bkcolor.toHex(), 1.0);
+ this._svg.filters.composite(filter, null, null, "SourceGraphic");
+ this.state._svgtextbkfilter = filter;
+ }
+
+ opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
+ }
+ this._svg.text(this.state._svggroup, x, y, text, opts);
+ }
+
+ public lineTo(x: number, y: number) {
+ Helper.log("[gdi] lineTo: x=" + x + " y=" + y + " with pen " + this.state.selected.pen.toString());
+ const toX = this._todevX(x);
+ const toY = this._todevY(y);
+ const fromX = this._todevX(this.state.x);
+ const fromY = this._todevY(this.state.y);
+
+ // Update position
+ this.state.x = x;
+ this.state.y = y;
+
+ Helper.log("[gdi] lineTo: TRANSLATED: toX=" + toX + " toY=" + toY + " fromX=" + fromX + " fromY=" + fromY);
+ this._pushGroup();
+
+ const opts = this._applyOpts(null, true, false, false);
+ this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);
+ }
+
+ public moveTo(x: number, y: number) {
+ Helper.log("[gdi] moveTo: x=" + x + " y=" + y);
+ this.state.x = x;
+ this.state.y = y;
+ }
+
+ public polygon(points: PointS[], first: boolean) {
+ Helper.log("[gdi] polygon: points=" + points + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+ const pts = [];
+ for (let i = 0; i < points.length; i++) {
+ const point = points[i];
+ pts.push([this._todevX(point.x), this._todevY(point.y)]);
+ }
+ Helper.log("[gdi] polygon: TRANSLATED: pts=" + pts);
+ if (first) {
+ this._pushGroup();
+ }
+ const opts = {
+ "fill-rule": this.state.polyfillmode === Helper.GDI.PolyFillMode.ALTERNATE ? "evenodd" : "nonzero",
+ };
+ this._applyOpts(opts, true, true, false);
+ this._svg.polygon(this.state._svggroup, pts, opts);
+ }
+
+ public polyPolygon(polygons: PointS[][]) {
+ Helper.log("[gdi] polyPolygon: polygons.length=" + polygons.length
+ + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+
+ const cnt = polygons.length;
+ for (let i = 0; i < cnt; i++) {
+ this.polygon(polygons[i], i === 0);
+ }
+ }
+
+ public polyline(points: PointS[]) {
+ Helper.log("[gdi] polyline: points=" + points + " with pen " + this.state.selected.pen.toString());
+ const pts = [];
+ for (let i = 0; i < points.length; i++) {
+ const point = points[i];
+ pts.push([this._todevX(point.x), this._todevY(point.y)]);
+ }
+ Helper.log("[gdi] polyline: TRANSLATED: pts=" + pts);
+ this._pushGroup();
+ const opts = this._applyOpts({fill: "none"}, true, false, false);
+ this._svg.polyline(this.state._svggroup, pts, opts);
+ }
+
+ public ellipse(rect: Rect) {
+ Helper.log("[gdi] ellipse: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
+ + " and brush " + this.state.selected.brush.toString());
+ const bottom = this._todevY(rect.bottom);
+ const right = this._todevX(rect.right);
+ const top = this._todevY(rect.top);
+ const left = this._todevX(rect.left);
+ Helper.log("[gdi] ellipse: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top + " left=" + left);
+ this._pushGroup();
+ const width2 = (right - left) / 2;
+ const height2 = (bottom - top) / 2;
+ const opts = this._applyOpts(null, true, true, false);
+ this._svg.ellipse(this.state._svggroup, left + width2, top + height2, width2, height2, opts);
+ }
+
+ public excludeClipRect(rect: Rect) {
+ Helper.log("[gdi] excludeClipRect: rect=" + rect.toString());
+ this._getClipRgn().subtract(rect);
+ }
+
+ public intersectClipRect(rect: Rect) {
+ Helper.log("[gdi] intersectClipRect: rect=" + rect.toString());
+ this._getClipRgn().intersect(rect);
+ }
+
+ public offsetClipRgn(offX: number, offY: number) {
+ Helper.log("[gdi] offsetClipRgn: offX=" + offX + " offY=" + offY);
+ this._getClipRgn().offset(offX, offY);
+ }
+
+ public setTextAlign(textAlignmentMode: number) {
+ Helper.log("[gdi] setTextAlign: textAlignmentMode=0x" + textAlignmentMode.toString(16));
+ this.state.textalign = textAlignmentMode;
+ }
+
+ public setBkMode(bkMode: number) {
+ Helper.log("[gdi] setBkMode: bkMode=0x" + bkMode.toString(16));
+ this.state.bkmode = bkMode;
+ }
+
+ public setTextColor(textColor: ColorRef) {
+ Helper.log("[gdi] setTextColor: textColor=" + textColor.toString());
+ this.state.textcolor = textColor;
+ }
+
+ public setBkColor(bkColor: ColorRef) {
+ Helper.log("[gdi] setBkColor: bkColor=" + bkColor.toString());
+ this.state.bkcolor = bkColor;
+ this.state._svgtextbkfilter = null;
+ }
+
+ public setPolyFillMode(polyFillMode: number) {
+ Helper.log("[gdi] setPolyFillMode: polyFillMode=" + polyFillMode);
+ this.state.polyfillmode = polyFillMode;
+ }
+
+ public createBrush(brush: Brush) {
+ const idx = this._storeObject(brush);
+ Helper.log("[gdi] createBrush: brush=" + brush.toString() + " with handle " + idx);
+ }
+
+ public createFont(font: Font) {
+ const idx = this._storeObject(font);
+ Helper.log("[gdi] createFont: font=" + font.toString() + " with handle " + idx);
+ }
+
+ public createPen(pen: Pen) {
+ const idx = this._storeObject(pen);
+ Helper.log("[gdi] createPen: pen=" + pen.toString() + " width handle " + idx);
+ }
+
+ public createPalette(palette: Palette) {
+ const idx = this._storeObject(palette);
+ Helper.log("[gdi] createPalette: palette=" + palette.toString() + " width handle " + idx);
+ }
+
+ public createRegion(region: Region) {
+ const idx = this._storeObject(region);
+ Helper.log("[gdi] createRegion: region=" + region.toString() + " width handle " + idx);
+ }
+
+ public createPatternBrush(patternBrush: Brush) {
+ const idx = this._storeObject(patternBrush);
+ Helper.log("[gdi] createRegion: region=" + patternBrush.toString() + " width handle " + idx);
+ }
+
+ public selectObject(objIdx: number, checkType: string) {
+ const obj = this._getObject(objIdx);
+ if (obj != null && (checkType == null || obj.type === checkType)) {
+ this._selectObject(obj);
+ Helper.log("[gdi] selectObject: objIdx=" + objIdx
+ + (obj ? " selected " + obj.type + ": " + obj.toString() : "[invalid index]"));
+ } else {
+ Helper.log("[gdi] selectObject: objIdx=" + objIdx
+ + (obj ? " invalid object type: " + obj.type : "[invalid index]"));
+ }
+ }
+
+ public deleteObject(objIdx: number) {
+ const ret = this._deleteObject(objIdx);
+ Helper.log("[gdi] deleteObject: objIdx=" + objIdx + (ret ? " deleted object" : "[invalid index]"));
+ }
+
+ private _pushGroup() {
if (this.state._svggroup == null || this.state._svgclipChanged) {
this.state._svgclipChanged = false;
this.state._svgtextbkfilter = null;
@@ -180,7 +545,7 @@ export class GDIContext {
}
}
- _storeObject(obj: Obj) {
+ private _storeObject(obj: Obj) {
let i = 0;
while (this.objects[i.toString()] != null && i <= 65535) {
i++;
@@ -194,7 +559,7 @@ export class GDIContext {
return i;
}
- _getObject(objIdx: number) {
+ private _getObject(objIdx: number) {
const obj = this.objects[objIdx.toString()];
if (obj == null) {
Helper.log("[gdi] No object with handle " + objIdx);
@@ -202,14 +567,14 @@ export class GDIContext {
return obj;
}
- _getSvgDef() {
+ private _getSvgDef() {
if (this._svgdefs == null) {
this._svgdefs = this._svg.defs();
}
return this._svgdefs;
}
- _getSvgClipPathForRegion(region: Region) {
+ private _getSvgClipPathForRegion(region: Region) {
for (const existingId in this._svgClipPaths) {
const rgn = this._svgClipPaths[existingId];
if (rgn === region) {
@@ -242,7 +607,7 @@ export class GDIContext {
return id;
}
- _getSvgPatternForBrush(brush: Brush) {
+ private _getSvgPatternForBrush(brush: Brush) {
for (const existingId in this._svgPatterns) {
const pat = this._svgPatterns[existingId];
if (pat === brush) {
@@ -274,14 +639,14 @@ export class GDIContext {
return id;
}
- _selectObject(obj: Obj) {
+ private _selectObject(obj: Obj) {
this.state.selected[obj.type] = obj;
if (obj.type === "region") {
this.state._svgclipChanged = true;
}
}
- _deleteObject(objIdx: number) {
+ private _deleteObject(objIdx: number) {
const obj = this.objects[objIdx.toString()];
if (obj != null) {
for (let i = 0; i < this.statestack.length; i++) {
@@ -298,7 +663,7 @@ export class GDIContext {
return false;
}
- _getClipRgn() {
+ private _getClipRgn() {
if (this.state.clip != null) {
if (!this.state.ownclip) {
this.state.clip = this.state.clip.clone();
@@ -315,179 +680,55 @@ export class GDIContext {
return this.state.clip;
}
- _todevX(val: number) {
+ private _todevX(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.wx) * (this.state.vw / this.state.ww)) + this.state.vx;
}
- _todevY(val: number) {
+ private _todevY(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.wy) * (this.state.vh / this.state.wh)) + this.state.vy;
}
- _todevW(val: number) {
+ private _todevW(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val * (this.state.vw / this.state.ww)) + this.state.vx;
}
- _todevH(val: number) {
+ private _todevH(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val * (this.state.vh / this.state.wh)) + this.state.vy;
}
- _tologicalX(val: number) {
+ private _tologicalX(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.vx) / (this.state.vw / this.state.ww)) + this.state.wx;
}
- _tologicalY(val: number) {
+ private _tologicalY(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor((val - this.state.vy) / (this.state.vh / this.state.wh)) + this.state.wy;
}
- _tologicalW(val: number) {
+ private _tologicalW(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val / (this.state.vw / this.state.ww)) + this.state.wx;
}
- _tologicalH(val: number) {
+ private _tologicalH(val: number) {
// http://wvware.sourceforge.net/caolan/mapmode.html
// logical -> device
return Math.floor(val / (this.state.vh / this.state.wh)) + this.state.wy;
}
- setMapMode(mode: number) {
- Helper.log("[gdi] setMapMode: mode=" + mode);
- this.state.mapmode = mode;
- this.state._svggroup = null;
- }
-
- setWindowOrg(x: number, y: number) {
- Helper.log("[gdi] setWindowOrg: x=" + x + " y=" + y);
- this.state.wx = x;
- this.state.wy = y;
- this.state._svggroup = null;
- }
-
- setWindowExt(x: number, y: number) {
- Helper.log("[gdi] setWindowExt: x=" + x + " y=" + y);
- this.state.ww = x;
- this.state.wh = y;
- this.state._svggroup = null;
- }
-
- offsetWindowOrg(offX: number, offY: number) {
- Helper.log("[gdi] offsetWindowOrg: offX=" + offX + " offY=" + offY);
- this.state.wx += offX;
- this.state.wy += offY;
- this.state._svggroup = null;
- }
-
- setViewportOrg(x: number, y: number) {
- Helper.log("[gdi] setViewportOrg: x=" + x + " y=" + y);
- this.state.vx = x;
- this.state.vy = y;
- this.state._svggroup = null;
- }
-
- setViewportExt(x: number, y: number) {
- Helper.log("[gdi] setViewportExt: x=" + x + " y=" + y);
- this.state.vw = x;
- this.state.vh = y;
- this.state._svggroup = null;
- }
-
- offsetViewportOrg(offX: number, offY: number) {
- Helper.log("[gdi] offsetViewportOrg: offX=" + offX + " offY=" + offY);
- this.state.vx += offX;
- this.state.vy += offY;
- this.state._svggroup = null;
- }
-
- saveDC() {
- Helper.log("[gdi] saveDC");
- const prevstate = this.state;
- this.state = new GDIContextState(this.state);
- this.statestack.push(prevstate);
- this.state._svggroup = null;
- }
-
- restoreDC(saved: number) {
- Helper.log("[gdi] restoreDC: saved=" + saved);
- if (this.statestack.length > 1) {
- if (saved === -1) {
- this.state = this.statestack.pop();
- } else if (saved < -1) {
- throw new WMFJSError("restoreDC: relative restore not implemented");
- } else if (saved > 1) {
- throw new WMFJSError("restoreDC: absolute restore not implemented");
- }
- } else {
- throw new WMFJSError("No saved contexts");
- }
-
- this.state._svggroup = null;
- }
-
- escape(func: number, blob: Blob, offset: number, count: number) {
- Helper.log("[gdi] escape: func=" + func + " offset=" + offset + " count=" + count);
- }
-
- setStretchBltMode(stretchMode: number) {
- Helper.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
- }
-
- stretchDib(srcX: number, srcY: number, srcW: number, srcH: number,
- dstX: number, dstY: number, dstW: number, dstH: number,
- rasterOp: number, colorUsage: number, dib: DIBitmap) {
- Helper.log("[gdi] stretchDib: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
- + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
- + " rasterOp=0x" + rasterOp.toString(16));
- srcX = this._todevX(srcX);
- srcY = this._todevY(srcY);
- srcW = this._todevW(srcW);
- srcH = this._todevH(srcH);
- dstX = this._todevX(dstX);
- dstY = this._todevY(dstY);
- dstW = this._todevW(dstW);
- dstH = this._todevH(dstH);
- Helper.log("[gdi] stretchDib: TRANSLATED: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
- + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
- + " rasterOp=0x" + rasterOp.toString(16) + " colorUsage=0x" + colorUsage.toString(16));
- this._pushGroup();
- this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
- }
-
- stretchDibBits(srcX: number, srcY: number, srcW: number, srcH: number,
- dstX: number, dstY: number, dstW: number, dstH: number,
- rasterOp: number, dib: DIBitmap) {
- Helper.log("[gdi] stretchDibBits: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
- + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
- + " rasterOp=0x" + rasterOp.toString(16));
- srcX = this._todevX(srcX);
- srcY = this._todevY(srcY);
- srcW = this._todevW(srcW);
- srcH = this._todevH(srcH);
- dstX = this._todevX(dstX);
- dstY = this._todevY(dstY);
- dstW = this._todevW(dstW);
- dstH = this._todevH(dstH);
- Helper.log("[gdi] stretchDibBits: TRANSLATED:"
- + " srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH
- + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH
- + " rasterOp=0x" + rasterOp.toString(16));
- this._pushGroup();
- this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
- }
-
- _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {
+ private _applyOpts(opts: any, usePen: boolean, useBrush: boolean, useFont: boolean) {
if (opts == null) {
opts = {};
}
@@ -513,9 +754,9 @@ export class GDIContext {
opts["stroke-linejoin"] = "bevel";
} else if ((pen.join & Helper.GDI.PenStyle.PS_JOIN_MITER) !== 0) {
opts["stroke-linejoin"] = "miter";
- } else {
+ } else {
opts["stroke-linejoin"] = "round";
- }
+ }
const dashWidth = opts.strokeWidth * 4;
const dotSpacing = opts.strokeWidth * 2;
@@ -563,245 +804,4 @@ export class GDIContext {
}
return opts;
}
-
- rectangle(rect: Rect, rw: number, rh: number) {
- Helper.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
- const bottom = this._todevY(rect.bottom);
- const right = this._todevX(rect.right);
- const top = this._todevY(rect.top);
- const left = this._todevX(rect.left);
- rw = this._todevH(rw);
- rh = this._todevH(rh);
- Helper.log("[gdi] rectangle: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top
- + " left=" + left + " rh=" + rh + " rw=" + rw);
- this._pushGroup();
-
- const opts = this._applyOpts(null, true, true, false);
- this._svg.rect(this.state._svggroup, left, top, right - left, bottom - top, rw / 2, rh / 2, opts);
- }
-
- textOut(x: number, y: number, text: string) {
- Helper.log("[gdi] textOut: x=" + x + " y=" + y + " text=" + text
- + " with font " + this.state.selected.font.toString());
- x = this._todevX(x);
- y = this._todevY(y);
- Helper.log("[gdi] textOut: TRANSLATED: x=" + x + " y=" + y);
- this._pushGroup();
-
- const opts = this._applyOpts(null, false, false, true);
- if (this.state.selected.font.escapement !== 0) {
- opts.transform = "rotate(" + [(-this.state.selected.font.escapement / 10), x, y] + ")";
- opts.style = "dominant-baseline: middle; text-anchor: start;";
- }
- if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {
- if (this.state._svgtextbkfilter == null) {
- const filterId = Helper._makeUniqueId("f");
- const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);
- this._svg.filters.flood(filter, null, "#" + this.state.bkcolor.toHex(), 1.0);
- this._svg.filters.composite(filter, null, null, "SourceGraphic");
- this.state._svgtextbkfilter = filter;
- }
-
- opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
- }
- this._svg.text(this.state._svggroup, x, y, text, opts);
- }
-
- extTextOut(x: number, y: number, text: string, fwOpts: number, rect: Rect, dx: number[]) {
- Helper.log("[gdi] extTextOut: x=" + x + " y=" + y + " text=" + text
- + " with font " + this.state.selected.font.toString());
- x = this._todevX(x);
- y = this._todevY(y);
- Helper.log("[gdi] extTextOut: TRANSLATED: x=" + x + " y=" + y);
- this._pushGroup();
-
- const opts = this._applyOpts(null, false, false, true);
- if (this.state.selected.font.escapement !== 0) {
- opts.transform = "rotate(" + [(-this.state.selected.font.escapement / 10), x, y] + ")";
- opts.style = "dominant-baseline: middle; text-anchor: start;";
- }
- if (this.state.bkmode === Helper.GDI.MixMode.OPAQUE) {
- if (this.state._svgtextbkfilter == null) {
- const filterId = Helper._makeUniqueId("f");
- const filter = this._svg.filter(this._getSvgDef(), filterId, 0, 0, 1, 1);
- this._svg.filters.flood(filter, null, "#" + this.state.bkcolor.toHex(), 1.0);
- this._svg.filters.composite(filter, null, null, "SourceGraphic");
- this.state._svgtextbkfilter = filter;
- }
-
- opts.filter = "url(#" + $(this.state._svgtextbkfilter).attr("id") + ")";
- }
- this._svg.text(this.state._svggroup, x, y, text, opts);
- }
-
- lineTo(x: number, y: number) {
- Helper.log("[gdi] lineTo: x=" + x + " y=" + y + " with pen " + this.state.selected.pen.toString());
- const toX = this._todevX(x);
- const toY = this._todevY(y);
- const fromX = this._todevX(this.state.x);
- const fromY = this._todevY(this.state.y);
-
- // Update position
- this.state.x = x;
- this.state.y = y;
-
- Helper.log("[gdi] lineTo: TRANSLATED: toX=" + toX + " toY=" + toY + " fromX=" + fromX + " fromY=" + fromY);
- this._pushGroup();
-
- const opts = this._applyOpts(null, true, false, false);
- this._svg.line(this.state._svggroup, fromX, fromY, toX, toY, opts);
- }
-
- moveTo(x: number, y: number) {
- Helper.log("[gdi] moveTo: x=" + x + " y=" + y);
- this.state.x = x;
- this.state.y = y;
- }
-
- polygon(points: PointS[], first: boolean) {
- Helper.log("[gdi] polygon: points=" + points + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
- const pts = [];
- for (let i = 0; i < points.length; i++) {
- const point = points[i];
- pts.push([this._todevX(point.x), this._todevY(point.y)]);
- }
- Helper.log("[gdi] polygon: TRANSLATED: pts=" + pts);
- if (first) {
- this._pushGroup();
- }
- const opts = {
- "fill-rule": this.state.polyfillmode === Helper.GDI.PolyFillMode.ALTERNATE ? "evenodd" : "nonzero",
- };
- this._applyOpts(opts, true, true, false);
- this._svg.polygon(this.state._svggroup, pts, opts);
- }
-
- polyPolygon(polygons: PointS[][]) {
- Helper.log("[gdi] polyPolygon: polygons.length=" + polygons.length
- + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
-
- const cnt = polygons.length;
- for (let i = 0; i < cnt; i++) {
- this.polygon(polygons[i], i === 0);
- }
- }
-
- polyline(points: PointS[]) {
- Helper.log("[gdi] polyline: points=" + points + " with pen " + this.state.selected.pen.toString());
- const pts = [];
- for (let i = 0; i < points.length; i++) {
- const point = points[i];
- pts.push([this._todevX(point.x), this._todevY(point.y)]);
- }
- Helper.log("[gdi] polyline: TRANSLATED: pts=" + pts);
- this._pushGroup();
- const opts = this._applyOpts({fill: "none"}, true, false, false);
- this._svg.polyline(this.state._svggroup, pts, opts);
- }
-
- ellipse(rect: Rect) {
- Helper.log("[gdi] ellipse: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString()
- + " and brush " + this.state.selected.brush.toString());
- const bottom = this._todevY(rect.bottom);
- const right = this._todevX(rect.right);
- const top = this._todevY(rect.top);
- const left = this._todevX(rect.left);
- Helper.log("[gdi] ellipse: TRANSLATED: bottom=" + bottom + " right=" + right + " top=" + top + " left=" + left);
- this._pushGroup();
- const width2 = (right - left) / 2;
- const height2 = (bottom - top) / 2;
- const opts = this._applyOpts(null, true, true, false);
- this._svg.ellipse(this.state._svggroup, left + width2, top + height2, width2, height2, opts);
- }
-
- excludeClipRect(rect: Rect) {
- Helper.log("[gdi] excludeClipRect: rect=" + rect.toString());
- this._getClipRgn().subtract(rect);
- }
-
- intersectClipRect(rect: Rect) {
- Helper.log("[gdi] intersectClipRect: rect=" + rect.toString());
- this._getClipRgn().intersect(rect);
- }
-
- offsetClipRgn(offX: number, offY: number) {
- Helper.log("[gdi] offsetClipRgn: offX=" + offX + " offY=" + offY);
- this._getClipRgn().offset(offX, offY);
- }
-
- setTextAlign(textAlignmentMode: number) {
- Helper.log("[gdi] setTextAlign: textAlignmentMode=0x" + textAlignmentMode.toString(16));
- this.state.textalign = textAlignmentMode;
- }
-
- setBkMode(bkMode: number) {
- Helper.log("[gdi] setBkMode: bkMode=0x" + bkMode.toString(16));
- this.state.bkmode = bkMode;
- }
-
- setTextColor(textColor: ColorRef) {
- Helper.log("[gdi] setTextColor: textColor=" + textColor.toString());
- this.state.textcolor = textColor;
- }
-
- setBkColor(bkColor: ColorRef) {
- Helper.log("[gdi] setBkColor: bkColor=" + bkColor.toString());
- this.state.bkcolor = bkColor;
- this.state._svgtextbkfilter = null;
- }
-
- setPolyFillMode(polyFillMode: number) {
- Helper.log("[gdi] setPolyFillMode: polyFillMode=" + polyFillMode);
- this.state.polyfillmode = polyFillMode;
- }
-
- createBrush(brush: Brush) {
- const idx = this._storeObject(brush);
- Helper.log("[gdi] createBrush: brush=" + brush.toString() + " with handle " + idx);
- }
-
- createFont(font: Font) {
- const idx = this._storeObject(font);
- Helper.log("[gdi] createFont: font=" + font.toString() + " with handle " + idx);
- }
-
- createPen(pen: Pen) {
- const idx = this._storeObject(pen);
- Helper.log("[gdi] createPen: pen=" + pen.toString() + " width handle " + idx);
- }
-
- createPalette(palette: Palette) {
- const idx = this._storeObject(palette);
- Helper.log("[gdi] createPalette: palette=" + palette.toString() + " width handle " + idx);
- }
-
- createRegion(region: Region) {
- const idx = this._storeObject(region);
- Helper.log("[gdi] createRegion: region=" + region.toString() + " width handle " + idx);
- }
-
- createPatternBrush(patternBrush: Brush) {
- const idx = this._storeObject(patternBrush);
- Helper.log("[gdi] createRegion: region=" + patternBrush.toString() + " width handle " + idx);
- }
-
- selectObject(objIdx: number, checkType: string) {
- const obj = this._getObject(objIdx);
- if (obj != null && (checkType == null || obj.type === checkType)) {
- this._selectObject(obj);
- Helper.log("[gdi] selectObject: objIdx=" + objIdx
- + (obj ? " selected " + obj.type + ": " + obj.toString() : "[invalid index]"));
- } else {
- Helper.log("[gdi] selectObject: objIdx=" + objIdx
- + (obj ? " invalid object type: " + obj.type : "[invalid index]"));
- }
- }
-
- deleteObject(objIdx: number) {
- const ret = this._deleteObject(objIdx);
- Helper.log("[gdi] deleteObject: objIdx=" + objIdx + (ret ? " deleted object" : "[invalid index]"));
- }
}
diff --git a/src/wmfjs/Helper.ts b/src/wmfjs/Helper.ts
index 95b2553..dc399f6 100644
--- a/src/wmfjs/Helper.ts
+++ b/src/wmfjs/Helper.ts
@@ -45,7 +45,7 @@ export function loggingEnabled(enabled: boolean) {
}
export class Helper {
- static GDI = {
+ public static GDI = {
METAHEADER_SIZE: 18,
BITMAPINFOHEADER_SIZE: 40,
BITMAPCOREHEADER_SIZE: 12,
@@ -275,27 +275,27 @@ export class Helper {
BI_PNG: 5,
},
};
- static _uniqueId = 0;
+ public static _uniqueId = 0;
- static log(message: string) {
+ public static log(message: string) {
if (isLoggingEnabled) {
// tslint:disable-next-line:no-console
console.log(message);
}
}
- static _makeUniqueId(prefix: string) {
+ public static _makeUniqueId(prefix: string) {
return "wmfjs_" + prefix + (this._uniqueId++);
}
- static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {
+ public static _writeUint32Val(uint8arr: Uint8Array, pos: number, val: number) {
uint8arr[pos++] = val & 0xff;
uint8arr[pos++] = (val >>> 8) & 0xff;
uint8arr[pos++] = (val >>> 16) & 0xff;
uint8arr[pos++] = (val >>> 24) & 0xff;
}
- static _blobToBinary(blob: Uint8Array) {
+ public static _blobToBinary(blob: Uint8Array) {
let ret = "";
const len = blob.length;
for (let i = 0; i < len; i++) {
diff --git a/src/wmfjs/Primitives.ts b/src/wmfjs/Primitives.ts
index 363849d..6489fc3 100644
--- a/src/wmfjs/Primitives.ts
+++ b/src/wmfjs/Primitives.ts
@@ -28,8 +28,8 @@ import { Blob } from "./Blob";
import { WMFJSError } from "./Helper";
export class PointS {
- x: number;
- y: number;
+ public x: number;
+ public y: number;
constructor(reader: Blob, x?: number, y?: number) {
if (reader != null) {
@@ -41,20 +41,20 @@ export class PointS {
}
}
- clone() {
+ public clone() {
return new PointS(null, this.x, this.y);
}
- toString() {
+ public toString() {
return "{x: " + this.x + ", y: " + this.y + "}";
}
}
export class Rect {
- bottom: number;
- right: number;
- top: number;
- left: number;
+ public bottom: number;
+ public right: number;
+ public top: number;
+ public left: number;
constructor(reader: Blob, left?: number, top?: number, right?: number, bottom?: number) {
if (reader != null) {
@@ -70,20 +70,20 @@ export class Rect {
}
}
- clone() {
+ public clone() {
return new Rect(null, this.left, this.top, this.right, this.bottom);
}
- toString() {
+ public toString() {
return "{left: " + this.left + ", top: " + this.top + ", right: " + this.right
+ ", bottom: " + this.bottom + "}";
}
- empty() {
+ public empty() {
return this.left >= this.right || this.top >= this.bottom;
}
- intersect(rect: Rect) {
+ public intersect(rect: Rect) {
if (this.empty() || rect.empty()) {
return null;
}
@@ -97,17 +97,17 @@ export class Rect {
}
export class Obj {
- type: string;
+ public type: string;
constructor(type: string) {
this.type = type;
}
- clone(): Obj {
+ public clone(): Obj {
throw new WMFJSError("clone not implemented");
}
- toString() {
+ public toString() {
throw new WMFJSError("toString not implemented");
}
}
diff --git a/src/wmfjs/Region.ts b/src/wmfjs/Region.ts
index 7a223f4..a9bcdff 100644
--- a/src/wmfjs/Region.ts
+++ b/src/wmfjs/Region.ts
@@ -29,9 +29,9 @@ import { Helper, WMFJSError } from "./Helper";
import { Obj, Rect } from "./Primitives";
export class Region extends Obj {
- bounds: Rect;
- scans: Scan[];
- complexity: number;
+ public bounds: Rect;
+ public scans: Scan[];
+ public complexity: number;
constructor(reader: Blob, copy?: Region) {
super("region");
@@ -73,18 +73,18 @@ export class Region extends Obj {
}
}
- clone() {
+ public clone() {
return new Region(null, this);
}
- toString() {
+ public toString() {
const _complexity = ["null", "simple", "complex"];
return "{complexity: " + _complexity[this.complexity]
+ " bounds: " + (this.bounds != null ? this.bounds.toString() : "[none]")
+ " #scans: " + (this.scans != null ? this.scans.length : "[none]") + "}";
}
- _updateComplexity() {
+ public _updateComplexity() {
if (this.bounds == null) {
this.complexity = 0;
this.scans = null;
@@ -109,7 +109,7 @@ export class Region extends Obj {
}
}
- subtract(rect: Rect) {
+ public subtract(rect: Rect) {
Helper.log("[wmf] Region " + this.toString() + " subtract " + rect.toString());
if (this.bounds != null) {
@@ -236,7 +236,7 @@ export class Region extends Obj {
Helper.log("[wmf] Region subtraction -> " + this.toString());
}
- intersect(rect: Rect) {
+ public intersect(rect: Rect) {
Helper.log("[wmf] Region " + this.toString() + " intersect with " + rect.toString());
if (this.bounds != null) {
this.bounds = this.bounds.intersect(rect);
@@ -296,7 +296,7 @@ export class Region extends Obj {
Helper.log("[wmf] Region intersection -> " + this.toString());
}
- offset(offX: number, offY: number) {
+ public offset(offX: number, offY: number) {
if (this.bounds != null) {
this.bounds.left += offX;
this.bounds.top += offY;
@@ -330,9 +330,9 @@ export function CreateSimpleRegion(left: number, top: number, right: number, bot
}
export class Scan {
- top: number;
- bottom: number;
- scanlines: Array<{left: number, right: number}>;
+ public top: number;
+ public bottom: number;
+ public scanlines: Array<{left: number, right: number}>;
constructor(reader: Blob, copy?: Scan, top?: number, bottom?: number,
scanlines?: Array<{left: number, right: number}>) {
@@ -362,11 +362,11 @@ export class Scan {
}
}
- clone() {
+ public clone() {
return new Scan(null, this);
}
- subtract(left: number, right: number) {
+ public subtract(left: number, right: number) {
let i;
// Keep everything on the left side
@@ -411,7 +411,7 @@ export class Scan {
return this.scanlines.length > 0;
}
- intersect(left: number, right: number) {
+ public intersect(left: number, right: number) {
// Get rid of anything that falls entirely outside to the left
for (let i = 0; i < this.scanlines.length; i++) {
const scanline = this.scanlines[i];
@@ -450,7 +450,7 @@ export class Scan {
return this.scanlines.length > 0;
}
- toString() {
+ public toString() {
return "{ #scanlines: " + this.scanlines.length + "}";
}
}
diff --git a/src/wmfjs/Renderer.ts b/src/wmfjs/Renderer.ts
index a5b0a74..366651c 100644
--- a/src/wmfjs/Renderer.ts
+++ b/src/wmfjs/Renderer.ts
@@ -29,7 +29,7 @@ import { GDIContext } from "./GDIContext";
import { Helper, WMFJSError } from "./Helper";
import { WMFRecords } from "./WMFRecords";
-export class RendererSettings {
+export interface IRendererSettings {
width: string;
height: string;
xExt: number;
@@ -38,14 +38,28 @@ export class RendererSettings {
}
export class Renderer {
- _img: WMF;
+ private _img: WMF;
constructor(blob: ArrayBuffer) {
this.parse(blob);
Helper.log("WMFJS.Renderer instantiated");
}
- parse(blob: ArrayBuffer) {
+ public render(info: IRendererSettings) {
+ const img = ($("") as any).svg({
+ onLoad: (svg: any) => {
+ return this._render(svg, info.mapMode, info.xExt, info.yExt);
+ },
+ settings: {
+ viewBox: [0, 0, info.xExt, info.yExt].join(" "),
+ preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
+ },
+ });
+ const svgContainer = ($(img[0]) as any).svg("get");
+ return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
+ }
+
+ private parse(blob: ArrayBuffer) {
this._img = null;
const reader = new Blob(blob);
@@ -85,7 +99,7 @@ export class Renderer {
}
}
- _render(svg: any, mapMode: number, xExt: number, yExt: number) {
+ private _render(svg: any, mapMode: number, xExt: number, yExt: number) {
// See https://www-user.tu-chemnitz.de/~ygu/petzold/ch18b.htm
const gdi = new GDIContext(svg);
gdi.setViewportExt(xExt, yExt);
@@ -94,28 +108,13 @@ export class Renderer {
this._img.render(gdi);
Helper.log("[WMF] <--- DONE RENDERING");
}
-
- render(info: RendererSettings) {
- const inst = this;
- const img = ($("
") as any).svg({
- onLoad: (svg: any) => {
- return this._render(svg, info.mapMode, info.xExt, info.yExt);
- },
- settings: {
- viewBox: [0, 0, info.xExt, info.yExt].join(" "),
- preserveAspectRatio: "none", // TODO: MM_ISOTROPIC vs MM_ANISOTROPIC
- },
- });
- const svgContainer = ($(img[0]) as any).svg("get");
- return $(svgContainer.root()).attr("width", info.width).attr("height", info.height);
- }
}
export class WMFRect16 {
- left: number;
- top: number;
- right: number;
- bottom: number;
+ private left: number;
+ private top: number;
+ private right: number;
+ private bottom: number;
constructor(reader: Blob) {
this.left = reader.readInt16();
@@ -124,15 +123,15 @@ export class WMFRect16 {
this.bottom = reader.readInt16();
}
- toString() {
+ public toString() {
return "{left: " + this.left + ", top: " + this.top + ", right: " + this.right
+ ", bottom: " + this.bottom + "}";
}
}
export class WMFPlacable {
- boundingBox: WMFRect16;
- unitsPerInch: number;
+ private boundingBox: WMFRect16;
+ private unitsPerInch: number;
constructor(reader: Blob) {
reader.skip(2);
@@ -145,11 +144,11 @@ export class WMFPlacable {
}
export class WMF {
- _reader: Blob;
- _version: number;
- _hdrsize: number;
- _placable: WMFPlacable;
- _records: WMFRecords;
+ private _reader: Blob;
+ private _version: number;
+ private _hdrsize: number;
+ private _placable: WMFPlacable;
+ private _records: WMFRecords;
constructor(reader: Blob, placable: WMFPlacable, version: number, hdrsize: number) {
this._reader = reader;
@@ -159,7 +158,7 @@ export class WMF {
this._records = new WMFRecords(reader, this._hdrsize);
}
- render(gdi: GDIContext) {
+ public render(gdi: GDIContext) {
this._records.play(gdi);
}
}
diff --git a/src/wmfjs/Style.ts b/src/wmfjs/Style.ts
index cb6c743..6c23c68 100644
--- a/src/wmfjs/Style.ts
+++ b/src/wmfjs/Style.ts
@@ -30,9 +30,9 @@ import { Helper } from "./Helper";
import { Obj, PointS } from "./Primitives";
export class ColorRef {
- r: number;
- g: number;
- b: number;
+ public r: number;
+ public g: number;
+ public b: number;
constructor(reader: Blob, r?: number, g?: number, b?: number) {
if (reader != null) {
@@ -47,36 +47,36 @@ export class ColorRef {
}
}
- clone() {
+ public clone() {
return new ColorRef(null, this.r, this.g, this.b);
}
- toHex() {
+ public toHex() {
const rgb = (this.r << 16) | (this.g << 8) | this.b;
return (0x1000000 + rgb).toString(16).slice(1);
}
- toString() {
+ public toString() {
return "{r: " + this.r + ", g: " + this.g + ", b: " + this.b + "}";
}
}
export class Font extends Obj {
- height: number;
- width: number;
- escapement: number;
- orientation: number;
- weight: number;
- italic: number;
- underline: number;
- strikeout: number;
- charset: number;
- outprecision: number;
- clipprecision: number;
- quality: number;
- pitch: number;
- family: number;
- facename: string;
+ public height: number;
+ public width: number;
+ public escapement: number;
+ public orientation: number;
+ public weight: number;
+ public italic: number;
+ public underline: number;
+ public strikeout: number;
+ public charset: number;
+ public outprecision: number;
+ public clipprecision: number;
+ public quality: number;
+ public pitch: number;
+ public family: number;
+ public facename: string;
constructor(reader: Blob, copy: Font | number) {
super("font");
@@ -137,22 +137,22 @@ export class Font extends Obj {
}
}
- clone() {
+ public clone() {
return new Font(null, this);
}
- toString() {
+ public toString() {
return JSON.stringify(this);
}
}
export class Brush extends Obj {
- style: number;
- color: ColorRef;
- pattern: Bitmap16;
- colorusage: number;
- dibpatternpt: DIBitmap;
- hatchstyle: number;
+ public style: number;
+ public color: ColorRef;
+ public pattern: Bitmap16;
+ public colorusage: number;
+ public dibpatternpt: DIBitmap;
+ public hatchstyle: number;
constructor(reader: Blob, copy: Brush | number, forceDibPattern?: boolean | PatternBitmap16) {
super("brush");
@@ -211,11 +211,11 @@ export class Brush extends Obj {
}
}
- clone() {
+ public clone() {
return new Brush(null, this);
}
- toString() {
+ public toString() {
let ret = "{style: " + this.style;
switch (this.style) {
case Helper.GDI.BrushStyle.BS_SOLID:
@@ -233,11 +233,11 @@ export class Brush extends Obj {
}
export class Pen extends Obj {
- style: number;
- width: PointS;
- color: ColorRef;
- linecap: number;
- join: number;
+ public style: number;
+ public width: PointS;
+ public color: ColorRef;
+ public linecap: number;
+ public join: number;
constructor(reader: Blob, style?: number, width?: PointS, color?: ColorRef, linecap?: number, join?: number) {
super("pen");
@@ -257,21 +257,21 @@ export class Pen extends Obj {
}
}
- clone() {
+ public clone() {
return new Pen(null, this.style, this.width.clone(), this.color.clone(), this.linecap, this.join);
}
- toString() {
+ public toString() {
return "{style: " + this.style + ", width: " + this.width.toString() + ", color: " + this.color.toString()
+ ", linecap: " + this.linecap + ", join: " + this.join + "}";
}
}
export class PaletteEntry {
- flag: number;
- b: number;
- g: number;
- r: number;
+ public flag: number;
+ public b: number;
+ public g: number;
+ public r: number;
constructor(reader: Blob, copy?: PaletteEntry) {
if (reader != null) {
@@ -287,14 +287,14 @@ export class PaletteEntry {
}
}
- clone() {
+ public clone() {
return new PaletteEntry(null, this);
}
}
export class Palette extends Obj {
- start: number;
- entries: PaletteEntry[];
+ public start: number;
+ public entries: PaletteEntry[];
constructor(reader: Blob, copy?: Palette) {
super("palette");
@@ -315,11 +315,11 @@ export class Palette extends Obj {
}
}
- clone() {
+ public clone() {
return new Palette(null, this);
}
- toString() {
+ public toString() {
return "{ #entries: " + this.entries.length + "}"; // TODO
}
}
diff --git a/src/wmfjs/WMFRecords.ts b/src/wmfjs/WMFRecords.ts
index 672ebb0..19254db 100644
--- a/src/wmfjs/WMFRecords.ts
+++ b/src/wmfjs/WMFRecords.ts
@@ -33,7 +33,7 @@ import { Region } from "./Region";
import { Brush, ColorRef, Font, Palette, Pen } from "./Style";
export class WMFRecords {
- _records: Array<(gdi: GDIContext) => void>;
+ private _records: Array<(gdi: GDIContext) => void>;
constructor(reader: Blob, first: number) {
this._records = [];
@@ -502,7 +502,7 @@ export class WMFRecords {
}
}
- play(gdi: GDIContext) {
+ public play(gdi: GDIContext) {
const len = this._records.length;
for (let i = 0; i < len; i++) {
this._records[i](gdi);
diff --git a/tslint.json b/tslint.json
index ee1640a..b7004cb 100644
--- a/tslint.json
+++ b/tslint.json
@@ -9,7 +9,6 @@
"prefer-for-of": false,
// to be enabled eventually
- "member-access": false,
"forin": false
},
"defaultSeverity": "error"