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.
This commit is contained in:
Godzil 2022-11-17 21:04:44 +00:00
parent d56b29162a
commit 4208cb915d
2 changed files with 29 additions and 1 deletions

18
PTCR.md
View File

@ -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

View File

@ -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)