diff --git a/api/services/poster.py b/api/services/poster.py index eef02a7..42bd67e 100644 --- a/api/services/poster.py +++ b/api/services/poster.py @@ -1040,7 +1040,7 @@ class PosterService: } def _create_gradient_background_object(self, canvas_width: int, canvas_height: int, gradient_start: int) -> Dict[str, Any]: - """创建模拟毛玻璃效果的渐变背景""" + """创建模拟毛玻璃效果的渐变背景(简化版本,提高兼容性)""" return { "type": "rect", "version": "5.3.0", @@ -1050,24 +1050,13 @@ class PosterService: "top": gradient_start, "width": canvas_width, "height": canvas_height - gradient_start, - "fill": { - "type": "linear", - "coords": { - "x1": 0, - "y1": 0, - "x2": 0, - "y2": canvas_height - gradient_start - }, - "colorStops": [ - {"offset": 0, "color": "rgba(0, 30, 80, 0.3)"}, - {"offset": 0.5, "color": "rgba(0, 50, 120, 0.6)"}, - {"offset": 1, "color": "rgba(0, 80, 160, 0.8)"} - ] - }, + "fill": "rgba(0, 50, 120, 0.6)", # 简化为单一颜色,提高兼容性 + "stroke": "", + "strokeWidth": 0, "angle": 0, "flipX": False, "flipY": False, - "opacity": 1, + "opacity": 0.8, "visible": True, "name": "glass_gradient", "data": { @@ -1101,8 +1090,8 @@ class PosterService: "width": content_width, "height": title_size + 20, "fill": "#ffffff", - "stroke": "rgba(0, 30, 80, 0.8)", - "strokeWidth": 2, + "stroke": "#001e50", + "strokeWidth": 2, "fontFamily": "Arial Black, sans-serif", "fontWeight": "bold", "fontSize": title_size, @@ -1135,12 +1124,7 @@ class PosterService: "width": content_width, "height": subtitle_size + 15, "fill": "#ffffff", - "shadow": { - "color": "rgba(0, 0, 0, 0.7)", - "blur": 5, - "offsetX": 2, - "offsetY": 2 - }, + "shadow": "rgba(0, 0, 0, 0.7) 2px 2px 5px", "fontFamily": "Arial, sans-serif", "fontWeight": "normal", "fontSize": subtitle_size, @@ -1296,12 +1280,7 @@ class PosterService: "width": column_width, "height": price_size + 20, "fill": "#ffffff", - "shadow": { - "color": "rgba(0, 0, 0, 0.7)", - "blur": 5, - "offsetX": 2, - "offsetY": 2 - }, + "shadow": "rgba(0, 0, 0, 0.7) 2px 2px 5px", "fontFamily": "Arial Black, sans-serif", "fontWeight": "bold", "fontSize": price_size, @@ -1350,12 +1329,7 @@ class PosterService: "width": column_width, "height": ticket_size + 10, "fill": "#ffffff", - "shadow": { - "color": "rgba(0, 0, 0, 0.5)", - "blur": 3, - "offsetX": 1, - "offsetY": 1 - }, + "shadow": "rgba(0, 0, 0, 0.5) 1px 1px 3px", "fontFamily": "Arial, sans-serif", "fontWeight": "normal", "fontSize": ticket_size,