191 {
194 float dx = x1 - x0;
195 float dy = y1 - y0;
197 float invSteps = 1.0f / (float)
steps;
198
199 for (
int i = 0; i <=
steps; i++) {
200 float u = i * invSteps;
201 float px = x0 + dx * u;
202 float py = y0 + dy * u;
204
207 float fx = px - ix;
208 float fy = py - iy;
209
210 float weights[4] = {
211 (1.0f - fx) * (1.0f - fy),
212 fx * (1.0f - fy),
213 (1.0f - fx) * fy,
214 fx * fy,
215 };
216 int offX[4] = {0, 1, 0, 1};
217 int offY[4] = {0, 0, 1, 1};
218
219 for (int j = 0; j < 4; j++) {
220 int cx = ix + offX[j];
221 int cy = iy + offY[j];
222 if (cx < 0 || cx >= w || cy < 0 || cy >= h)
223 continue;
224 float wt = weights[j];
225 if (wt <= 0.0f)
226 continue;
227 int gi =
idx(cy, cx);
228 float inv = 1.0f - wt;
229 mR[gi] =
mR[gi] * inv + c.r * wt;
230 mG[gi] =
mG[gi] * inv + c.g * wt;
231 mB[gi] =
mB[gi] * inv + c.b * wt;
232 }
233 }
234}
fl::UISlider colorShift("Color Shift", 0.04f, 0.0f, 0.5f, 0.01f)
int idx(int y, int x) const FL_NO_EXCEPT
u16 getWidth() const FL_NO_EXCEPT
u16 getHeight() const FL_NO_EXCEPT
fl::UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
float fabsf(float value) FL_NO_EXCEPT
float floorf(float value) FL_NO_EXCEPT