msodumper/emfrecord.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 4 deletions(-)
New commits: commit b51ee751c3af1b73e44adb7eb19eeff83af3bcb9 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Apr 18 22:20:26 2014 +0200 dump EmrDeleteobject diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py index 38773f6..d96bedb 100644 --- a/msodumper/emfrecord.py +++ b/msodumper/emfrecord.py @@ -295,6 +295,24 @@ class EmrSelectobject(EMFRecord): assert self.pos - posOrig == self.Size +class EmrDeleteobject(EMFRecord): + """Specifies the index of the object to be deleted from the EMF Object + Table.""" + def __init__(self, parent): + EMFRecord.__init__(self, parent) + + def dump(self): + posOrig = self.pos + self.printAndSet("Type", self.readuInt32()) + self.printAndSet("Size", self.readuInt32(), hexdump=False) + ihObject = self.getuInt32(pos=self.pos) + if ihObject < 0x80000000: + self.printAndSet("ihObject", self.readuInt32()) + else: + self.printAndSet("ihObject", self.readuInt32(), dict=StockObject) + assert self.pos - posOrig == self.Size + + class EmrPolygon16(EMFRecord): """Draws a polygon consisting of two or more vertexes connected by straight lines.""" def __init__(self, parent): @@ -521,7 +539,7 @@ RecordType = { 0x00000025: ['EMR_SELECTOBJECT', EmrSelectobject], 0x00000026: ['EMR_CREATEPEN'], 0x00000027: ['EMR_CREATEBRUSHINDIRECT', EmrCreatebrushindirect], - 0x00000028: ['EMR_DELETEOBJECT'], + 0x00000028: ['EMR_DELETEOBJECT', EmrDeleteobject], 0x00000029: ['EMR_ANGLEARC'], 0x0000002A: ['EMR_ELLIPSE'], 0x0000002B: ['EMR_RECTANGLE'], commit 1f8d9a66c2996d9b2fc68cbbc924c6995730efa6 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Apr 18 22:15:53 2014 +0200 dump EmrSelectclippath diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py index 2b2933d..38773f6 100644 --- a/msodumper/emfrecord.py +++ b/msodumper/emfrecord.py @@ -336,6 +336,21 @@ class EmrPolypolygon16(EMFRecord): assert self.pos - posOrig == self.Size +class EmrSelectclippath(EMFRecord): + """Specifies the current path as a clipping region for the playback device + context, combining the new region with any existing clipping region using + the specified mode.""" + def __init__(self, parent): + EMFRecord.__init__(self, parent) + + def dump(self): + posOrig = self.pos + self.printAndSet("Type", self.readuInt32()) + self.printAndSet("Size", self.readuInt32(), hexdump=False) + self.printAndSet("RegionMode", self.readuInt32(), dict=RegionMode) + assert self.pos - posOrig == self.Size + + class EmrBeginpath(EMFRecord): """This record opens a path bracket in the current playback device context.""" def __init__(self, parent): @@ -533,7 +548,7 @@ RecordType = { 0x00000040: ['EMR_STROKEPATH'], 0x00000041: ['EMR_FLATTENPATH'], 0x00000042: ['EMR_WIDENPATH'], - 0x00000043: ['EMR_SELECTCLIPPATH'], + 0x00000043: ['EMR_SELECTCLIPPATH', EmrSelectclippath], 0x00000044: ['EMR_ABORTPATH'], 0x00000046: ['EMR_COMMENT', EmrComment], 0x00000047: ['EMR_FILLRGN'], commit 098d3fe8c00f666ef68e5ad0208979b90488c46f Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Apr 18 22:06:18 2014 +0200 dump EmrPolypolygon16 diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py index 288cfdd..2b2933d 100644 --- a/msodumper/emfrecord.py +++ b/msodumper/emfrecord.py @@ -313,6 +313,29 @@ class EmrPolygon16(EMFRecord): assert self.pos - posOrig == self.Size +class EmrPolypolygon16(EMFRecord): + """Paints a series of closed polygons.""" + def __init__(self, parent): + EMFRecord.__init__(self, parent) + + def dump(self): + posOrig = self.pos + self.printAndSet("Type", self.readuInt32()) + self.printAndSet("Size", self.readuInt32(), hexdump=False) + wmfrecord.RectL(self, "Bounds").dump() + self.printAndSet("NumberOfPolygons", self.readuInt32(), hexdump=False) + self.printAndSet("Count", self.readuInt32(), hexdump=False) + print '<PolygonPointCounts>' + for i in range(self.NumberOfPolygons): + self.printAndSet("PolygonPointCount", self.readuInt32(), hexdump=False) + print '</PolygonPointCounts>' + print '<aPoints>' + for i in range(self.Count): + wmfrecord.PointS(self, "aPoint").dump() + print '</aPoints>' + assert self.pos - posOrig == self.Size + + class EmrBeginpath(EMFRecord): """This record opens a path bracket in the current playback device context.""" def __init__(self, parent): @@ -533,7 +556,7 @@ RecordType = { 0x00000058: ['EMR_POLYBEZIERTO16'], 0x00000059: ['EMR_POLYLINETO16'], 0x0000005A: ['EMR_POLYPOLYLINE16'], - 0x0000005B: ['EMR_POLYPOLYGON16'], + 0x0000005B: ['EMR_POLYPOLYGON16', EmrPolypolygon16], 0x0000005C: ['EMR_POLYDRAW16'], 0x0000005D: ['EMR_CREATEMONOBRUSH'], 0x0000005E: ['EMR_CREATEDIBPATTERNBRUSHPT'], commit 3603cebb4a7e2de9eb6c5225af81300e037ea88e Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Apr 18 21:54:28 2014 +0200 dump EmrSetpolyfillmode diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py index 2a360c2..288cfdd 100644 --- a/msodumper/emfrecord.py +++ b/msodumper/emfrecord.py @@ -219,6 +219,26 @@ class EmrSetviewportorgex(EMFRecord): assert self.pos - posOrig == self.Size +# Defines values that specify how to calculate the region of a polygon that is to be filled. +PolygonFillMode = { + 0x01: "ALTERNATE", # Selects alternate mode (fills the area between odd-numbered and even-numbered polygon sides on each scan line). + 0x02: "WINDING" # Selects winding mode (fills any region with a nonzero winding value). +} + + +class EmrSetpolyfillmode(EMFRecord): + """Defines polygon fill mode.""" + def __init__(self, parent): + EMFRecord.__init__(self, parent) + + def dump(self): + posOrig = self.pos + self.printAndSet("Type", self.readuInt32()) + self.printAndSet("Size", self.readuInt32(), hexdump=False) + self.printAndSet("PolygonFillMode", self.readuInt32(), dict=PolygonFillMode) + assert self.pos - posOrig == self.Size + + class EmrExtselectcliprgn(EMFRecord): """Combines the specified region with the current clip region using the specified mode.""" def __init__(self, parent): @@ -442,7 +462,7 @@ RecordType = { 0x00000010: ['EMR_SETMAPPERFLAGS'], 0x00000011: ['EMR_SETMAPMODE'], 0x00000012: ['EMR_SETBKMODE'], - 0x00000013: ['EMR_SETPOLYFILLMODE'], + 0x00000013: ['EMR_SETPOLYFILLMODE', EmrSetpolyfillmode], 0x00000014: ['EMR_SETROP2'], 0x00000015: ['EMR_SETSTRETCHBLTMODE'], 0x00000016: ['EMR_SETTEXTALIGN'], _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits