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

◆ setDrawBounds()

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

Definition at line 80 of file xypath.cpp.

80 {
81 // auto &tx = *(mGridTransform.mImpl);
82 auto &tx = mGridTransform;
83
84 // 1) map world‑X ∈ [–1..+1] → pixel‑X ∈ [0.5 .. width–0.5]
85 // scale_x = ( (width–0.5) – 0.5 ) / 2 = (width–1)/2
86 // offset_x = (width–0.5 + 0.5) / 2 = width/2
87 tx.set_scale_x((width - 1.0f) * 0.5f);
88 // tx.scale_x = (width - 1.0f) * 0.5f;
89 // tx.offset_x = width * 0.5f;
90 tx.set_offset_x(width * 0.5f);
91
92 // 2) map world‑Y ∈ [ -1 .. 1 ] → pixel‑Y ∈ [0.5 .. height–0.5]
93 // (your LinePath lives at Y=0, so it will sit at row‑0 center = 0.5)
94 // scale_y = (height–0.5) – 0.5 = height–1
95 // offset_y = 0.5
96 // tx.scale_y = (height - 1.0f) * 0.5f;
97 // tx.offset_y = height * 0.5f;
98
99 tx.set_scale_y((height - 1.0f) * 0.5f);
100 tx.set_offset_y(height * 0.5f);
101
103 mDrawBoundsSet = true;
104}
TransformFloat mGridTransform
void onTransformFloatChanged()
Definition xypath.cpp:106

References mDrawBoundsSet, mGridTransform, and onTransformFloatChanged().

+ Here is the call graph for this function: