testing setting image, tweaked some settings

This commit is contained in:
CiscoTheWolf 2023-05-18 11:03:04 +02:00
parent 6082f75e95
commit 0585014c2f

View file

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