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

◆ setDrawBounds()

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

Definition at line 93 of file xypath.cpp.

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

References mDrawBoundsSet, mGridTransform, and onTransformFloatChanged().

+ Here is the call graph for this function: