-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolid.py
More file actions
38 lines (33 loc) · 973 Bytes
/
solid.py
File metadata and controls
38 lines (33 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
"""
This is a layer of a solid color (same nomenclature as Adobe AfterEffects)
"""
from imageTools import *
from smartimage.layer import *
class Solid(Layer):
"""
This is a layer of a solid color (same nomenclature as Adobe AfterEffects)
"""
def __init__(self,parent:Layer,xml:str):
Layer.__init__(self,parent,xml)
@property
def color(self):
"""
get the background color
"""
return strToColor(self._getProperty('color','#ff00ff'))
@color.setter
def color(self,color):
if not isinstance(color,str):
color=colorToStr(color)
self._setProperty('color',color)
@property
def image(self)->PilPlusImage:
"""
returns a new solid color image
"""
if self.w==0:
self.w=1
if self.h==0:
self.h=1
return PilPlusImage(Image.new('RGBA',(int(self.w),int(self.h)),tuple(self.color)))