testing setting image, tweaked some settings
This commit is contained in:
parent
6082f75e95
commit
0585014c2f
1 changed files with 12 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue