static final void buildDitheredGradientChannel(int from, int to, int steps,
			int bandWidth, int bandHeight, boolean vertical, byte[] bitmapData,
			int dp, int bytesPerLine, int bits) {
		final int mask = 0xff00 >>> bits;
		int val = from << 16;
		final int inc = ((to << 16) - val) / steps + 1;
		if (vertical) {
			for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
				for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
					final int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
					int temp = val + thresh;
					if (temp > 0xffffff)
						bitmapData[dptr] = -1;
					else
						bitmapData[dptr] = (byte) ((temp >>> 16) & mask);
				}
				val += inc;
			}
		} else {
			for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
				for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
					final int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
					int temp = val + thresh;
					if (temp > 0xffffff)
						bitmapData[dptr] = -1;
					else
						bitmapData[dptr] = (byte) ((temp >>> 16) & mask);
				}
				val += inc;
			}
		}
	}