FastLED 3.10.8
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#include "fl/stl/noexcept.h"
11
12namespace fl {
13
15
37class Fx2dTo1d : public Fx1d {
38 public:
44
50 Fx2dTo1d(u16 numLeds, Fx2dPtr fx2d, const ScreenMap &screenMap,
52
53 void draw(DrawContext context) FL_NO_EXCEPT override;
54 fl::string fxName() const FL_NO_EXCEPT override;
55
56 bool hasFixedFrameRate(float *fps) const FL_NO_EXCEPT override {
57 return mFx2d->hasFixedFrameRate(fps);
58 }
59
60 void pause(u32 now) FL_NO_EXCEPT override { mFx2d->pause(now); }
61 void resume(u32 now) FL_NO_EXCEPT override { mFx2d->resume(now); }
62
65
70
72 void setFx2d(Fx2dPtr fx2d) FL_NO_EXCEPT;
73
75 Fx2dPtr getFx2d() const FL_NO_EXCEPT { return mFx2d; }
76
77 private:
78 Fx2dPtr mFx2d;
81
82 // Working buffer for 2D effect rendering
84};
85
86} // namespace fl
Fx1d(u16 numLeds) FL_NO_EXCEPT
Definition fx1d.h:13
void resume(u32 now) FL_NO_EXCEPT override
Definition fx2d_to_1d.h:61
InterpolationMode
Interpolation mode for sampling the 2D grid.
Definition fx2d_to_1d.h:40
@ NEAREST
Nearest neighbor (fast, pixelated)
Definition fx2d_to_1d.h:41
@ BILINEAR
Bilinear interpolation (smooth)
Definition fx2d_to_1d.h:42
void setInterpolationMode(InterpolationMode mode) FL_NO_EXCEPT
Set the interpolation mode.
Definition fx2d_to_1d.h:67
Fx2dPtr getFx2d() const FL_NO_EXCEPT
Get the underlying 2D effect.
Definition fx2d_to_1d.h:75
InterpolationMode mInterpolationMode
Definition fx2d_to_1d.h:80
void draw(DrawContext context) FL_NO_EXCEPT override
fl::string fxName() const FL_NO_EXCEPT override
fl::unique_ptr< CRGB[]> mGrid
Definition fx2d_to_1d.h:83
bool hasFixedFrameRate(float *fps) const FL_NO_EXCEPT override
Definition fx2d_to_1d.h:56
ScreenMap mScreenMap
Definition fx2d_to_1d.h:79
Fx2dTo1d(u16 numLeds, Fx2dPtr fx2d, const ScreenMap &screenMap, InterpolationMode mode=BILINEAR) FL_NO_EXCEPT
Construct a 2D-to-1D sampling effect.
void setFx2d(Fx2dPtr fx2d) FL_NO_EXCEPT
Replace the underlying 2D effect.
void setScreenMap(const ScreenMap &screenMap) FL_NO_EXCEPT
Set the screen map for coordinate mapping.
Definition fx2d_to_1d.h:64
Fx2dPtr mFx2d
Definition fx2d_to_1d.h:78
void pause(u32 now) FL_NO_EXCEPT override
Definition fx2d_to_1d.h:60
Fx2dTo1d samples a 2D effect into a 1D LED strip using a ScreenMap.
Definition fx2d_to_1d.h:37
fl::ScreenMap screenMap
Definition Corkscrew.h:101
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
@ SAMPLE_BILINEAR
Bilinear interpolation (smooth)
Definition sample.h:16
@ SAMPLE_NEAREST
Nearest neighbor (fast, pixelated)
Definition sample.h:15
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:577