1
0
Files
PPTX/docs/elements/shape.md
lanyuanxiaoyao 124ef0e5ce refactor: 重构文档结构,采用渐进式信息披露模式
将 README.md 拆分为多个专题文档,减少认知负荷:
- 用户文档迁移到 docs/ (用户指南、元素、模板、参考等)
- 开发文档迁移到 docs/development/ (架构、模块、规范)
- README.md 精简至 ~290 行,仅保留概览和导航
- 删除 README_DEV.md,内容已迁移
- 归档 OpenSpec 变更 refactor-docs-progressive-disclosure
2026-03-06 15:11:36 +08:00

2.4 KiB
Raw Permalink Blame History

形状元素

形状元素用于在幻灯片中绘制几何形状。

基本语法

- type: shape
  box: [x, y, width, height]
  shape: rectangle  # rectangle/ellipse/rounded_rectangle
  fill: "#4a90e2"   # 填充颜色
  line:
    color: "#000000"  # 边框颜色
    width: 2          # 边框宽度(磅)

属性

属性 类型 必需 说明
type 字符串 必须为 "shape"
box 数组 位置和尺寸 [x, y, width, height](英寸)
shape 字符串 形状类型
fill 字符串 填充颜色(#RRGGBB 或 #RGB
line 对象 边框配置

形状类型

rectangle矩形

- type: shape
  box: [1, 1, 4, 2]
  shape: rectangle
  fill: "#4a90e2"

ellipse椭圆

- type: shape
  box: [1, 1, 4, 2]
  shape: ellipse
  fill: "#e74c3c"

rounded_rectangle圆角矩形

- type: shape
  box: [1, 1, 4, 2]
  shape: rounded_rectangle
  fill: "#2ecc71"

边框配置

line:
  color: "#000000"  # 边框颜色
  width: 2          # 边框宽度(磅)

示例

简单矩形

slides:
  - elements:
      - type: shape
        box: [1, 1, 4, 2]
        shape: rectangle
        fill: "#4a90e2"

带边框的形状

slides:
  - elements:
      - type: shape
        box: [1, 1, 4, 2]
        shape: rectangle
        fill: "#ffffff"
        line:
          color: "#000000"
          width: 2

多个形状组合

slides:
  - elements:
      # 背景矩形
      - type: shape
        box: [0, 0, 10, 5.625]
        shape: rectangle
        fill: "#f5f5f5"

      # 装饰圆形
      - type: shape
        box: [1, 1, 2, 2]
        shape: ellipse
        fill: "#3498db"

      # 文本
      - type: text
        box: [3.5, 1.5, 5, 1]
        content: "欢迎"
        font:
          size: 44

无填充形状

- type: shape
  box: [1, 1, 4, 2]
  shape: rectangle
  fill: "transparent"  # 透明填充
  line:
    color: "#000000"
    width: 2

注意事项

  • 形状会按照 box 指定的尺寸进行绘制
  • 填充颜色和边框颜色使用相同的格式
  • 边框宽度单位为磅pt

相关文档

返回文档索引