diff options
Diffstat (limited to 'src/toolkit/frame.py')
| -rw-r--r-- | src/toolkit/frame.py | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/toolkit/frame.py b/src/toolkit/frame.py index e4332eb..6174072 100644 --- a/src/toolkit/frame.py +++ b/src/toolkit/frame.py @@ -86,31 +86,25 @@ def FloodFrame(width, height, RgbaTuple): @defaultSize -def BlankFrame(width, height, blankFrames={}): +def BlankFrame(width, height): '''The base frame used by each component to start drawing.''' - try: - return blankFrames[(width, height)] - except KeyError: - newFrame = FloodFrame(width, height, (0, 0, 0, 0)) - blankFrames[(width, height)] = newFrame - return newFrame + newFrame = FloodFrame(width, height, (0, 0, 0, 0)) + blankFrames[(width, height)] = newFrame + return newFrame @defaultSize -def Checkerboard(width, height, checkerboards={}): +def Checkerboard(width, height): ''' A checkerboard to represent transparency to the user. TODO: Would be cool to generate this image with numpy instead. ''' - try: - return checkerboards[(width, height)] - except KeyError: - log.debug('Creating new %s*%s checkerboard' % (width, height)) - image = FloodFrame(1920, 1080, (0, 0, 0, 0)) - image.paste(Image.open( - os.path.join(core.Core.wd, "background.png")), - (0, 0) - ) - image = image.resize((width, height)) - checkerboards[(width, height)] = image - return image + log.debug('Creating new %s*%s checkerboard' % (width, height)) + image = FloodFrame(1920, 1080, (0, 0, 0, 0)) + image.paste(Image.open( + os.path.join(core.Core.wd, "background.png")), + (0, 0) + ) + image = image.resize((width, height)) + checkerboards[(width, height)] = image + return image |
