MCPcopy Create free account
hub / github.com/Tencent/tgfx / LoadImage

Method LoadImage

src/svg/node/SVGImage.cpp:82–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82SVGImage::ImageInfo SVGImage::LoadImage(const SVGIRI& iri, const Rect& viewPort) {
83 std::shared_ptr<Image> image = ::tgfx::LoadImage(iri);
84 if (!image) {
85 return {};
86 }
87
88 // Per spec: raster content has implicit viewbox of '0 0 width height'.
89 const Rect viewBox = Rect::MakeWH(image->width(), image->height());
90
91 // Map and place at x, y specified by viewport
92 Rect dst = viewBox.makeOffset(viewPort.left, viewPort.top);
93
94 return {std::move(image), dst};
95}
96
97void SVGImage::onRender(const SVGRenderContext& context) const {
98 // Per spec: x, w, width, height attributes establish the new viewport.

Callers

nothing calls this directly

Calls 4

LoadImageFunction · 0.85
makeOffsetMethod · 0.80
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected