Refactor ColorFilter and ColorMatrixFilter to improve perfomance in chrome

The JavaScript compiler of chrome currently does not optimize code within a try/catch block. Both filters have their time-intensive parts within such a block. This change moves those parts in private methods, which will be optimized separately.