29 return tls_raster.
access();
36 static int sUniqueName = 0;
37 int id = ++sUniqueName;
80 for (
int i = 0; i <
steps; ++i) {
83 if (optional_alpha_gen) {
85 uint8_t a8 = (*optional_alpha_gen)(alpha);
99 tx.set_scale_x((width - 1.0f) * 0.5f);
102 tx.set_offset_x(width * 0.5f);
111 tx.set_scale_y((height - 1.0f) * 0.5f);
112 tx.set_offset_y(height * 0.5f);
142 auto path = PointPathPtr::New(
x,
y);
143 return XYPathPtr::New(path);
147 LinePathParamsPtr
p = LinePathParamsPtr::New();
153 auto path = LinePathPtr::New(
p);
154 return XYPathPtr::New(path);
159 return XYPathPtr::New(path);
163 auto path = CirclePathPtr::New();
164 return XYPathPtr::New(path);
168 CirclePathPtr path = CirclePathPtr::New();
169 XYPathPtr out = XYPathPtr::New(path);
170 out->setDrawBounds(width, height);
175 HeartPathPtr path = HeartPathPtr::New();
176 return XYPathPtr::New(path);
180 HeartPathPtr path = HeartPathPtr::New();
181 XYPathPtr out = XYPathPtr::New(path);
182 out->setDrawBounds(width, height);
187 ArchimedeanSpiralPathPtr path = ArchimedeanSpiralPathPtr::New();
188 XYPathPtr out = XYPathPtr::New(path);
189 out->setDrawBounds(width, height);
194 ArchimedeanSpiralPathPtr path = ArchimedeanSpiralPathPtr::New();
195 XYPathPtr out = XYPathPtr::New(path);
201 RosePathPtr path = RosePathPtr::New(params);
202 XYPathPtr out = XYPathPtr::New(path);
203 if (width > 0 && height > 0) {
204 out->setDrawBounds(width, height);
211 PhyllotaxisPathPtr path = PhyllotaxisPathPtr::New(
args);
212 XYPathPtr out = XYPathPtr::New(path);
213 if (width > 0 && height > 0) {
214 out->setDrawBounds(width, height);
221 GielisCurvePathPtr path = GielisCurvePathPtr::New(params);
222 XYPathPtr out = XYPathPtr::New(path);
223 if (width > 0 && height > 0) {
224 out->setDrawBounds(width, height);
231 CatmullRomPathPtr path = CatmullRomPathPtr::New(params);
232 XYPathPtr out = XYPathPtr::New(path);
233 if (width > 0 && height > 0) {
234 out->setDrawBounds(width, height);
246 if (!drawbounds.
empty()) {
247 path->setDrawBounds(drawbounds);
249 XYPathPtr out = XYPathPtr::New(path);
254 if (path->hasDrawBounds(&bounds)) {
255 if (!bounds.
mMin.is_zero()) {
258 "Bounds with an origin other than 0,0 is not supported yet");
260 auto w = bounds.
width();
262 out->setDrawBounds(w, h);
291 return MAX(1, 200 * diff);
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
XYRaster raster(WIDTH, HEIGHT)
void scale(uint8_t scale)
fl::function< uint8_t(float)> AlphaFunction
static XYPathPtr NewGielisCurvePath(uint16_t width=0, uint16_t height=0, const Ptr< GielisCurveParams > ¶ms=NewPtr< GielisCurveParams >())
int calculateSteps(float from, float to)
void drawColor(const CRGB &color, float from, float to, Leds *leds, int steps=-1)
static XYPathPtr NewHeartPath()
static XYPathPtr NewArchimedeanSpiralPath()
Tile2x2_u8 at_subpixel(float alpha)
static XYPathPtr NewCustomPath(const fl::function< vec2f(float)> &path, const rect< int > &drawbounds=rect< int >(), const TransformFloat &transform=TransformFloat(), const char *name=nullptr)
void setScale(float scale)
static XYPathPtr NewCatmullRomPath(uint16_t width=0, uint16_t height=0, const Ptr< CatmullRomParams > ¶ms=NewPtr< CatmullRomParams >())
static XYPathPtr NewPointPath(float x, float y)
bool hasDrawBounds() const
void setDrawBounds(uint16_t width, uint16_t height)
void drawGradient(const Gradient &gradient, float from, float to, Leds *leds, int steps=-1)
void setTransform(const TransformFloat &transform)
static XYPathPtr NewLinePath(float x0, float y0, float x1, float y1)
XYPathRendererPtr mPathRenderer
static XYPathPtr NewPhyllotaxisPath(uint16_t width=0, uint16_t height=0, const Ptr< PhyllotaxisParams > &args=NewPtr< PhyllotaxisParams >())
XYPath(XYPathGeneratorPtr path, TransformFloat transform=TransformFloat())
static XYPathPtr NewRosePath(uint16_t width=0, uint16_t height=0, const Ptr< RosePathParams > ¶ms=NewPtr< RosePathParams >())
void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster, AlphaFunction *optional_alpha_gen=nullptr)
static XYPathPtr NewCirclePath()
TransformFloat & transform()
TransformFloat & transform()
void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster, fl::function< uint8_t(float)> *optional_alpha_gen=nullptr)
vec2f compute(float alpha)
Tile2x2_u8 at_subpixel(float alpha)
TransformFloat mTransform
TransformFloat mGridTransform
vec2f compute_float(float alpha, const TransformFloat &tx)
void setDrawBounds(uint16_t width, uint16_t height)
void onTransformFloatChanged()
void setScale(float scale)
UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
XYRasterU8Sparse & get_tls_raster()
fl::Str unique_missing_name(const char *prefix)
XYRasterU8Sparse XYRaster
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
ThreadLocalFake< T > ThreadLocal
Ptr< T > NewPtr(Args... args)
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max)
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
Representation of an RGB pixel (Red, Green, Blue)