| 40 | } |
| 41 | |
| 42 | static Valdi::Result<Ref<Image>> loadImage(const Valdi::StringBox& imageFilePath, |
| 43 | const std::optional<int>& widthHint, |
| 44 | const std::optional<int>& heightHint) { |
| 45 | return processImage<Valdi::Ref<snap::drawing::Image>>( |
| 46 | imageFilePath, |
| 47 | [&](auto bytes) { return Image::make(bytes); }, |
| 48 | [&](auto bytes) { |
| 49 | auto outputWidth = widthHint ? widthHint.value() : 0; |
| 50 | auto outputHeight = heightHint ? heightHint.value() : 0; |
| 51 | |
| 52 | return SVGRenderer::render(bytes.data(), bytes.size(), outputWidth, outputHeight); |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | static Valdi::Result<Ref<Image>> clipImageToCircle(const Ref<Image>& image) { |
| 57 | auto width = image->width(); |