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

◆ NewCustomPath()

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

Definition at line 239 of file xypath.cpp.

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

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

+ Here is the call graph for this function: