1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//! Flowchart with 3 connector types and a hub-and-spoke network diagram.
use deckmint::objects::shape::ShapeOptionsBuilder;
use deckmint::objects::text::TextOptionsBuilder;
use deckmint::types::ShapeLineProps;
use deckmint::{AlignH, AlignV, ConnectorOptionsBuilder, ConnectorType, Presentation, ShapeType};
fn main() {
let mut pres = Presentation::new();
// ══════════════════════════════════════════════════════════
// Slide 1: Flowchart — 4 process steps with 3 connector types
// ══════════════════════════════════════════════════════════
{
let slide = pres.add_slide();
slide.set_background_color("#F2F2F2");
slide.add_text(
"Flowchart: Connector Types",
TextOptionsBuilder::new()
.bounds(0.5, 0.2, 9.0, 0.6)
.font_size(24.0)
.bold()
.color("#333333")
.build(),
);
// Step boxes — rounded rectangles in a Z-pattern
let steps = [
("1. Plan", 1.0, 1.3, "#4472C4"),
("2. Design", 5.0, 1.3, "#ED7D31"),
("3. Build", 1.0, 3.5, "#70AD47"),
("4. Deploy", 5.0, 3.5, "#FFC000"),
];
let box_w = 3.0;
let box_h = 1.2;
for (label, x, y, color) in &steps {
slide.add_shape(
ShapeType::RoundRect,
ShapeOptionsBuilder::new()
.bounds(*x, *y, box_w, box_h)
.fill_color(*color)
.rect_radius(0.15)
.build(),
);
slide.add_text(
*label,
TextOptionsBuilder::new()
.bounds(*x, *y, box_w, box_h)
.font_size(18.0)
.bold()
.color("#FFFFFF")
.align(AlignH::Center)
.valign(AlignV::Middle)
.build(),
);
}
// Connector 1: Straight — Plan to Design (right side of box 1 to left side of box 2)
let (ct, co) = ConnectorOptionsBuilder::new()
.connector_type(ConnectorType::Straight)
.x1(1.0 + box_w)
.y1(1.3 + box_h / 2.0)
.x2(5.0)
.y2(1.3 + box_h / 2.0)
.line(ShapeLineProps {
color: Some("4472C4".into()),
width: Some(2.5),
dash_type: None,
transparency: None,
begin_arrow_type: None,
end_arrow_type: Some("triangle".into()),
cap: None,
join: None,
})
.build();
slide.add_connector(ct, co);
// Label
slide.add_text(
"Straight",
TextOptionsBuilder::new()
.bounds(3.5, 0.9, 2.0, 0.4)
.font_size(10.0)
.color("#4472C4")
.align(AlignH::Center)
.build(),
);
// Connector 2: Elbow — Design down to Build (bottom of box 2 across to top of box 3)
let (ct, co) = ConnectorOptionsBuilder::new()
.connector_type(ConnectorType::Elbow)
.x1(5.0 + box_w / 2.0)
.y1(1.3 + box_h)
.x2(1.0 + box_w / 2.0)
.y2(3.5)
.line(ShapeLineProps {
color: Some("ED7D31".into()),
width: Some(3.0),
dash_type: Some("dash".into()),
transparency: None,
begin_arrow_type: None,
end_arrow_type: Some("triangle".into()),
cap: None,
join: None,
})
.build();
slide.add_connector(ct, co);
// Label
slide.add_text(
"Elbow (dashed)",
TextOptionsBuilder::new()
.bounds(3.2, 2.55, 2.6, 0.4)
.font_size(10.0)
.color("#ED7D31")
.align(AlignH::Center)
.build(),
);
// Connector 3: Curved — Build to Deploy
let (ct, co) = ConnectorOptionsBuilder::new()
.connector_type(ConnectorType::Curved)
.x1(1.0 + box_w)
.y1(3.5 + box_h / 2.0)
.x2(5.0)
.y2(3.5 + box_h / 2.0)
.line(ShapeLineProps {
color: Some("70AD47".into()),
width: Some(2.0),
dash_type: Some("lgDash".into()),
transparency: None,
begin_arrow_type: None,
end_arrow_type: Some("triangle".into()),
cap: None,
join: None,
})
.build();
slide.add_connector(ct, co);
// Label
slide.add_text(
"Curved (long dash)",
TextOptionsBuilder::new()
.bounds(3.0, 4.8, 3.0, 0.4)
.font_size(10.0)
.color("#70AD47")
.align(AlignH::Center)
.build(),
);
}
// ══════════════════════════════════════════════════════════
// Slide 2: Hub-and-spoke network diagram with elbow connectors
// ══════════════════════════════════════════════════════════
{
let slide = pres.add_slide();
slide.set_background_color("#1B2838");
slide.add_text(
"Hub-and-Spoke Network",
TextOptionsBuilder::new()
.bounds(0.5, 0.15, 9.0, 0.5)
.font_size(22.0)
.bold()
.color("#FFFFFF")
.build(),
);
// Central hub
let hub_x = 3.75;
let hub_y = 2.1;
let hub_w = 2.5;
let hub_h = 1.5;
slide.add_shape(
ShapeType::Ellipse,
ShapeOptionsBuilder::new()
.bounds(hub_x, hub_y, hub_w, hub_h)
.fill_color("#E74C3C")
.build(),
);
slide.add_text(
"Core\nServer",
TextOptionsBuilder::new()
.bounds(hub_x, hub_y, hub_w, hub_h)
.font_size(16.0)
.bold()
.color("#FFFFFF")
.align(AlignH::Center)
.valign(AlignV::Middle)
.build(),
);
// Spoke nodes arranged around hub
let spokes: [(&str, f64, f64, &str); 5] = [
("Web App", 1.0, 0.7, "#3498DB"),
("Mobile", 7.0, 0.7, "#2ECC71"),
("Database", 0.3, 3.8, "#9B59B6"),
("Cache", 7.5, 3.8, "#F39C12"),
("CDN", 4.0, 4.6, "#1ABC9C"),
];
let spoke_w = 1.8;
let spoke_h = 1.0;
let hub_cx = hub_x + hub_w / 2.0;
let hub_cy = hub_y + hub_h / 2.0;
for (label, sx, sy, color) in &spokes {
slide.add_shape(
ShapeType::RoundRect,
ShapeOptionsBuilder::new()
.bounds(*sx, *sy, spoke_w, spoke_h)
.fill_color(*color)
.rect_radius(0.1)
.build(),
);
slide.add_text(
*label,
TextOptionsBuilder::new()
.bounds(*sx, *sy, spoke_w, spoke_h)
.font_size(13.0)
.bold()
.color("#FFFFFF")
.align(AlignH::Center)
.valign(AlignV::Middle)
.build(),
);
// Elbow connector from hub center to spoke center
let spoke_cx = sx + spoke_w / 2.0;
let spoke_cy = sy + spoke_h / 2.0;
let (ct, co) = ConnectorOptionsBuilder::new()
.connector_type(ConnectorType::Elbow)
.x1(hub_cx)
.y1(hub_cy)
.x2(spoke_cx)
.y2(spoke_cy)
.line(ShapeLineProps {
color: Some(color.trim_start_matches('#').into()),
width: Some(1.5),
dash_type: None,
transparency: Some(20.0),
begin_arrow_type: None,
end_arrow_type: Some("triangle".into()),
cap: None,
join: None,
})
.build();
slide.add_connector(ct, co);
}
}
pres.write_to_file("15_connectors.pptx").unwrap();
println!("Wrote 15_connectors.pptx");
}