def createFrame(watchFace, resources, state): from PIL import Image, ImageDraw # graphics = Image.new('RGBA', (360, 360)) graphics = Image.new('RGBA', Config.getImageSize()) watchFace.draw3(graphics, resources, state) return graphics
def draw2(self, drawer, images, angle): x = self._x y = self._y if angle is None: temp = images[self._imageIndex].getBitmap() drawer.paste(temp, (x, y), temp) else: bitmap = images[self._imageIndex].getBitmap() from PIL import Image # temp = Image.new('RGBA', (360, 360)) # temp.paste(bitmap, (180 - x, 180 - y), bitmap) temp = Image.new('RGBA', (Config.getImageSize(), Config.getImageSize())) temp.paste( bitmap, (Config.getImageSizeHalf() - x, Config.getImageSizeHalf() - y), bitmap) temp = temp.rotate(angle) drawer.paste(temp, (0, 0), temp)
def draw2(self, drawer, images, angle, center=None): x = self._x y = self._y if angle is None: temp = images[self._imageIndex].getBitmap() drawer.paste(temp, (x, y), temp) else: bitmap = images[self._imageIndex].getBitmap() from PIL import Image temp = Image.new('RGBA', Config.getImageSize()) temp.paste(bitmap, (Config.getImageSizeHalf()[0] - x, Config.getImageSizeHalf()[1] - y), bitmap) temp = temp.rotate(angle) if center is None: drawer.paste(temp, (0, 0), temp) else: drawer.paste(temp, (center.getX(), center.getY()), temp)