This commit is contained in:
jinye_huang 2025-08-05 00:36:22 +08:00
parent 27c2170239
commit d352f347b0
4 changed files with 349 additions and 18 deletions

View File

@ -147,7 +147,7 @@ class VibrantTemplate(BaseTemplate):
canvas = self._create_composite_image(main_image, gradient_start, theme_color)
canvas = self._render_texts(canvas, content, gradient_start)
return canvas
def _get_default_content(self) -> Dict[str, Any]:
@ -1314,7 +1314,6 @@ class VibrantTemplate(BaseTemplate):
"""使用统一布局参数渲染PNG"""
canvas = self._create_composite_image(main_image, gradient_start, theme_color)
canvas = self._render_texts(canvas, content, gradient_start)
return {
"image": canvas,
"layout_params": layout_params,
@ -1462,7 +1461,11 @@ class VibrantTemplate(BaseTemplate):
"scaleX": 1,
"scaleY": 1,
"stroke": "rgba(0, 30, 80, 0.8)",
"strokeWidth": 3,
"strokeWidth": 4,
"strokeDashArray": [],
"strokeLineCap": "butt",
"strokeLineJoin": "miter",
"strokeMiterLimit": 4,
"paintFirst": "stroke"
}
text_objects.append(title_obj)
@ -1587,7 +1590,7 @@ class VibrantTemplate(BaseTemplate):
if layout_params["price_text"]:
price_x = layout_params["right_margin"] - layout_params["price_width"] - 60 # 给CNY起留空间
price_obj = {
"type": "textbox",
"type": "textbox",
"left": price_x,
"top": layout_params["content_start_y"],
"width": layout_params["price_width"],
@ -1595,14 +1598,14 @@ class VibrantTemplate(BaseTemplate):
"text": layout_params["price_text"],
"fontSize": layout_params["price_size"],
"fontFamily": "兰亭粗黑简",
"fontWeight": "bold",
"fill": "white",
"fontWeight": "bold",
"fill": "white",
"textAlign": "right",
"lineHeight": 1.0,
"opacity": 1,
"angle": 0,
"scaleX": 1,
"scaleY": 1,
"opacity": 1,
"angle": 0,
"scaleX": 1,
"scaleY": 1,
"shadow": {
"color": "rgba(0, 0, 0, 0.5)",
"blur": 2,
@ -1657,7 +1660,7 @@ class VibrantTemplate(BaseTemplate):
if layout_params["ticket_text"]:
ticket_x = layout_params["right_margin"] - layout_params["ticket_width"]
ticket_obj = {
"type": "textbox",
"type": "textbox",
"left": ticket_x,
"top": layout_params["content_start_y"] + 115,
"width": layout_params["ticket_width"],
@ -1665,14 +1668,14 @@ class VibrantTemplate(BaseTemplate):
"text": layout_params["ticket_text"],
"fontSize": layout_params["ticket_size"],
"fontFamily": "兰亭粗黑简",
"fontWeight": "bold",
"fontWeight": "bold",
"fill": "white",
"textAlign": "right",
"lineHeight": 1.0,
"opacity": 1,
"angle": 0,
"scaleX": 1,
"scaleY": 1,
"opacity": 1,
"angle": 0,
"scaleX": 1,
"scaleY": 1,
"shadow": {
"color": "rgba(0, 0, 0, 0.5)",
"blur": 2,
@ -1712,10 +1715,10 @@ class VibrantTemplate(BaseTemplate):
tag_obj = {
"type": "textbox",
"left": layout_params["left_margin"],
"top": footer_y,
"top": footer_y,
"width": 200,
"height": 25,
"text": tag,
"text": tag,
"fontSize": 27,
"fontFamily": "兰亭粗黑简",
"fill": "white",

BIN
test_stroke_final_png.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

File diff suppressed because one or more lines are too long