I tried to do implement the sourcecode in a shader and do the calculations there to speed up the rendering process of the bitmap, but since d3d9 doesn't support bitshiftig and other bitwise operations, it is a bit tricky. But I made some progress...
The problem is, that my knowledge of math is, hm, not deep laugh