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/assert.h"
5// #include "fl/function.h"
6// #include "fl/lut.h"
7// #include "fl/map_range.h"
8// #include "fl/math_macros.h"
9// #include "fl/raster.h"
10// #include "fl/xypath.h"
11#include "fl/function.h"
12#include "fl/memory.h"
13#include "fl/tile2x2.h"
14#include "fl/transform.h"
15
16namespace fl {
17
19
21 public:
22 XYPathRenderer(XYPathGeneratorPtr path,
24 virtual ~XYPathRenderer() = default; // Add virtual destructor for proper cleanup
25 vec2f at(float alpha);
26
27 Tile2x2_u8 at_subpixel(float alpha);
28
29 void rasterize(float from, float to, int steps, XYRasterU8Sparse &raster,
30 fl::function<u8(float)> *optional_alpha_gen = nullptr);
31
32 // Overloaded to allow transform to be passed in.
33 vec2f at(float alpha, const TransformFloat &tx);
34
35 // Needed for drawing to the screen. When this called the rendering will
36 // be centered on the width and height such that 0,0 -> maps to .5,.5,
37 // which is convenient for drawing since each float pixel can be truncated
38 // to an integer type.
39 void setDrawBounds(u16 width, u16 height);
40 bool hasDrawBounds() const { return mDrawBoundsSet; }
41
43
45
50
51 void setScale(float scale);
52
53 vec2f compute(float alpha);
54
55 private:
56 XYPathGeneratorPtr mPath;
59 bool mDrawBoundsSet = false;
60 vec2f compute_float(float alpha, const TransformFloat &tx);
61};
62
63} // namespace fl
uint16_t scale
Definition Noise.ino:74
TransformFloat & transform()
Definition xypath.cpp:123
vec2f compute(float alpha)
Definition xypath.cpp:132
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)
Definition xypath.cpp:78
void onTransformFloatChanged()
Definition xypath.cpp:119
virtual ~XYPathRenderer()=default
void setScale(float scale)
Definition xypath.cpp:125
void setTransform(const TransformFloat &transform)
vec2f at(float alpha)
Definition xypath.cpp:136
void setDrawBounds(u16 width, u16 height)
Definition xypath.cpp:93
UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
XYRaster raster(WIDTH, HEIGHT)
unsigned char u8
Definition int.h:17
vec2< float > vec2f
Definition geometry.h:333
IMPORTANT!
Definition crgb.h:20
#define FASTLED_SMART_PTR(type)
Definition ptr.h:33