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 Str & name = xypath_detail::unique_missing_name() )
static

Definition at line 227 of file xypath.cpp.

230 {
231
232 XYPathFunctionPtr path = NewPtr<XYPathFunction>(f);
233 path->setName(name);
234 if (!drawbounds.empty()) {
235 path->setDrawBounds(drawbounds);
236 }
237 XYPathPtr out = XYPathPtr::New(path);
238 if (!transform.is_identity()) {
239 out->setTransform(transform);
240 }
241 rect<int> bounds;
242 if (path->hasDrawBounds(&bounds)) {
243 if (!bounds.mMin.is_zero()) {
244 // Set the bounds to the path's bounds
246 "Bounds with an origin other than 0,0 is not supported yet");
247 }
248 auto w = bounds.width();
249 auto h = bounds.height();
250 out->setDrawBounds(w, h);
251 }
252 return out;
253}
Str name() const
Definition xypath.cpp:43
TransformFloat & transform()
Definition xypath.cpp:56
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: