(imageData, colorCount, enableDithering)
| 735 | } |
| 736 | |
| 737 | async quantizeColors(imageData, colorCount, enableDithering) { |
| 738 | // 使用现有的median cut算法 |
| 739 | this.medianCutQuantization(imageData, colorCount); |
| 740 | |
| 741 | // 如果启用抖动,应用Floyd-Steinberg抖动 |
| 742 | if (enableDithering) { |
| 743 | this.applyFloydSteinbergDithering(imageData, colorCount); |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | // 复用existing的medianCutQuantization方法 |
| 748 | medianCutQuantization(imageData, colorCount) { |
no test coverage detected