FastLED 3.9.15
Loading...
Searching...
No Matches
fx2d_to_1d.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/stdint.h"
4#include "fl/stl/unique_ptr.h"
5
6#include "fl/gfx/sample.h"
7#include "fl/math/screenmap.h"
8#include "fl/fx/fx1d.h"
9#include "fl/fx/fx2d.h"
10
11namespace fl {
12
14
36class Fx2dTo1d : public Fx1d {
37 public:
43
49 Fx2dTo1d(u16 numLeds, Fx2dPtr fx2d, const ScreenMap &screenMap,
51
52 void draw(DrawContext context) override;
53 fl::string fxName() const override;
54
55 bool hasFixedFrameRate(float *fps) const override {
56 return mFx2d->hasFixedFrameRate(fps);
57 }
58
59 void pause(u32 now) override { mFx2d->pause(now); }
60 void resume(u32 now) override { mFx2d->resume(now); }
61
64
69
71 void setFx2d(Fx2dPtr fx2d);
72
74 Fx2dPtr getFx2d() const { return mFx2d; }
75
76 private:
77 Fx2dPtr mFx2d;
80
81 // Working buffer for 2D effect rendering
83};
84
85} // namespace fl
Fx1d(u16 numLeds)
Definition fx1d.h:12
void setInterpolationMode(InterpolationMode mode)
Set the interpolation mode.
Definition fx2d_to_1d.h:66
InterpolationMode
Interpolation mode for sampling the 2D grid.
Definition fx2d_to_1d.h:39
@ NEAREST
Nearest neighbor (fast, pixelated)
Definition fx2d_to_1d.h:40
@ BILINEAR
Bilinear interpolation (smooth)
Definition fx2d_to_1d.h:41
void setScreenMap(const ScreenMap &screenMap)
Set the screen map for coordinate mapping.
Definition fx2d_to_1d.h:63
Fx2dPtr getFx2d() const
Get the underlying 2D effect.
Definition fx2d_to_1d.h:74
void pause(u32 now) override
Definition fx2d_to_1d.h:59
InterpolationMode mInterpolationMode
Definition fx2d_to_1d.h:79
void resume(u32 now) override
Definition fx2d_to_1d.h:60
fl::unique_ptr< CRGB[]> mGrid
Definition fx2d_to_1d.h:82
Fx2dTo1d(u16 numLeds, Fx2dPtr fx2d, const ScreenMap &screenMap, InterpolationMode mode=BILINEAR)
Construct a 2D-to-1D sampling effect.
fl::string fxName() const override
bool hasFixedFrameRate(float *fps) const override
Definition fx2d_to_1d.h:55
void setFx2d(Fx2dPtr fx2d)
Replace the underlying 2D effect.
ScreenMap mScreenMap
Definition fx2d_to_1d.h:78
void draw(DrawContext context) override
Fx2dPtr mFx2d
Definition fx2d_to_1d.h:77
Fx2dTo1d samples a 2D effect into a 1D LED strip using a ScreenMap.
Definition fx2d_to_1d.h:36
fl::ScreenMap screenMap
Definition Corkscrew.h:101
@ SAMPLE_BILINEAR
Bilinear interpolation (smooth)
Definition sample.h:15
@ SAMPLE_NEAREST
Nearest neighbor (fast, pixelated)
Definition sample.h:14
Base definition for an LED controller.
Definition crgb.hpp:179
2D grid sampling with bilinear and nearest-neighbor interpolation
#define FASTLED_SHARED_PTR(type)
Definition shared_ptr.h:535