Skip to content

Commit 37dc60b

Browse files
authored
Allow more pixel styles in raw adaptor (#129)
1 parent d009516 commit 37dc60b

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

RGBMatrixEmulator/adapters/raw_adapter/__init__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
from RGBMatrixEmulator.adapters.base import BaseAdapter
2-
3-
from PIL import Image
4-
5-
import numpy as np
2+
from RGBMatrixEmulator.internal.pixel_style import PixelStyle
63

74

85
class RawAdapter(BaseAdapter):
6+
SUPPORTED_PIXEL_STYLES = [
7+
PixelStyle.SQUARE,
8+
PixelStyle.CIRCLE,
9+
PixelStyle.REAL,
10+
]
11+
912
MAX_FRAMES_STORED = 128
1013
DEFAULT_MAX_FRAME = -1 # Never halts
1114

@@ -29,7 +32,7 @@ def load_emulator_window(self):
2932
pass
3033

3134
def _dump_screenshot(self, path):
32-
image = Image.fromarray(np.array(self._last_frame(), dtype="uint8"), "RGB")
35+
image = self._get_masked_image(self._last_frame())
3336
image.save(path)
3437

3538
def _last_frame(self):

test/test_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"_comment": "This config is used specifically to test RGBME via the raw adapter",
33
"pixel_outline": 0,
4-
"pixel_size": 16,
4+
"pixel_size": 1,
55
"pixel_style": "square",
66
"pixel_glow": 6,
77
"display_adapter": "raw",
@@ -31,4 +31,4 @@
3131
"led_rgb_sequence": "RGB"
3232
},
3333
"log_level": "debug"
34-
}
34+
}

0 commit comments

Comments
 (0)