aboutsummaryrefslogtreecommitdiff
path: root/src/frame.py
diff options
context:
space:
mode:
authortassaron2017-07-09 01:10:06 -0400
committertassaron2017-07-09 01:10:06 -0400
commit94d4acc1f4f4abe4029e8f9c050932b67cae8cec (patch)
treed7d128e0a9f23d4df50800e82f42231a21923cb9 /src/frame.py
parentf027fd43537eb60f682b51a5018caee471bf33e2 (diff)
more comments + warnings for outdated dependencies
Diffstat (limited to 'src/frame.py')
-rw-r--r--src/frame.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/frame.py b/src/frame.py
index 6d6d299..57d33b0 100644
--- a/src/frame.py
+++ b/src/frame.py
@@ -8,17 +8,17 @@ import sys
class FramePainter(QtGui.QPainter):
+ '''
+ A QPainter for a blank frame, which can be converted into a
+ Pillow image with finalize()
+ '''
def __init__(self, width, height):
image = BlankFrame(width, height)
self.image = ImageQt(image)
super().__init__(self.image)
def setPen(self, RgbTuple):
- if sys.byteorder == 'big':
- color = QtGui.QColor(*RgbTuple)
- else:
- color = QtGui.QColor(*RgbTuple[::-1])
- super().setPen(QtGui.QColor(color))
+ super().setPen(PaintColor(*RgbTuple))
def finalize(self):
self.end()
@@ -28,15 +28,20 @@ class FramePainter(QtGui.QPainter):
'RGBA', (self.image.width(), self.image.height()), imBytes
)
+
class PaintColor(QtGui.QColor):
+ '''Reverse the painter colour if the hardware stores RGB values backward'''
def __init__(self, r, g, b, a=255):
if sys.byteorder == 'big':
super().__init__(r, g, b, a)
else:
super().__init__(b, g, r, a)
+
def FloodFrame(width, height, RgbaTuple):
return Image.new("RGBA", (width, height), RgbaTuple)
+
def BlankFrame(width, height):
+ '''The base frame used by each component to start drawing'''
return FloodFrame(width, height, (0, 0, 0, 0))