FastLED 3.10.8
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_NO_EXCEPT = default; // Add virtual destructor for proper cleanup
26 vec2f at(float alpha) FL_NO_EXCEPT;
27
29
30 void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster,
31 fl::function<u8(float)> *optional_alpha_gen = nullptr) FL_NO_EXCEPT;
32
33 // Overloaded to allow transform to be passed in.
34 vec2f at(float alpha, const TransformFloat &tx) FL_NO_EXCEPT;
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.
41 bool hasDrawBounds() const FL_NO_EXCEPT { return mDrawBoundsSet; }
42
44
46
51
52 void setScale(float scale) FL_NO_EXCEPT;
53
54 vec2f compute(float alpha) FL_NO_EXCEPT;
55
56 private:
57 XYPathGeneratorPtr mPath;
60 bool mDrawBoundsSet = false;
61 vec2f compute_float(float alpha, const TransformFloat &tx) FL_NO_EXCEPT;
62};
63
64} // namespace fl
fl::UISlider scale("Scale", 4,.1, 4,.1)
void setScale(float scale) FL_NO_EXCEPT
virtual ~XYPathRenderer() FL_NO_EXCEPT=default
TransformFloat & transform() FL_NO_EXCEPT
XYPathGeneratorPtr mPath
TransformFloat mTransform
TransformFloat mGridTransform
void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster, fl::function< u8(float)> *optional_alpha_gen=nullptr) FL_NO_EXCEPT
vec2f compute_float(float alpha, const TransformFloat &tx) FL_NO_EXCEPT
Tile2x2_u8 at_subpixel(float alpha) FL_NO_EXCEPT
bool hasDrawBounds() const FL_NO_EXCEPT
void onTransformFloatChanged() FL_NO_EXCEPT
XYPathRenderer(XYPathGeneratorPtr path, TransformFloat transform=TransformFloat()) FL_NO_EXCEPT
vec2f at(float alpha) FL_NO_EXCEPT
void setDrawBounds(u16 width, u16 height) FL_NO_EXCEPT
void setTransform(const TransformFloat &transform) FL_NO_EXCEPT
vec2f compute(float alpha) FL_NO_EXCEPT
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 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
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.
#define FASTLED_SHARED_PTR(type)
Definition shared_ptr.h:577