If you dont mind about hardware acceleration you could simply iterate over all pixels, do the calculations yourself, and write them back to a target image.