cs
This commit is contained in:
parent
dbeae3385a
commit
d255ebe15b
@ -1,11 +1,11 @@
|
||||
import RPi.GPIO
|
||||
import sys
|
||||
from PIL import Image
|
||||
sys.path.append("../../")
|
||||
from gfxlcd.driver.ili9325.gpio import GPIO as ILIGPIO
|
||||
from gfxlcd.driver.ili9325.ili9325 import ILI9325
|
||||
RPi.GPIO.setmode(RPi.GPIO.BCM)
|
||||
|
||||
from PIL import Image
|
||||
|
||||
lcd_tft = ILI9325(240, 320, ILIGPIO())
|
||||
lcd_tft.init()
|
||||
|
@ -1,12 +1,12 @@
|
||||
import RPi.GPIO
|
||||
import sys
|
||||
import random
|
||||
from PIL import Image
|
||||
sys.path.append("../../")
|
||||
from gfxlcd.driver.nju6450.gpio import GPIO
|
||||
from gfxlcd.driver.nju6450.nju6450 import NJU6450
|
||||
RPi.GPIO.setmode(RPi.GPIO.BCM)
|
||||
|
||||
from PIL import Image
|
||||
|
||||
lcd_nju = NJU6450(122, 32, GPIO())
|
||||
lcd_nju.init()
|
||||
|
@ -1,10 +1,10 @@
|
||||
import RPi.GPIO
|
||||
import sys
|
||||
from PIL import Image
|
||||
sys.path.append("../../")
|
||||
from gfxlcd.driver.ssd1306.spi import SPI
|
||||
from gfxlcd.driver.ssd1306.ssd1306 import SSD1306
|
||||
RPi.GPIO.setmode(RPi.GPIO.BCM)
|
||||
from PIL import Image
|
||||
|
||||
lcd_oled = SSD1306(128, 64, SPI())
|
||||
lcd_oled.init()
|
||||
|
@ -138,8 +138,18 @@ class Area(Pixel):
|
||||
temporary_area = None
|
||||
for red, green, blue in list(image_file.getdata()):
|
||||
if self._is_transparent((red, green, blue)):
|
||||
area = (pos_x, pos_y + row + 1, pos_x + width - 1, pos_y + height - 1)
|
||||
temporary_area = (pos_x + col + 1, pos_y + row, pos_x + width - 1, pos_y + row)
|
||||
area = (
|
||||
pos_x,
|
||||
pos_y + row + 1,
|
||||
pos_x + width - 1,
|
||||
pos_y + height - 1
|
||||
)
|
||||
temporary_area = (
|
||||
pos_x + col + 1,
|
||||
pos_y + row,
|
||||
pos_x + width - 1,
|
||||
pos_y + row
|
||||
)
|
||||
else:
|
||||
if temporary_area is not None:
|
||||
self._set_area(*temporary_area)
|
||||
@ -159,9 +169,11 @@ class Area(Pixel):
|
||||
"""check if color is a transparency color"""
|
||||
if self.options['transparency_color'] is None:
|
||||
return False
|
||||
elif type(self.options['transparency_color'][0]) == int and color == self.options['transparency_color']:
|
||||
elif type(self.options['transparency_color'][0]) == int \
|
||||
and color == self.options['transparency_color']:
|
||||
return True
|
||||
elif type(self.options['transparency_color'][0]) == list and color in self.options['transparency_color']:
|
||||
elif type(self.options['transparency_color'][0]) == list \
|
||||
and color in self.options['transparency_color']:
|
||||
return True
|
||||
|
||||
return False
|
@ -121,7 +121,8 @@ class Page(Pixel, metaclass=abc.ABCMeta):
|
||||
offset_x = 0
|
||||
offset_y = 0
|
||||
for stream in list(image_file.getdata()):
|
||||
if stream > self.options['threshold'] and not self._is_transparent(stream):
|
||||
if stream > self.options['threshold'] \
|
||||
and not self._is_transparent(stream):
|
||||
self.draw_pixel(pos_x + offset_x, pos_y + offset_y)
|
||||
offset_x += 1
|
||||
if offset_x > width - 1:
|
||||
@ -130,9 +131,11 @@ class Page(Pixel, metaclass=abc.ABCMeta):
|
||||
|
||||
def _is_transparent(self, color):
|
||||
"""check if color is a transparency color"""
|
||||
if type(self.options['transparency_color']) == int and color == self.options['transparency_color']:
|
||||
if type(self.options['transparency_color']) == int \
|
||||
and color == self.options['transparency_color']:
|
||||
return True
|
||||
elif type(self.options['transparency_color']) == list and color in self.options['transparency_color']:
|
||||
elif type(self.options['transparency_color']) == list \
|
||||
and color in self.options['transparency_color']:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
2
tox.ini
2
tox.ini
@ -16,5 +16,5 @@ commands= nosetests --with-xunit --xunit-file=junit-{envname}.xml gfxlcd/tests
|
||||
/bin/bash -c "pylint gfxlcd > pylint-{envname}.log || :"
|
||||
[flake8]
|
||||
show-source = True
|
||||
exclude = .git,.venv,.tox,dist,doc,build,*egg,*/tests/*
|
||||
exclude = .git,.venv,.tox,dist,doc,build,*egg,*/tests/*,*/demos/*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user