FastLED 3.9.15
Loading...
Searching...
No Matches
xypath_renderer.cpp
Go to the documentation of this file.
1
2
3#include <math.h>
4
5#include "fl/assert.h"
6#include "fl/warn.h"
7#include "fl/xypath.h"
9#include "fl/splat.h"
10
11namespace fl {
12
16
18 vec2f xy = mPath->compute(alpha);
19 vec2f out = tx.transform(xy);
20 out = mGridTransform.transform(out);
21 return out;
22}
23
25 // 1) continuous point, in “pixel‐centers” coordinates [0.5 … W–0.5]
26 if (!mDrawBoundsSet) {
27 FASTLED_WARN("XYPathRenderer::at_subpixel: draw bounds not set");
28 return Tile2x2_u8();
29 }
30 vec2f xy = at(alpha);
31
32 // 1) shift back so whole‐pixels go 0…W–1, 0…H–1
33 xy.x -= 0.5f;
34 xy.y -= 0.5f;
35
36 return splat(xy);
37}
38
39} // namespace fl
unsigned int xy(unsigned int x, unsigned int y)
TransformFloat & transform()
Definition xypath.cpp:122
Tile2x2_u8 at_subpixel(float alpha)
XYPathGeneratorPtr mPath
TransformFloat mTransform
XYPathRenderer(XYPathGeneratorPtr path, TransformFloat transform=TransformFloat())
TransformFloat mGridTransform
vec2f compute_float(float alpha, const TransformFloat &tx)
vec2f at(float alpha)
Definition xypath.cpp:135
Tile2x2_u8 splat(vec2f xy)
"Splat" as in "splat pixel rendering" takes a pixel value in float x,y coordinates and "splats" it in...
Definition splat.cpp:14
vec2< float > vec2f
Definition geometry.h:318
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
vec2f transform(const vec2f &xy) const
Definition transform.h:107
#define FASTLED_WARN
Definition warn.h:7