MCPcopy Create free account
hub / github.com/asmuth/clip / plot_set_background

Function plot_set_background

src/plot/plotgen.cc:150–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150ReturnCode plot_set_background(
151 Context* ctx,
152 const PlotConfig* plot,
153 const Expr* expr) {
154 Rectangle rect = plot_get_clip(plot, layer_get(ctx));
155 FillStyle fill_style;
156 StrokeStyle stroke_style;
157 stroke_style.line_width = from_pt(1);
158
159 /* read arguments */
160 auto config_rc = expr_walk_map_wrapped(expr, {
161 {
162 "color",
163 expr_calln_fn({
164 std::bind(&color_read, ctx, _1, &stroke_style.color),
165 std::bind(&fill_style_read_solid, ctx, _1, &fill_style),
166 })
167 },
168 {"fill", std::bind(&fill_style_read, ctx, _1, &fill_style)},
169 {"stroke-color", std::bind(&color_read, ctx, _1, &stroke_style.color)},
170 {"stroke-width", std::bind(&measure_read, _1, &stroke_style.line_width)},
171 {"stroke-style", std::bind(&stroke_style_read, ctx, _1, &stroke_style)},
172 });
173
174 if (!config_rc) {
175 return config_rc;
176 }
177
178 Path p;
179 path_add_rectangle(&p, rect);
180 draw_path(ctx, p, stroke_style, fill_style);
181
182 return OK;
183}
184
185
186} // namespace clip

Callers

nothing calls this directly

Calls 7

plot_get_clipFunction · 0.85
layer_getFunction · 0.85
from_ptFunction · 0.85
expr_walk_map_wrappedFunction · 0.85
expr_calln_fnFunction · 0.85
path_add_rectangleFunction · 0.85
draw_pathFunction · 0.85

Tested by

no test coverage detected