| 161 | } |
| 162 | |
| 163 | void FlowFieldFloat::drawDot(float cx, float cy, float diam, |
| 164 | u8 cr, u8 cg, u8 cb) { |
| 165 | int w = (int)getWidth(); |
| 166 | int h = (int)getHeight(); |
| 167 | float rad = diam * 0.5f; |
| 168 | int x0 = fl::max(0, (int)floorf(cx - rad - 1.0f)); |
| 169 | int x1 = fl::min(w - 1, (int)ceilf(cx + rad + 1.0f)); |
| 170 | int y0 = fl::max(0, (int)floorf(cy - rad - 1.0f)); |
| 171 | int y1 = fl::min(h - 1, (int)ceilf(cy + rad + 1.0f)); |
| 172 | for (int y = y0; y <= y1; y++) { |
| 173 | for (int x = x0; x <= x1; x++) { |
| 174 | float dx = (x + 0.5f) - cx; |
| 175 | float dy = (y + 0.5f) - cy; |
| 176 | float dist = sqrtf(dx * dx + dy * dy); |
| 177 | float cov = clampf(rad + 0.5f - dist, 0.0f, 1.0f); |
| 178 | if (cov <= 0.0f) |
| 179 | continue; |
| 180 | float inv = 1.0f - cov; |
| 181 | int i = idx(y, x); |
| 182 | mR[i] = mR[i] * inv + cr * cov; |
| 183 | mG[i] = mG[i] * inv + cg * cov; |
| 184 | mB[i] = mB[i] * inv + cb * cov; |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | void FlowFieldFloat::drawAALine(float x0, float y0, float x1, float y1, |
| 190 | float t, float colorShift) { |
nothing calls this directly
no test coverage detected