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 241 of file xypath.cpp.hpp.

244 {
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}
string name() const
TransformFloat & transform()
#define FL_WARN(X)
Definition log.h:276
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414

References fl::rect< T >::empty(), FL_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: