From 4208cb915deb2dce5dc762bc94ed6610e4fd9560 Mon Sep 17 00:00:00 2001 From: Godzil Date: Thu, 17 Nov 2022 21:04:44 +0000 Subject: [PATCH] Added preliminary support for a panning canvas command. Found that the iOS/Android export tool do not support at least one command from history file which was my main source to decode the history format. That command is likely to be linked with panning the canvas. --- PTCR.md | 18 +++++++++++++++++- sample_tools/ptcr2gif.py | 12 ++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/PTCR.md b/PTCR.md index 03e6d6a..885b224 100644 --- a/PTCR.md +++ b/PTCR.md @@ -118,7 +118,23 @@ Code clear the canvas to all white whatever the value. Not sure what the byte 3 - `F7 16 2E 00` - ### F8: Not used + ### F8: Unknown (Panning?) + +| byte 0 | byte 1 | byte 2 | byte 3 | byte 4 | byte 5 | +|--------|-----------|-----------|--------|--------|--------| +| F8 | Stroke #1 | Stroke #2 | ??? | ??? | ??? | + +This command is present in at least one file (P0003_09.DAT) but is not handled by the +iOS/Android app. Having looked at the history of that image on the device at one point +the whole image shift by 1 and 1 pixel, this could be related as the command in the file is + +`F8 0F 58 04 01 01` + +And we clearly have a 1 and 1 in the bytes, 4 could be related to the direction. + +More test need to be done. + + ### F9: Not used diff --git a/sample_tools/ptcr2gif.py b/sample_tools/ptcr2gif.py index 572367f..27c34b2 100644 --- a/sample_tools/ptcr2gif.py +++ b/sample_tools/ptcr2gif.py @@ -97,6 +97,7 @@ class CommandHandler: b'\xF5': self.replace_color, b'\xF6': self.erase_pixel, b'\xF7': self.clear_canvas, + b'\xF8': self.pan_canvas, # b'\xFA': self.set_color, b'\xFB': self.set_canvas_resolution, @@ -221,6 +222,17 @@ class CommandHandler: # Always read 3 bytes (2 for stroke, 1 for ?) return 3 + def pan_canvas(self): + self._was_a_stroke = True + self._get_stroke_number() + + # This may be panning, not sure. + + data = self._file.read(3) + data = struct.unpack("BBB", data) + + return 5 + def set_color(self): self._was_a_stroke = False data = self._file.read(2)