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

◆ upscaleFloat() [2/2]

u8 fl::upscaleFloat ( u8 v00,
u8 v10,
u8 v01,
u8 v11,
float dx,
float dy )

Definition at line 246 of file upscale.cpp.

247 {
248 float dx_inv = 1.0f - dx;
249 float dy_inv = 1.0f - dy;
250
251 // Calculate the weights for each corner
252 float w00 = dx_inv * dy_inv;
253 float w10 = dx * dy_inv;
254 float w01 = dx_inv * dy;
255 float w11 = dx * dy;
256
257 // Compute the weighted sum
258 float sum = v00 * w00 + v10 * w10 + v01 * w01 + v11 * w11;
259
260 // Clamp the result to [0, 255] and round
261 u8 result = static_cast<u8>(sum + 0.5f);
262
263 return result;
264}
Result type for promise operations.
unsigned char u8
Definition int.h:17

Referenced by fl::ScaleUp::expand(), upscaleArbitraryFloat(), and upscaleFloat().

+ Here is the caller graph for this function: