| 34 | } |
| 35 | |
| 36 | Color Swizzle::applyTo(const Color& color) const { |
| 37 | int idx; |
| 38 | uint32_t k = key; |
| 39 | // Index of the input color that should be mapped to output r. |
| 40 | idx = static_cast<int>(k & 15); |
| 41 | float outR = ComponentIdxToFloat(color, idx); |
| 42 | k >>= 4; |
| 43 | idx = static_cast<int>(k & 15); |
| 44 | float outG = ComponentIdxToFloat(color, idx); |
| 45 | k >>= 4; |
| 46 | idx = static_cast<int>(k & 15); |
| 47 | float outB = ComponentIdxToFloat(color, idx); |
| 48 | k >>= 4; |
| 49 | idx = static_cast<int>(k & 15); |
| 50 | float outA = ComponentIdxToFloat(color, idx); |
| 51 | return {outR, outG, outB, outA}; |
| 52 | } |
| 53 | } // namespace tgfx |
no test coverage detected