@clipen/clipen-cli 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -48
- package/apps/web/dist/assets/{index-D5D2HiB1.js → index-DPHwA954.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/bin/clipen.js +1 -1
- package/package.json +7 -6
- package/pyproject.toml +18 -2
- package/requirements/dev.txt +2 -0
- package/src/clipen/__init__.py +1 -1
- package/src/clipen/analysis/__init__.py +7 -7
- package/src/clipen/analysis/artifacts.py +4 -10
- package/src/clipen/analysis/audio.py +10 -8
- package/src/clipen/analysis/evidence_service.py +345 -167
- package/src/clipen/analysis/image_similarity.py +5 -14
- package/src/clipen/analysis/keyframes.py +5 -17
- package/src/clipen/analysis/models.py +5 -7
- package/src/clipen/analysis/qwen_worker.py +19 -54
- package/src/clipen/analysis/resources.py +2 -1
- package/src/clipen/analysis/runtime.py +1 -3
- package/src/clipen/analysis/service.py +16 -48
- package/src/clipen/analysis/setup.py +11 -25
- package/src/clipen/analysis/setup_cli.py +5 -15
- package/src/clipen/analysis/storage.py +96 -278
- package/src/clipen/analysis/transcription.py +40 -82
- package/src/clipen/analysis/visual.py +109 -48
- package/src/clipen/annotations/__init__.py +5 -2
- package/src/clipen/annotations/models.py +1 -1
- package/src/clipen/annotations/storage.py +132 -84
- package/src/clipen/annotations/suggestions.py +3 -8
- package/src/clipen/asr_release.py +4 -11
- package/src/clipen/bootstrap.py +71 -61
- package/src/clipen/{planning/models.py → candidates.py} +29 -47
- package/src/clipen/cli.py +4 -9
- package/src/clipen/controller/app.py +401 -214
- package/src/clipen/controller/server.py +28 -38
- package/src/clipen/domain/__init__.py +1 -1
- package/src/clipen/domain/media_time.py +3 -10
- package/src/clipen/domain/timeline.py +45 -47
- package/src/clipen/domain/validation.py +0 -1
- package/src/clipen/editing/__init__.py +1 -1
- package/src/clipen/editing/agent_models.py +4 -11
- package/src/clipen/editing/agent_repository.py +393 -172
- package/src/clipen/editing/agent_tools.py +180 -99
- package/src/clipen/editing/alignment.py +92 -52
- package/src/clipen/editing/alignment_setup.py +118 -70
- package/src/clipen/editing/alignment_worker.py +11 -9
- package/src/clipen/editing/change_report.py +95 -38
- package/src/clipen/editing/compiler.py +0 -1
- package/src/clipen/editing/component_looks.py +58 -34
- package/src/clipen/editing/component_review.py +34 -38
- package/src/clipen/editing/coordinator.py +213 -92
- package/src/clipen/editing/editorial_review.py +217 -95
- package/src/clipen/editing/evidence_jobs.py +457 -200
- package/src/clipen/editing/history_changes.py +129 -68
- package/src/clipen/editing/music_choices.py +8 -5
- package/src/clipen/editing/production_catalog.py +573 -136
- package/src/clipen/editing/production_limits.py +43 -17
- package/src/clipen/editing/production_media.py +376 -167
- package/src/clipen/editing/production_preview.py +322 -129
- package/src/clipen/editing/production_progress.py +164 -69
- package/src/clipen/editing/production_requirements.py +106 -39
- package/src/clipen/editing/production_tools.py +1064 -462
- package/src/clipen/editing/program_audio.py +211 -81
- package/src/clipen/editing/program_direction.py +59 -25
- package/src/clipen/editing/program_story.py +83 -45
- package/src/clipen/editing/program_subtitles.py +194 -96
- package/src/clipen/editing/programme_review.py +98 -50
- package/src/clipen/editing/prompt_history.py +64 -27
- package/src/clipen/editing/recut.py +65 -25
- package/src/clipen/editing/refinement_references.py +176 -86
- package/src/clipen/editing/resolve_export.py +449 -218
- package/src/clipen/editing/resolve_titles.py +162 -105
- package/src/clipen/editing/skill_tools.py +530 -154
- package/src/clipen/editing/source_dialogue.py +177 -67
- package/src/clipen/editing/speech_coverage.py +42 -22
- package/src/clipen/editing/speech_quality.py +6 -1
- package/src/clipen/editing/tool_receipts.py +78 -32
- package/src/clipen/editing/versions.py +122 -64
- package/src/clipen/editing/visual_preview.py +157 -61
- package/src/clipen/editing/workbench.py +104 -42
- package/src/clipen/finishing/audio.py +69 -30
- package/src/clipen/finishing/catalog.py +176 -93
- package/src/clipen/finishing/models.py +1 -1
- package/src/clipen/finishing/renderer.py +33 -14
- package/src/clipen/mcp_editing/__main__.py +3 -1
- package/src/clipen/mcp_editing/server.py +77 -34
- package/src/clipen/media/__init__.py +3 -3
- package/src/clipen/media/discovery.py +7 -20
- package/src/clipen/media/models.py +7 -18
- package/src/clipen/media/preview.py +14 -24
- package/src/clipen/media/probe.py +16 -44
- package/src/clipen/media/service.py +6 -19
- package/src/clipen/media/storage.py +33 -81
- package/src/clipen/music_vocabulary.py +33 -4
- package/src/clipen/power.py +8 -3
- package/src/clipen/projects/__init__.py +1 -1
- package/src/clipen/projects/deletion.py +19 -32
- package/src/clipen/projects/finishing_schema.py +3 -1
- package/src/clipen/projects/models.py +2 -5
- package/src/clipen/projects/picker.py +13 -37
- package/src/clipen/projects/service.py +8 -24
- package/src/clipen/projects/storage.py +226 -246
- package/src/clipen/provider_registry.py +9 -20
- package/src/clipen/providers/account.py +86 -35
- package/src/clipen/providers/claude.py +59 -25
- package/src/clipen/providers/claude_editing.py +14 -7
- package/src/clipen/providers/codex.py +73 -118
- package/src/clipen/providers/codex_editing.py +2 -2
- package/src/clipen/providers/editing_agent.py +19 -17
- package/src/clipen/providers/recovery.py +7 -8
- package/src/clipen/rendering/cover.py +18 -5
- package/src/clipen/rendering/custom_components.py +167 -79
- package/src/clipen/rendering/custom_render.py +62 -41
- package/src/clipen/rendering/production_effects.py +77 -45
- package/src/clipen/rendering/program_components.py +134 -73
- package/src/clipen/rendering/program_creator.py +432 -277
- package/src/clipen/rendering/program_identities.py +277 -182
- package/src/clipen/rendering/program_motion.py +140 -95
- package/src/clipen/rendering/program_studio.py +175 -116
- package/src/clipen/rendering/program_styles.py +231 -145
- package/src/clipen/rendering/program_subtitles.py +71 -34
- package/src/clipen/rendering/renderer.py +150 -121
- package/src/clipen/rendering/storage.py +9 -22
- package/src/clipen/rendering/titles.py +193 -86
- package/src/clipen/skills/__init__.py +1 -0
- package/src/clipen/skills/catalog.py +151 -55
- package/src/clipen/skills/library.py +13 -7
- package/src/clipen/skills/package.py +46 -23
- package/src/clipen/skills/visual_styles.py +29 -18
- package/src/clipen/workspace.py +15 -44
- package/install +0 -25
- package/src/clipen/planning/__init__.py +0 -9
- package/uninstall +0 -25
|
@@ -3,166 +3,225 @@
|
|
|
3
3
|
All decoration and motion stays inside the measured component footprint. This is
|
|
4
4
|
procedural artwork, so no remote assets, invented source facts or raster scaling.
|
|
5
5
|
"""
|
|
6
|
+
|
|
6
7
|
import math
|
|
7
8
|
|
|
9
|
+
from .program_styles import draw_style_text, load_style_font, styled_text_length, type_outline
|
|
8
10
|
from .titles import TitleRenderError
|
|
9
|
-
from .program_styles import load_style_font, styled_text_length, draw_style_text, type_outline
|
|
10
11
|
|
|
11
|
-
HERO = {
|
|
12
|
+
HERO = {"program_title", "headline", "impact", "chapter", "burst"}
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
def title_lines(value):
|
|
15
|
-
if
|
|
16
|
-
return tuple(value.split(
|
|
16
|
+
if "・" in value:
|
|
17
|
+
return tuple(value.split("・", 1))
|
|
17
18
|
if len(value) > 3:
|
|
18
|
-
middle = (len(value)+1)//2
|
|
19
|
+
middle = (len(value) + 1) // 2
|
|
19
20
|
return value[:middle], value[middle:]
|
|
20
21
|
return (value,)
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
def layout(draw, font_path, timeline, item, profile):
|
|
24
|
-
kind = profile[
|
|
25
|
+
kind = profile["component_id"]
|
|
25
26
|
hero = kind in HERO
|
|
26
27
|
w, h = timeline.width, timeline.height
|
|
27
|
-
x, y = round(w*profile[
|
|
28
|
-
primary, _, detail = item.text.partition(
|
|
29
|
-
split = kind ==
|
|
28
|
+
x, y = round(w * profile["x"]), round(h * profile["y"])
|
|
29
|
+
primary, _, detail = item.text.partition("\n")
|
|
30
|
+
split = kind == "program_title"
|
|
30
31
|
lines = title_lines(primary) if split else (primary,)
|
|
31
|
-
scale = .108 if split else .091 if hero else .061 if kind ==
|
|
32
|
-
pad = max(8, round(h
|
|
33
|
-
limit = min(w*(.83 if hero else .58), w
|
|
34
|
-
minimum = max(14, round(h*scale
|
|
35
|
-
size = max(14, round(h*scale))
|
|
36
|
-
small = load_style_font(font_path, max(12, round(h
|
|
32
|
+
scale = 0.108 if split else 0.091 if hero else 0.061 if kind == "reaction" else 0.040
|
|
33
|
+
pad = max(8, round(h * 0.022))
|
|
34
|
+
limit = min(w * (0.83 if hero else 0.58), w * 0.945 - x)
|
|
35
|
+
minimum = max(14, round(h * scale * 0.70))
|
|
36
|
+
size = max(14, round(h * scale))
|
|
37
|
+
small = load_style_font(font_path, max(12, round(h * 0.024)), profile, role="detail")
|
|
37
38
|
# Reserve a separate column for a rosette; artwork never covers title type.
|
|
38
|
-
ornament = h
|
|
39
|
+
ornament = h * 0.13 if split else pad * 2
|
|
39
40
|
while True:
|
|
40
41
|
font = load_style_font(font_path, size, profile)
|
|
41
42
|
text_width = max(styled_text_length(line, font) for line in lines)
|
|
42
|
-
width = max(
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
width = max(
|
|
44
|
+
text_width + pad * 4 + ornament,
|
|
45
|
+
styled_text_length(detail, small) + pad * 4 if detail else 0,
|
|
46
|
+
w * (0.39 if split else 0.19 if hero else 0.13),
|
|
47
|
+
)
|
|
45
48
|
if width <= limit or size <= minimum:
|
|
46
49
|
break
|
|
47
50
|
size -= 1
|
|
48
|
-
height = round(size*len(lines)*1.18+pad*3+(small.size*1.35 if detail else 0))
|
|
51
|
+
height = round(size * len(lines) * 1.18 + pad * 3 + (small.size * 1.35 if detail else 0))
|
|
49
52
|
if split:
|
|
50
|
-
height += round(pad
|
|
51
|
-
if width > limit or y+height > h
|
|
52
|
-
raise TitleRenderError(
|
|
53
|
-
return (x,y,x+math.ceil(width),y+height), font, pad
|
|
53
|
+
height += round(pad * 0.5)
|
|
54
|
+
if width > limit or y + height > h * 0.77:
|
|
55
|
+
raise TitleRenderError("program_component_overflow")
|
|
56
|
+
return (x, y, x + math.ceil(width), y + height), font, pad
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
def draw_graphic(draw, font_path, timeline, item, profile, bounds, font, pad, relative_frame=None):
|
|
57
|
-
kind = profile[
|
|
60
|
+
kind = profile["component_id"]
|
|
58
61
|
hero = kind in HERO
|
|
59
|
-
appearance = profile[
|
|
60
|
-
motion = profile[
|
|
61
|
-
entry = appearance[
|
|
62
|
-
end = appearance[
|
|
62
|
+
appearance = profile["presets"]["appearance"]
|
|
63
|
+
motion = profile["presets"]["motion"]
|
|
64
|
+
entry = appearance["hero_entry_frames"] if hero else motion["entry_frames"]
|
|
65
|
+
end = appearance["hero_exit_frames"] if hero else motion["exit_frames"]
|
|
63
66
|
relative = entry if relative_frame is None else relative_frame
|
|
64
|
-
p = min(1
|
|
65
|
-
exit_progress = min(1
|
|
66
|
-
alpha = min(1
|
|
67
|
-
ease = 1-(1-p)**3
|
|
68
|
-
x,y,right,bottom = bounds
|
|
69
|
-
width,height = right-x,bottom-y
|
|
70
|
-
primary,_,detail = item.text.partition(
|
|
71
|
-
palette = profile[
|
|
72
|
-
stroke = max(1, round(timeline.height
|
|
73
|
-
small = load_style_font(font_path,max(12,round(timeline.height
|
|
74
|
-
micro = load_style_font(font_path,max(9,round(timeline.height
|
|
67
|
+
p = min(1.0, max(0.0, (relative + 1) / entry))
|
|
68
|
+
exit_progress = min(1.0, max(0.0, (item.duration_frames - relative) / end))
|
|
69
|
+
alpha = min(1.0, p * 3, exit_progress)
|
|
70
|
+
ease = 1 - (1 - p) ** 3
|
|
71
|
+
x, y, right, bottom = bounds
|
|
72
|
+
width, height = right - x, bottom - y
|
|
73
|
+
primary, _, detail = item.text.partition("\n")
|
|
74
|
+
palette = profile["presets"]["palette"]
|
|
75
|
+
stroke = max(1, round(timeline.height * 0.0025))
|
|
76
|
+
small = load_style_font(font_path, max(12, round(timeline.height * 0.024)), profile, role="detail")
|
|
77
|
+
micro = load_style_font(font_path, max(9, round(timeline.height * 0.017)), profile, role="detail")
|
|
75
78
|
|
|
76
79
|
def color(name, opacity=1):
|
|
77
|
-
r,g,b,a = palette[name]
|
|
78
|
-
return r,g,b,round(a*alpha*opacity)
|
|
80
|
+
r, g, b, a = palette[name]
|
|
81
|
+
return r, g, b, round(a * alpha * opacity)
|
|
79
82
|
|
|
80
|
-
def text(pos, value, selected=font, fill=
|
|
81
|
-
draw_style_text(
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
def text(pos, value, selected=font, fill="paper", outline=False):
|
|
84
|
+
draw_style_text(
|
|
85
|
+
draw,
|
|
86
|
+
pos,
|
|
87
|
+
value,
|
|
88
|
+
selected,
|
|
89
|
+
color(fill),
|
|
90
|
+
type_outline(profile, selected, stroke * 3) if outline else 0,
|
|
91
|
+
color("ink"),
|
|
92
|
+
)
|
|
93
|
+
if selected is font and not profile["presets"].get("font_roles"):
|
|
94
|
+
draw_style_text(draw, pos, value, selected, color(fill), max(1, stroke), color(fill))
|
|
84
95
|
|
|
85
|
-
def rosette(cx, cy, radius, fill=
|
|
86
|
-
points=[]
|
|
96
|
+
def rosette(cx, cy, radius, fill="accent"):
|
|
97
|
+
points = []
|
|
87
98
|
for n in range(32):
|
|
88
|
-
angle=math.tau*n/32
|
|
89
|
-
r=radius*(1 if n%2==0 else .76)*(.65
|
|
90
|
-
points.append((cx+math.cos(angle)*r,cy+math.sin(angle)*r))
|
|
91
|
-
draw.polygon(points,fill=color(fill))
|
|
99
|
+
angle = math.tau * n / 32 - 0.18 * (1 - ease)
|
|
100
|
+
r = radius * (1 if n % 2 == 0 else 0.76) * (0.65 + 0.35 * ease)
|
|
101
|
+
points.append((cx + math.cos(angle) * r, cy + math.sin(angle) * r))
|
|
102
|
+
draw.polygon(points, fill=color(fill))
|
|
92
103
|
# Original four-point cutout inside the print rosette.
|
|
93
|
-
r=radius
|
|
94
|
-
draw.polygon(
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
r = radius * 0.40
|
|
105
|
+
draw.polygon(
|
|
106
|
+
[
|
|
107
|
+
(cx, cy - r),
|
|
108
|
+
(cx + r * 0.22, cy - r * 0.22),
|
|
109
|
+
(cx + r, cy),
|
|
110
|
+
(cx + r * 0.22, cy + r * 0.22),
|
|
111
|
+
(cx, cy + r),
|
|
112
|
+
(cx - r * 0.22, cy + r * 0.22),
|
|
113
|
+
(cx - r, cy),
|
|
114
|
+
(cx - r * 0.22, cy - r * 0.22),
|
|
115
|
+
],
|
|
116
|
+
fill=color("paper"),
|
|
117
|
+
)
|
|
97
118
|
|
|
98
|
-
if kind ==
|
|
119
|
+
if kind == "program_title":
|
|
99
120
|
# Open typographic lockup with staggered rows, a registration rail and
|
|
100
121
|
# a separate decorative seal. No enclosing title rectangle.
|
|
101
|
-
rail=x+pad
|
|
102
|
-
draw.line((rail,y+pad,rail,y+height*ease-pad),fill=color(
|
|
103
|
-
for dy in (pad,height
|
|
104
|
-
draw.line((rail-stroke*2,y+dy,rail+stroke*2,y+dy),fill=color(
|
|
105
|
-
badge_x=x+pad*1.2
|
|
106
|
-
badge_w=micro.getlength(
|
|
107
|
-
draw.rounded_rectangle(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
rail = x + pad * 0.25
|
|
123
|
+
draw.line((rail, y + pad, rail, y + height * ease - pad), fill=color("paper"), width=stroke)
|
|
124
|
+
for dy in (pad, height * 0.49, height - pad):
|
|
125
|
+
draw.line((rail - stroke * 2, y + dy, rail + stroke * 2, y + dy), fill=color("paper"), width=stroke)
|
|
126
|
+
badge_x = x + pad * 1.2
|
|
127
|
+
badge_w = micro.getlength("FIELD NOTES") + pad * 1.8
|
|
128
|
+
draw.rounded_rectangle(
|
|
129
|
+
(badge_x, y + pad * 0.2, badge_x + badge_w, y + pad * 1.35), radius=pad * 0.55, fill=color("accent")
|
|
130
|
+
)
|
|
131
|
+
text((badge_x + pad * 0.9, y + pad * 0.40), "FIELD NOTES", micro, "ink")
|
|
132
|
+
lines = title_lines(primary)
|
|
133
|
+
ty = y + pad * 1.9
|
|
134
|
+
for n, line in enumerate(lines):
|
|
135
|
+
phase = min(1.0, max(0.0, p * 1.65 - n * 0.35))
|
|
136
|
+
if not phase:
|
|
137
|
+
continue
|
|
138
|
+
shift = (1 - phase) ** 3 * pad
|
|
139
|
+
tx = x + pad * (1.2 + n * 0.7) + shift
|
|
140
|
+
yy = ty + n * font.size * 1.18
|
|
141
|
+
shadow = stroke if profile["presets"].get("font_roles") else stroke * 2
|
|
142
|
+
text((tx + shadow, yy + shadow), line, fill="ink", outline=True)
|
|
143
|
+
text((tx, yy), line, outline=True)
|
|
144
|
+
r = min(timeline.height * 0.055, height * 0.19)
|
|
145
|
+
rosette(right - r - pad * 0.6, y + pad * 2 + r, r)
|
|
146
|
+
underline_y = ty + font.size * len(lines) * 1.18 + pad * 0.12
|
|
147
|
+
length = max(styled_text_length(line, font) for line in lines)
|
|
148
|
+
draw.line(
|
|
149
|
+
[
|
|
150
|
+
(x + pad * 1.4, underline_y),
|
|
151
|
+
(x + pad + length * ease, underline_y - pad * 0.3),
|
|
152
|
+
(x + pad + length * ease, underline_y + stroke * 2),
|
|
153
|
+
],
|
|
154
|
+
fill=color("accent"),
|
|
155
|
+
width=stroke * 3,
|
|
156
|
+
)
|
|
157
|
+
elif kind in {"impact", "reaction", "burst"}:
|
|
127
158
|
# A cut-paper sticker with offset ink edge and an asymmetrical silhouette.
|
|
128
|
-
top=y+pad
|
|
129
|
-
points=[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
159
|
+
top = y + pad * 0.7
|
|
160
|
+
points = [
|
|
161
|
+
(x + pad, top),
|
|
162
|
+
(right - pad * 2, y + pad * 0.2),
|
|
163
|
+
(right - pad * 0.3, top + pad),
|
|
164
|
+
(right - pad, bottom - pad * 0.65),
|
|
165
|
+
(x + pad * 0.5, bottom - pad * 0.3),
|
|
166
|
+
(x + pad * 0.15, top + pad),
|
|
167
|
+
]
|
|
168
|
+
draw.polygon([(a + stroke * 2, b + stroke * 2) for a, b in points], fill=color("ink"))
|
|
169
|
+
draw.polygon(points, fill=color("accent"), outline=color("paper"), width=stroke * 2)
|
|
170
|
+
if kind == "burst":
|
|
171
|
+
rosette(right - pad * 1.25, y + pad * 1.25, pad * 0.8, "secondary")
|
|
172
|
+
if p > 0.18:
|
|
173
|
+
text((x + pad * 1.3, y + pad * 1.3 + (1 - ease) * pad * 0.5), primary, fill="ink")
|
|
137
174
|
for n in range(3):
|
|
138
|
-
xx=x+pad*(1.2+n
|
|
139
|
-
draw.line((xx,y+pad
|
|
140
|
-
elif kind ==
|
|
175
|
+
xx = x + pad * (1.2 + n * 0.5)
|
|
176
|
+
draw.line((xx, y + pad * 0.5, xx + pad * 0.2, y + pad * 0.1), fill=color("paper"), width=stroke)
|
|
177
|
+
elif kind == "chapter":
|
|
141
178
|
# A coloured tab and open ruled heading, without a full panel.
|
|
142
|
-
tab_width=styled_text_length(
|
|
143
|
-
draw.rounded_rectangle(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
179
|
+
tab_width = styled_text_length("CHAPTER", micro) + pad * 1.2
|
|
180
|
+
draw.rounded_rectangle(
|
|
181
|
+
(x + pad * 0.3, y + pad * 0.2, x + pad * 0.3 + tab_width, y + pad * 1.35),
|
|
182
|
+
radius=pad * 0.2,
|
|
183
|
+
fill=color("accent"),
|
|
184
|
+
)
|
|
185
|
+
text((x + pad * 0.6, y + pad * 0.35), "CHAPTER", micro, "ink")
|
|
186
|
+
text((x + pad, y + pad * 1.9 + (1 - ease) * pad), primary, outline=True)
|
|
187
|
+
draw.line(
|
|
188
|
+
(x + pad, bottom - pad * 0.5, x + pad + (width - pad * 2) * ease, bottom - pad * 0.5),
|
|
189
|
+
fill=color("paper"),
|
|
190
|
+
width=stroke * 2,
|
|
191
|
+
)
|
|
147
192
|
else:
|
|
148
193
|
# Ticket shape: clipped corners, perforation line, coloured folded tab.
|
|
149
|
-
notch=pad
|
|
150
|
-
bx,by,br,bb=x+pad
|
|
151
|
-
draw.polygon(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
194
|
+
notch = pad * 0.4
|
|
195
|
+
bx, by, br, bb = x + pad * 0.15, y + pad * 0.2, right - pad * 0.2, bottom - pad * 0.2
|
|
196
|
+
draw.polygon(
|
|
197
|
+
[
|
|
198
|
+
(bx + notch, by),
|
|
199
|
+
(br - notch, by),
|
|
200
|
+
(br, by + notch),
|
|
201
|
+
(br, bb - notch),
|
|
202
|
+
(br - notch, bb),
|
|
203
|
+
(bx + notch, bb),
|
|
204
|
+
(bx, bb - notch),
|
|
205
|
+
(bx, by + notch),
|
|
206
|
+
],
|
|
207
|
+
fill=color("paper"),
|
|
208
|
+
)
|
|
209
|
+
draw.polygon([(bx, by), (bx + pad * 0.9, by), (bx, by + pad * 0.9)], fill=color("accent"))
|
|
210
|
+
for yy in range(round(by + pad * 0.5), round(bb - pad * 0.3), max(3, stroke * 4)):
|
|
211
|
+
draw.line((br - pad * 0.65, yy, br - pad * 0.65, yy + stroke), fill=color("secondary"), width=stroke)
|
|
212
|
+
text((bx + pad, y + pad * 0.85 + (1 - ease) * pad * 0.2), primary, fill="ink")
|
|
213
|
+
draw.line(
|
|
214
|
+
(bx + pad, bb - pad * 0.35, bx + pad + (width - pad * 3) * ease, bb - pad * 0.35),
|
|
215
|
+
fill=color("accent"),
|
|
216
|
+
width=stroke * 2,
|
|
217
|
+
)
|
|
159
218
|
if detail:
|
|
160
219
|
# Secondary line is reserved below the primary composition.
|
|
161
|
-
ty=bottom-small.size-pad
|
|
162
|
-
if kind in {
|
|
163
|
-
tw=styled_text_length(detail,small)
|
|
164
|
-
draw.rectangle((x+pad,ty-pad
|
|
165
|
-
text((x+pad*1.5,ty),detail,small)
|
|
220
|
+
ty = bottom - small.size - pad * 0.7
|
|
221
|
+
if kind in {"program_title", "chapter"}:
|
|
222
|
+
tw = styled_text_length(detail, small)
|
|
223
|
+
draw.rectangle((x + pad, ty - pad * 0.25, x + pad * 2 + tw, bottom - pad * 0.35), fill=color("ink"))
|
|
224
|
+
text((x + pad * 1.5, ty), detail, small)
|
|
166
225
|
else:
|
|
167
|
-
text((x+pad*1.3,ty),detail,small,
|
|
226
|
+
text((x + pad * 1.3, ty), detail, small, "ink")
|
|
168
227
|
return bounds
|