@ww_nero/skills 3.0.5 → 3.0.6
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/assets/svg_to_pptx.py +24 -4
- package/index.js +1 -1
- package/package.json +1 -1
package/assets/svg_to_pptx.py
CHANGED
|
@@ -358,8 +358,8 @@ def add_triangle(slide, cx, cy, size, fill_color, opacity=1.0, rotation=0, strok
|
|
|
358
358
|
|
|
359
359
|
return shape
|
|
360
360
|
|
|
361
|
-
def add_spline(slide, points, color, width=2, opacity=1.0, smooth=True):
|
|
362
|
-
"""添加样条曲线,points为控制点列表[(x,y),...],smooth=True时使用Catmull-Rom
|
|
361
|
+
def add_spline(slide, points, color, width=2, opacity=1.0, smooth=True, dash=False):
|
|
362
|
+
"""添加样条曲线,points为控制点列表[(x,y),...],smooth=True时使用Catmull-Rom插值,dash=True时使用虚线"""
|
|
363
363
|
if len(points) < 2:
|
|
364
364
|
return None
|
|
365
365
|
if smooth and len(points) >= 3:
|
|
@@ -375,12 +375,14 @@ def add_spline(slide, points, color, width=2, opacity=1.0, smooth=True):
|
|
|
375
375
|
shape.fill.background()
|
|
376
376
|
shape.line.color.rgb = hex_to_rgb(color)
|
|
377
377
|
shape.line.width = int(width * 9525)
|
|
378
|
+
if dash:
|
|
379
|
+
shape.line.dash_style = 2
|
|
378
380
|
if opacity < 1.0:
|
|
379
381
|
set_line_transparency(shape, opacity)
|
|
380
382
|
return shape
|
|
381
383
|
|
|
382
|
-
def add_freeform_path(slide, points, fill_color=None, stroke_color=None, stroke_width=1, opacity=1.0, closed=False, stroke_opacity=None, has_shadow=False):
|
|
383
|
-
"""
|
|
384
|
+
def add_freeform_path(slide, points, fill_color=None, stroke_color=None, stroke_width=1, opacity=1.0, closed=False, stroke_opacity=None, has_shadow=False, dash=False):
|
|
385
|
+
"""添加自由形状路径,dash=True时使用虚线"""
|
|
384
386
|
if len(points) < 2:
|
|
385
387
|
return None
|
|
386
388
|
builder = slide.shapes.build_freeform(px(points[0][0]), px(points[0][1]))
|
|
@@ -401,6 +403,8 @@ def add_freeform_path(slide, points, fill_color=None, stroke_color=None, stroke_
|
|
|
401
403
|
if stroke_color:
|
|
402
404
|
shape.line.color.rgb = hex_to_rgb(stroke_color)
|
|
403
405
|
shape.line.width = int(stroke_width * 9525)
|
|
406
|
+
if dash:
|
|
407
|
+
shape.line.dash_style = 2
|
|
404
408
|
actual_stroke_opacity = stroke_opacity if stroke_opacity is not None else opacity
|
|
405
409
|
if actual_stroke_opacity < 1.0:
|
|
406
410
|
set_line_transparency(shape, actual_stroke_opacity)
|
|
@@ -791,6 +795,22 @@ def create_slide(prs):
|
|
|
791
795
|
add_text_box(slide, "GPU", 600, 580, 40, 20, 14, "#ffffff", bold=True, anchor='middle', valign='middle')
|
|
792
796
|
add_text_box(slide, "使用率", 600, 520, 100, 20, 12, "#b3e5fc", anchor='middle', valign='top')
|
|
793
797
|
|
|
798
|
+
# 样条曲线演示:实线 vs 虚线
|
|
799
|
+
spline_points = [(380, 620), (400, 580), (430, 600), (460, 560), (490, 590)]
|
|
800
|
+
add_spline(slide, spline_points, "#00e5ff", width=2, smooth=True, dash=False)
|
|
801
|
+
add_text_box(slide, "实线曲线", 380, 540, 80, 16, 10, "#b3e5fc", anchor='start', valign='top')
|
|
802
|
+
spline_points_dash = [(380, 680), (400, 640), (430, 660), (460, 620), (490, 650)]
|
|
803
|
+
add_spline(slide, spline_points_dash, "#ff6384", width=2, smooth=True, dash=True)
|
|
804
|
+
add_text_box(slide, "虚线曲线", 380, 700, 80, 16, 10, "#b3e5fc", anchor='start', valign='top')
|
|
805
|
+
|
|
806
|
+
# 自由路径演示:实线 vs 虚线
|
|
807
|
+
path_points = [(150, 620), (180, 580), (220, 600), (260, 570), (300, 590)]
|
|
808
|
+
add_freeform_path(slide, path_points, stroke_color="#ffce56", stroke_width=2, dash=False)
|
|
809
|
+
add_text_box(slide, "实线路径", 150, 540, 80, 16, 10, "#b3e5fc", anchor='start', valign='top')
|
|
810
|
+
path_points_dash = [(150, 680), (180, 640), (220, 660), (260, 630), (300, 650)]
|
|
811
|
+
add_freeform_path(slide, path_points_dash, stroke_color="#4bc0c0", stroke_width=2, dash=True)
|
|
812
|
+
add_text_box(slide, "虚线路径", 150, 700, 80, 16, 10, "#b3e5fc", anchor='start', valign='top')
|
|
813
|
+
|
|
794
814
|
def main():
|
|
795
815
|
prs = Presentation()
|
|
796
816
|
prs.slide_width = px(1280)
|
package/index.js
CHANGED
|
@@ -283,7 +283,7 @@ const listTools = () => ({
|
|
|
283
283
|
]
|
|
284
284
|
});
|
|
285
285
|
|
|
286
|
-
const server = new Server({ name: 'skills', version: '3.0.
|
|
286
|
+
const server = new Server({ name: 'skills', version: '3.0.6' }, { capabilities: { tools: {} } });
|
|
287
287
|
|
|
288
288
|
server.setRequestHandler(ListToolsRequestSchema, async () => listTools());
|
|
289
289
|
|