@Override
protected int[] filterPixels(int width, int height, int[] inPixels, Rectangle transformedSpace) {
pt = createProgressTracker(height);
int[] outPixels = new int[width * height];
Future<?>[] futures = new Future[height];
for (int y = 0; y < height; y++) {
int finalY = y;
Runnable calculateLineTask = () -> {
int index = width * finalY;
for (int x = 0; x < width; x++) {
outPixels[index++] = getPixel(x, finalY, inPixels, width, height);
}
};
futures[y] = ThreadPool.submit(calculateLineTask);
}
ThreadPool.waitToFinish(futures, pt);
finishProgressTracker();
return outPixels;
}