MCPcopy Create free account
hub / github.com/FastLED/FastLED / NewCustomPath

Method NewCustomPath

src/fl/gfx/xypath.cpp.hpp:241–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241XYPathPtr XYPath::NewCustomPath(const fl::function<vec2f(float)> &f,
242 const rect<i16> &drawbounds,
243 const TransformFloat &transform,
244 const char *name) {
245
246 XYPathFunctionPtr path = fl::make_shared<XYPathFunction>(f);
247 path->setName(name);
248 if (!drawbounds.empty()) {
249 path->setDrawBounds(drawbounds);
250 }
251 XYPathPtr out = fl::make_shared<XYPath>(path);
252 if (!transform.is_identity()) {
253 out->setTransform(transform);
254 }
255 rect<i16> bounds;
256 if (path->hasDrawBounds(&bounds)) {
257 if (!bounds.mMin.is_zero()) {
258 // Set the bounds to the path's bounds
259 FL_WARN(
260 "Bounds with an origin other than 0,0 is not supported yet");
261 }
262 auto w = bounds.width();
263 auto h = bounds.height();
264 out->setDrawBounds(w, h);
265 }
266 return out;
267}
268
269void XYPath::setTransform(const TransformFloat &transform) {
270 mPathRenderer->setTransform(transform);

Callers

nothing calls this directly

Calls 9

setNameMethod · 0.80
emptyMethod · 0.45
setDrawBoundsMethod · 0.45
is_identityMethod · 0.45
setTransformMethod · 0.45
hasDrawBoundsMethod · 0.45
is_zeroMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected