FastLED 3.10.8
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#include "fl/stl/noexcept.h"
18
29
33#define FASTLED_SCALE_UP_ALWAYS_POWER_OF_2 0
34
38#define FASTLED_SCALE_UP_HIGH_PRECISION 1
39
44#define FASTLED_SCALE_UP_DECIDE_AT_RUNTIME 2
45
49#define FASTLED_SCALE_UP_FORCE_FLOATING_POINT 3
50
52
53#ifndef FASTLED_SCALE_UP
54#define FASTLED_SCALE_UP FASTLED_SCALE_UP_DECIDE_AT_RUNTIME
55#endif
56
57namespace fl {
58
60
69class ScaleUp : public Fx2d {
70 public:
74 ScaleUp(const XYMap& xymap, Fx2dPtr fx) FL_NO_EXCEPT;
75
78 void draw(DrawContext context) FL_NO_EXCEPT override;
79
80 fl::string fxName() const FL_NO_EXCEPT override { return "scale_up"; }
81
103 void expand(fl::span<const CRGB> input, fl::span<CRGB> output, u16 width,
104 u16 height, const XYMap& mXyMap) FL_NO_EXCEPT;
105
106 private:
112 void noExpand(fl::span<const CRGB> input, fl::span<CRGB> output, u16 width,
113 u16 height) FL_NO_EXCEPT;
114
115 Fx2dPtr mDelegate;
117};
118
119} // namespace fl
XYMap xymap
XYMap mXyMap
Definition fx2d.h:31
Fx2d(const XYMap &xyMap) FL_NO_EXCEPT
Definition fx2d.h:20
ScaleUp(const XYMap &xymap, Fx2dPtr fx) FL_NO_EXCEPT
Construct a ScaleUp effect wrapper.
void noExpand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height) FL_NO_EXCEPT
Direct copy without expansion (used when resolutions match)
void draw(DrawContext context) FL_NO_EXCEPT 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:116
Fx2dPtr mDelegate
The wrapped effect that renders at low resolution.
Definition scale_up.h:115
void expand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height, const XYMap &mXyMap) FL_NO_EXCEPT
Expand a low-resolution buffer to high-resolution using bilinear interpolation.
fl::string fxName() const FL_NO_EXCEPT override
Definition scale_up.h:80
Effect wrapper that upscales delegate effects using bilinear interpolation.
Definition scale_up.h:69
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
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:577