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

140 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 形状元素
形状元素用于在幻灯片中绘制几何形状。
## 基本语法
```yaml
- 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矩形
```yaml
- type: shape
box: [1, 1, 4, 2]
shape: rectangle
fill: "#4a90e2"
```
### ellipse椭圆
```yaml
- type: shape
box: [1, 1, 4, 2]
shape: ellipse
fill: "#e74c3c"
```
### rounded_rectangle圆角矩形
```yaml
- type: shape
box: [1, 1, 4, 2]
shape: rounded_rectangle
fill: "#2ecc71"
```
## 边框配置
```yaml
line:
color: "#000000" # 边框颜色
width: 2 # 边框宽度(磅)
```
## 示例
### 简单矩形
```yaml
slides:
- elements:
- type: shape
box: [1, 1, 4, 2]
shape: rectangle
fill: "#4a90e2"
```
### 带边框的形状
```yaml
slides:
- elements:
- type: shape
box: [1, 1, 4, 2]
shape: rectangle
fill: "#ffffff"
line:
color: "#000000"
width: 2
```
### 多个形状组合
```yaml
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
```
### 无填充形状
```yaml
- type: shape
box: [1, 1, 4, 2]
shape: rectangle
fill: "transparent" # 透明填充
line:
color: "#000000"
width: 2
```
## 注意事项
- 形状会按照 box 指定的尺寸进行绘制
- 填充颜色和边框颜色使用相同的格式
- 边框宽度单位为磅pt
## 相关文档
- [坐标系统](../reference/coordinates.md) - 位置和尺寸单位
- [颜色格式](../reference/colors.md) - 颜色表示方法
[返回文档索引](../README.md)