| 364 | } |
| 365 | |
| 366 | void RadialCode(const GradientInfo& info, const Matrix& /*perspectiveRemover*/, |
| 367 | const std::shared_ptr<MemoryWriteStream>& function) { |
| 368 | function->writeText("{"); |
| 369 | |
| 370 | // Find the distance from the origin. |
| 371 | function->writeText( |
| 372 | "dup " // x y y |
| 373 | "mul " // x y^2 |
| 374 | "exch " // y^2 x |
| 375 | "dup " // y^2 x x |
| 376 | "mul " // y^2 x^2 |
| 377 | "add " // y^2+x^2 |
| 378 | "sqrt\n"); // sqrt(y^2+x^2) |
| 379 | |
| 380 | TileModeCode(TileMode::Clamp, function); |
| 381 | GradientFunctionCode(info, function); |
| 382 | function->writeText("}"); |
| 383 | } |
| 384 | |
| 385 | /** |
| 386 | * Conical gradient shader, based on the Canvas spec for radial gradients |
no test coverage detected