FastLED 3.9.15
Loading...
Searching...
No Matches
scale_up.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include "fl/stl/stdint.h"
13#include "fl/stl/span.h"
14
15#include "fl/math/xymap.h" // Needed for constructor parameter // IWYU pragma: keep
16#include "fl/fx/fx2d.h"
17
28
32#define FASTLED_SCALE_UP_ALWAYS_POWER_OF_2 0
33
37#define FASTLED_SCALE_UP_HIGH_PRECISION 1
38
43#define FASTLED_SCALE_UP_DECIDE_AT_RUNTIME 2
44
48#define FASTLED_SCALE_UP_FORCE_FLOATING_POINT 3
49
51
52#ifndef FASTLED_SCALE_UP
53#define FASTLED_SCALE_UP FASTLED_SCALE_UP_DECIDE_AT_RUNTIME
54#endif
55
56namespace fl {
57
59
68class ScaleUp : public Fx2d {
69 public:
73 ScaleUp(const XYMap& xymap, Fx2dPtr fx);
74
77 void draw(DrawContext context) override;
78
79 fl::string fxName() const override { return "scale_up"; }
80
102 void expand(fl::span<const CRGB> input, fl::span<CRGB> output, u16 width,
103 u16 height, const XYMap& mXyMap);
104
105 private:
111 void noExpand(fl::span<const CRGB> input, fl::span<CRGB> output, u16 width,
112 u16 height);
113
114 Fx2dPtr mDelegate;
116};
117
118} // namespace fl
XYMap xymap
XYMap mXyMap
Definition fx2d.h:30
Fx2d(const XYMap &xyMap)
Definition fx2d.h:19
fl::string fxName() const override
Definition scale_up.h:79
void noExpand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height)
Direct copy without expansion (used when resolutions match)
ScaleUp(const XYMap &xymap, Fx2dPtr fx)
Construct a ScaleUp effect wrapper.
void draw(DrawContext context) override
Render the effect by drawing delegate at low-res and scaling up.
fl::vector_psram< CRGB > mSurface
Low-resolution render buffer.
Definition scale_up.h:115
void expand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height, const XYMap &mXyMap)
Expand a low-resolution buffer to high-resolution using bilinear interpolation.
Fx2dPtr mDelegate
The wrapped effect that renders at low resolution.
Definition scale_up.h:114
Effect wrapper that upscales delegate effects using bilinear interpolation.
Definition scale_up.h:68
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179
#define FASTLED_SHARED_PTR(type)
Definition shared_ptr.h:535