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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
# Copyright (c) 2010-2024 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
String,
Set,
Bool,
Integer,
Float,
)
from .colors import ColorChoice
class TintEffect(Serialisable):
tagname = "tint"
hue = Integer()
amt = Integer()
def __init__(self,
hue=0,
amt=0,
):
self.hue = hue
self.amt = amt
class LuminanceEffect(Serialisable):
tagname = "lum"
bright = Integer() #Pct ?
contrast = Integer() #Pct#
def __init__(self,
bright=0,
contrast=0,
):
self.bright = bright
self.contrast = contrast
class HSLEffect(Serialisable):
hue = Integer()
sat = Integer()
lum = Integer()
def __init__(self,
hue=None,
sat=None,
lum=None,
):
self.hue = hue
self.sat = sat
self.lum = lum
class GrayscaleEffect(Serialisable):
tagname = "grayscl"
class FillOverlayEffect(Serialisable):
blend = Set(values=(['over', 'mult', 'screen', 'darken', 'lighten']))
def __init__(self,
blend=None,
):
self.blend = blend
class DuotoneEffect(Serialisable):
pass
class ColorReplaceEffect(Serialisable):
pass
class Color(Serialisable):
pass
class ColorChangeEffect(Serialisable):
useA = Bool(allow_none=True)
clrFrom = Typed(expected_type=Color, )
clrTo = Typed(expected_type=Color, )
def __init__(self,
useA=None,
clrFrom=None,
clrTo=None,
):
self.useA = useA
self.clrFrom = clrFrom
self.clrTo = clrTo
class BlurEffect(Serialisable):
rad = Float()
grow = Bool(allow_none=True)
def __init__(self,
rad=None,
grow=None,
):
self.rad = rad
self.grow = grow
class BiLevelEffect(Serialisable):
thresh = Integer()
def __init__(self,
thresh=None,
):
self.thresh = thresh
class AlphaReplaceEffect(Serialisable):
a = Integer()
def __init__(self,
a=None,
):
self.a = a
class AlphaModulateFixedEffect(Serialisable):
amt = Integer()
def __init__(self,
amt=None,
):
self.amt = amt
class EffectContainer(Serialisable):
type = Set(values=(['sib', 'tree']))
name = String(allow_none=True)
def __init__(self,
type=None,
name=None,
):
self.type = type
self.name = name
class AlphaModulateEffect(Serialisable):
cont = Typed(expected_type=EffectContainer, )
def __init__(self,
cont=None,
):
self.cont = cont
class AlphaInverseEffect(Serialisable):
pass
class AlphaFloorEffect(Serialisable):
pass
class AlphaCeilingEffect(Serialisable):
pass
class AlphaBiLevelEffect(Serialisable):
thresh = Integer()
def __init__(self,
thresh=None,
):
self.thresh = thresh
class GlowEffect(ColorChoice):
rad = Float()
# uses element group EG_ColorChoice
scrgbClr = ColorChoice.scrgbClr
srgbClr = ColorChoice.srgbClr
hslClr = ColorChoice.hslClr
sysClr = ColorChoice.sysClr
schemeClr = ColorChoice.schemeClr
prstClr = ColorChoice.prstClr
__elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
def __init__(self,
rad=None,
**kw
):
self.rad = rad
super().__init__(**kw)
class InnerShadowEffect(ColorChoice):
blurRad = Float()
dist = Float()
dir = Integer()
# uses element group EG_ColorChoice
scrgbClr = ColorChoice.scrgbClr
srgbClr = ColorChoice.srgbClr
hslClr = ColorChoice.hslClr
sysClr = ColorChoice.sysClr
schemeClr = ColorChoice.schemeClr
prstClr = ColorChoice.prstClr
__elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
def __init__(self,
blurRad=None,
dist=None,
dir=None,
**kw
):
self.blurRad = blurRad
self.dist = dist
self.dir = dir
super().__init__(**kw)
class OuterShadow(ColorChoice):
tagname = "outerShdw"
blurRad = Float(allow_none=True)
dist = Float(allow_none=True)
dir = Integer(allow_none=True)
sx = Integer(allow_none=True)
sy = Integer(allow_none=True)
kx = Integer(allow_none=True)
ky = Integer(allow_none=True)
algn = Set(values=['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br'])
rotWithShape = Bool(allow_none=True)
# uses element group EG_ColorChoice
scrgbClr = ColorChoice.scrgbClr
srgbClr = ColorChoice.srgbClr
hslClr = ColorChoice.hslClr
sysClr = ColorChoice.sysClr
schemeClr = ColorChoice.schemeClr
prstClr = ColorChoice.prstClr
__elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
def __init__(self,
blurRad=None,
dist=None,
dir=None,
sx=None,
sy=None,
kx=None,
ky=None,
algn=None,
rotWithShape=None,
**kw
):
self.blurRad = blurRad
self.dist = dist
self.dir = dir
self.sx = sx
self.sy = sy
self.kx = kx
self.ky = ky
self.algn = algn
self.rotWithShape = rotWithShape
super().__init__(**kw)
class PresetShadowEffect(ColorChoice):
prst = Set(values=(['shdw1', 'shdw2', 'shdw3', 'shdw4', 'shdw5', 'shdw6',
'shdw7', 'shdw8', 'shdw9', 'shdw10', 'shdw11', 'shdw12', 'shdw13',
'shdw14', 'shdw15', 'shdw16', 'shdw17', 'shdw18', 'shdw19', 'shdw20']))
dist = Float()
dir = Integer()
# uses element group EG_ColorChoice
scrgbClr = ColorChoice.scrgbClr
srgbClr = ColorChoice.srgbClr
hslClr = ColorChoice.hslClr
sysClr = ColorChoice.sysClr
schemeClr = ColorChoice.schemeClr
prstClr = ColorChoice.prstClr
__elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
def __init__(self,
prst=None,
dist=None,
dir=None,
**kw
):
self.prst = prst
self.dist = dist
self.dir = dir
super().__init__(**kw)
class ReflectionEffect(Serialisable):
blurRad = Float()
stA = Integer()
stPos = Integer()
endA = Integer()
endPos = Integer()
dist = Float()
dir = Integer()
fadeDir = Integer()
sx = Integer()
sy = Integer()
kx = Integer()
ky = Integer()
algn = Set(values=(['tl', 't', 'tr', 'l', 'ctr', 'r', 'bl', 'b', 'br']))
rotWithShape = Bool(allow_none=True)
def __init__(self,
blurRad=None,
stA=None,
stPos=None,
endA=None,
endPos=None,
dist=None,
dir=None,
fadeDir=None,
sx=None,
sy=None,
kx=None,
ky=None,
algn=None,
rotWithShape=None,
):
self.blurRad = blurRad
self.stA = stA
self.stPos = stPos
self.endA = endA
self.endPos = endPos
self.dist = dist
self.dir = dir
self.fadeDir = fadeDir
self.sx = sx
self.sy = sy
self.kx = kx
self.ky = ky
self.algn = algn
self.rotWithShape = rotWithShape
class SoftEdgesEffect(Serialisable):
rad = Float()
def __init__(self,
rad=None,
):
self.rad = rad
class EffectList(Serialisable):
blur = Typed(expected_type=BlurEffect, allow_none=True)
fillOverlay = Typed(expected_type=FillOverlayEffect, allow_none=True)
glow = Typed(expected_type=GlowEffect, allow_none=True)
innerShdw = Typed(expected_type=InnerShadowEffect, allow_none=True)
outerShdw = Typed(expected_type=OuterShadow, allow_none=True)
prstShdw = Typed(expected_type=PresetShadowEffect, allow_none=True)
reflection = Typed(expected_type=ReflectionEffect, allow_none=True)
softEdge = Typed(expected_type=SoftEdgesEffect, allow_none=True)
__elements__ = ('blur', 'fillOverlay', 'glow', 'innerShdw', 'outerShdw',
'prstShdw', 'reflection', 'softEdge')
def __init__(self,
blur=None,
fillOverlay=None,
glow=None,
innerShdw=None,
outerShdw=None,
prstShdw=None,
reflection=None,
softEdge=None,
):
self.blur = blur
self.fillOverlay = fillOverlay
self.glow = glow
self.innerShdw = innerShdw
self.outerShdw = outerShdw
self.prstShdw = prstShdw
self.reflection = reflection
self.softEdge = softEdge
|