FastLED 3.9.15
Loading...
Searching...
No Matches
xypath_renderer.h
Go to the documentation of this file.
1
2#pragma once
3
4// #include "fl/stl/assert.h"
5// #include "fl/stl/function.h"
6// #include "fl/math/lut.h"
7// #include "fl/map_range.h"
8// #include "fl/math/math.h"
9// #include "fl/gfx/raster.h"
10// #include "fl/gfx/xypath.h"
11#include "fl/stl/function.h" // IWYU pragma: keep
12#include "fl/stl/shared_ptr.h" // For FASTLED_SHARED_PTR macros
13#include "fl/gfx/tile2x2.h" // IWYU pragma: keep
14#include "fl/math/transform.h"
15#include "fl/stl/noexcept.h"
16
17namespace fl {
18
20
22 public:
23 XYPathRenderer(XYPathGeneratorPtr path,
25 virtual ~XYPathRenderer() FL_NOEXCEPT = default; // Add virtual destructor for proper cleanup
26 vec2f at(float alpha);
27
28 Tile2x2_u8 at_subpixel(float alpha);
29
30 void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster,
31 fl::function<u8(float)> *optional_alpha_gen = nullptr);
32
33 // Overloaded to allow transform to be passed in.
34 vec2f at(float alpha, const TransformFloat &tx);
35
36 // Needed for drawing to the screen. When this called the rendering will
37 // be centered on the width and height such that 0,0 -> maps to .5,.5,
38 // which is convenient for drawing since each float pixel can be truncated
39 // to an integer type.
40 void setDrawBounds(u16 width, u16 height);
41 bool hasDrawBounds() const { return mDrawBoundsSet; }
42
44
46
51
52 void setScale(float scale);
53
54 vec2f compute(float alpha);
55
56 private:
57 XYPathGeneratorPtr mPath;
60 bool mDrawBoundsSet = false;
61 vec2f compute_float(float alpha, const TransformFloat &tx);
62};
63
64} // namespace fl
fl::UISlider scale("Scale", 4,.1, 4,.1)
TransformFloat & transform()
vec2f compute(float alpha)
Tile2x2_u8 at_subpixel(float alpha)
XYPathGeneratorPtr mPath
bool hasDrawBounds() const
TransformFloat mTransform
XYPathRenderer(XYPathGeneratorPtr path, TransformFloat transform=TransformFloat())
TransformFloat mGridTransform
vec2f compute_float(float alpha, const TransformFloat &tx)
void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster, fl::function< u8(float)> *optional_alpha_gen=nullptr)
void onTransformFloatChanged()
void setScale(float scale)
void setTransform(const TransformFloat &transform)
vec2f at(float alpha)
virtual ~XYPathRenderer() FL_NOEXCEPT=default
void setDrawBounds(u16 width, u16 height)
fl::UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
fl::XYRaster raster(WIDTH, HEIGHT)
unsigned char u8
Definition stdint.h:131
u8 u8 height
Definition blur.h:186
vec2< float > vec2f
Definition geometry.h:333
u8 width
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
#define FASTLED_SHARED_PTR(type)
Definition shared_ptr.h:535