[Libreoffice-commits] mso-dumper.git: 4 commits - msodumper/emfrecord.py

Miklos Vajna vmiklos at collabora.co.uk
Sat Apr 19 06:38:43 PDT 2014


 msodumper/emfrecord.py |   72 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 4 deletions(-)

New commits:
commit 94b172649c072c3fc4e0314338beae5cb2ddb12c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Apr 19 15:37:51 2014 +0200

    dump EmrPolylineto16

diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index 32d8b43..37e353c 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -354,6 +354,24 @@ class EmrPolypolygon16(EMFRecord):
         assert self.pos - posOrig == self.Size
 
 
+class EmrPolylineto16(EMFRecord):
+    """Draws one or more straight lines based upon the current position."""
+    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("Count", self.readuInt32(), hexdump=False)
+        print '<aPoints>'
+        for i in range(self.Count):
+            wmfrecord.PointS(self, "aPoint").dump()
+        print '</aPoints>'
+        assert self.pos - posOrig == self.Size
+
+
 class EmrPolybezierto16(EMFRecord):
     """Draws one or more Bezier curves based on the current position."""
     def __init__(self, parent):
@@ -633,7 +651,7 @@ RecordType = {
     0x00000056: ['EMR_POLYGON16', EmrPolygon16],
     0x00000057: ['EMR_POLYLINE16'],
     0x00000058: ['EMR_POLYBEZIERTO16', EmrPolybezierto16],
-    0x00000059: ['EMR_POLYLINETO16'],
+    0x00000059: ['EMR_POLYLINETO16', EmrPolylineto16],
     0x0000005A: ['EMR_POLYPOLYLINE16'],
     0x0000005B: ['EMR_POLYPOLYGON16', EmrPolypolygon16],
     0x0000005C: ['EMR_POLYDRAW16'],
commit 6cbd11816c0980f21f69967e0fcd8a998219c079
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Apr 19 15:35:25 2014 +0200

    dump EmrLineto

diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index 0d2dc3d..32d8b43 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -386,6 +386,20 @@ class EmrMovetoex(EMFRecord):
         assert self.pos - posOrig == self.Size
 
 
+class EmrLineto(EMFRecord):
+    """Draws a line from the current position up to, but not including, the
+    specified point."""
+    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.PointL(self, "Point").dump()
+        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
@@ -585,7 +599,7 @@ RecordType = {
     0x00000033: ['EMR_RESIZEPALETTE'],
     0x00000034: ['EMR_REALIZEPALETTE'],
     0x00000035: ['EMR_EXTFLOODFILL'],
-    0x00000036: ['EMR_LINETO'],
+    0x00000036: ['EMR_LINETO', EmrLineto],
     0x00000037: ['EMR_ARCTO'],
     0x00000038: ['EMR_POLYDRAW'],
     0x00000039: ['EMR_SETARCDIRECTION'],
commit cf9435aec77f0a51794b7c096426809369c14632
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Apr 19 15:33:00 2014 +0200

    dump EmrPolybezierto16

diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index 3e2573c..0d2dc3d 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -354,6 +354,24 @@ class EmrPolypolygon16(EMFRecord):
         assert self.pos - posOrig == self.Size
 
 
+class EmrPolybezierto16(EMFRecord):
+    """Draws one or more Bezier curves based on the current position."""
+    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("Count", self.readuInt32(), hexdump=False)
+        print '<aPoints>'
+        for i in range(self.Count):
+            wmfrecord.PointS(self, "aPoint").dump()
+        print '</aPoints>'
+        assert self.pos - posOrig == self.Size
+
+
 class EmrMovetoex(EMFRecord):
     """Specifies the coordinates of a new drawing position, in logical
     units."""
@@ -600,7 +618,7 @@ RecordType = {
     0x00000055: ['EMR_POLYBEZIER16'],
     0x00000056: ['EMR_POLYGON16', EmrPolygon16],
     0x00000057: ['EMR_POLYLINE16'],
-    0x00000058: ['EMR_POLYBEZIERTO16'],
+    0x00000058: ['EMR_POLYBEZIERTO16', EmrPolybezierto16],
     0x00000059: ['EMR_POLYLINETO16'],
     0x0000005A: ['EMR_POLYPOLYLINE16'],
     0x0000005B: ['EMR_POLYPOLYGON16', EmrPolypolygon16],
commit 21ec259db088e4fc3a57c83fd3e6f04b8c6741ce
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Apr 19 15:29:30 2014 +0200

    dump EmrMovetoex

diff --git a/msodumper/emfrecord.py b/msodumper/emfrecord.py
index d96bedb..3e2573c 100644
--- a/msodumper/emfrecord.py
+++ b/msodumper/emfrecord.py
@@ -354,6 +354,20 @@ class EmrPolypolygon16(EMFRecord):
         assert self.pos - posOrig == self.Size
 
 
+class EmrMovetoex(EMFRecord):
+    """Specifies the coordinates of a new drawing position, in logical
+    units."""
+    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.PointL(self, "Offset").dump()
+        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
@@ -526,7 +540,7 @@ RecordType = {
     0x00000018: ['EMR_SETTEXTCOLOR'],
     0x00000019: ['EMR_SETBKCOLOR'],
     0x0000001A: ['EMR_OFFSETCLIPRGN'],
-    0x0000001B: ['EMR_MOVETOEX'],
+    0x0000001B: ['EMR_MOVETOEX', EmrMovetoex],
     0x0000001C: ['EMR_SETMETARGN'],
     0x0000001D: ['EMR_EXCLUDECLIPRECT'],
     0x0000001E: ['EMR_INTERSECTCLIPRECT'],


More information about the Libreoffice-commits mailing list