def create(self, stats=conf.IMAGE_STATS):
if self.time_of_day > 1:
bg = resource_stream('monocle', 'static/monocle-icons/assets/notification-bg-night.png')
else:
bg = resource_stream('monocle', 'static/monocle-icons/assets/notification-bg-day.png')
ims = cairo.ImageSurface.create_from_png(bg)
self.context = cairo.Context(ims)
pokepic = resource_stream('monocle', 'static/monocle-icons/original-icons/{}.png'.format(self.pokemon_id))
if stats:
self.draw_stats()
self.draw_image(pokepic, 204, 224)
self.draw_name(50 if stats else 120)
image = TemporaryFile(suffix='.png')
ims.write_to_png(image)
return image
评论列表
文章目录