From 0585014c2fd658a6a68ce020110d2c0dad1c4e6c Mon Sep 17 00:00:00 2001 From: CiscoTheWolf Date: Thu, 18 May 2023 11:03:04 +0200 Subject: [PATCH] testing setting image, tweaked some settings --- rpi/roy-test.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/rpi/roy-test.py b/rpi/roy-test.py index 529e1c3..0ed23e0 100644 --- a/rpi/roy-test.py +++ b/rpi/roy-test.py @@ -13,28 +13,32 @@ options.parallel = 1 options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat' matrix = RGBMatrix(options = options) -# offscreen canvas that can be written to which can then be set to the matrix async -offscreen_canvas = matrix.CreateFrameCanvas() - +# Load image and make sure it fits our screen. image = Image.open("../testImg.bmp") - -# Make image fit our screen. image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) +# offscreen canvas that can be written to which can then be set to the matrix async +offscreen_canvas = matrix.CreateFrameCanvas() +offscreen_canvas.brightness = 50 +offscreen__text_canvas = matrix.CreateFrameCanvas() +offscreen__text_canvas.brightness = 50 +offscreen__text_canvas.SetImage(image.convert('RGB')) def updateScreen(): global color, matrix, offscreen_canvas + nextCanvas = offscreen_canvas if(color == 1): offscreen_canvas.Fill(255,255,255) + nextCanvas = offscreen_canvas elif(color == 0): offscreen_canvas.Fill(255,0,0) + nextCanvas = offscreen_canvas elif(color == 2): - matrix.SetImage(image.convert('RGB')) + nextCanvas = offscreen__text_canvas - offscreen_canvas.brightness = 50 - offscreen_canvas = matrix.SwapOnVSync(offscreen_canvas) + nextCanvas = matrix.SwapOnVSync(nextCanvas) color = 0