FastLED 3.9.15
Loading...
Searching...
No Matches

◆ NewCustomPath()

XYPathPtr fl::XYPath::NewCustomPath ( const fl::function< vec2f(float)> & path,
const rect< i16 > & drawbounds = rect<i16>(),
const TransformFloat & transform = TransformFloat(),
const char * name = nullptr )
static

Definition at line 240 of file xypath.cpp.

243 {
244
245 XYPathFunctionPtr path = fl::make_shared<XYPathFunction>(f);
246 path->setName(name);
247 if (!drawbounds.empty()) {
248 path->setDrawBounds(drawbounds);
249 }
250 XYPathPtr out = fl::make_shared<XYPath>(path);
251 if (!transform.is_identity()) {
252 out->setTransform(transform);
253 }
254 rect<i16> bounds;
255 if (path->hasDrawBounds(&bounds)) {
256 if (!bounds.mMin.is_zero()) {
257 // Set the bounds to the path's bounds
259 "Bounds with an origin other than 0,0 is not supported yet");
260 }
261 auto w = bounds.width();
262 auto h = bounds.height();
263 out->setDrawBounds(w, h);
264 }
265 return out;
266}
string name() const
Definition xypath.cpp:56
TransformFloat & transform()
Definition xypath.cpp:69
shared_ptr< T > make_shared(Args &&... args)
Definition shared_ptr.h:348
#define FASTLED_WARN
Definition warn.h:7

References fl::rect< T >::empty(), FASTLED_WARN, fl::rect< T >::height(), fl::make_shared(), fl::rect< T >::mMin, name(), transform(), and fl::rect< T >::width().

+ Here is the call graph for this function: