FastLED 3.9.15
Loading...
Searching...
No Matches

◆ setDrawBounds()

void fl::XYPathRenderer::setDrawBounds ( u16 width,
u16 height )

Definition at line 94 of file xypath.cpp.hpp.

94 {
95 // auto &tx = *(mGridTransform.mImpl);
96 auto &tx = mGridTransform;
97
98 // 1) map world‑X ∈ [–1..+1] → pixel‑X ∈ [0.5 .. width–0.5]
99 // scale_x = ( (width–0.5) – 0.5 ) / 2 = (width–1)/2
100 // offset_x = (width–0.5 + 0.5) / 2 = width/2
101 tx.set_scale_x((width - 1.0f) * 0.5f);
102 // tx.scale_x = (width - 1.0f) * 0.5f;
103 // tx.offset_x = width * 0.5f;
104 tx.set_offset_x(width * 0.5f);
105
106 // 2) map world‑Y ∈ [ -1 .. 1 ] → pixel‑Y ∈ [0.5 .. height–0.5]
107 // (your LinePath lives at Y=0, so it will sit at row‑0 center = 0.5)
108 // scale_y = (height–0.5) – 0.5 = height–1
109 // offset_y = 0.5
110 // tx.scale_y = (height - 1.0f) * 0.5f;
111 // tx.offset_y = height * 0.5f;
112
113 tx.set_scale_y((height - 1.0f) * 0.5f);
114 tx.set_offset_y(height * 0.5f);
115
117 mDrawBoundsSet = true;
118}
TransformFloat mGridTransform
void onTransformFloatChanged()
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

References fl::height, mDrawBoundsSet, mGridTransform, onTransformFloatChanged(), and fl::width.

Referenced by ~XYPathRenderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: