| 148 | } |
| 149 | |
| 150 | ReturnCode 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 |
nothing calls this directly
no test coverage detected