Arbitrary-palette positional dithering algorithm