protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace ) {
int[] outPixels = new int[width * height];
if ( morphImage != null ) {
int[] morphPixels = getRGB( morphImage, 0, 0, width, height, null );
morph( inPixels, morphPixels, outPixels, sourceGrid, destGrid, width, height, time );
} else if (frames <= 1) {
sourceGrid.warp(inPixels, width, height, sourceGrid, destGrid, outPixels);
} else {
WarpGrid newGrid = new WarpGrid(sourceGrid.rows, sourceGrid.cols, width, height);
for (int i = 0; i < frames; i++) {
float t = (float)i/(frames-1);
sourceGrid.lerp(t, destGrid, newGrid);
sourceGrid.warp(inPixels, width, height, sourceGrid, newGrid, outPixels);
}
}
return outPixels;
}