*                <ul>
	 *                <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1,
	 *                2, 4, 8, 16, 24 or 32</li>
	 *                </ul>
	 */
	public void setPixel(int x, int y, int pixelValue) {
		if (x >= width || y >= height || x < 0 || y < 0)
			SWT.error(SWT.ERROR_INVALID_ARGUMENT);
		int index;
		byte theByte;
		int mask;
		switch (depth) {
		case 32:
			index = (y * bytesPerLine) + (x * 4);
			data[index] = (byte) ((pixelValue >> 24) & 0xFF);
			data[index + 1] = (byte) ((pixelValue >> 16) & 0xFF);
			data[index + 2] = (byte) ((pixelValue >> 8) & 0xFF);
			data[index + 3] = (byte) (pixelValue & 0xFF);
			return;
		case 24:
			index = (y * bytesPerLine) + (x * 3);
			data[index] = (byte) ((pixelValue >> 16) & 0xFF);
			data[index + 1] = (byte) ((pixelValue >> 8) & 0xFF);
			data[index + 2] = (byte) (pixelValue & 0xFF);
			return;
		case 16:
			index = (y * bytesPerLine) + (x * 2);
			data[index + 1] = (byte) ((pixelValue >> 8) & 0xFF);
			data[index] = (byte) (pixelValue & 0xFF);
			return;
		case 8:
			index = (y * bytesPerLine) + x;
			data[index] = (byte) (pixelValue & 0xFF);
			return;
		case 4:
			index = (y * bytesPerLine) + (x >> 1);
			if ((x & 0x1) == 0) {
				data[index] = (byte) ((data[index] & 0x0F) | ((pixelValue & 0x0F) << 4));
			} else {
				data[index] = (byte) ((data[index] & 0xF0) | (pixelValue & 0x0F));
			}
			return;
		case 2:
			index = (y * bytesPerLine) + (x >> 2);
			theByte = data[index];
			int offset = 3 - (x % 4);
			mask = 0xFF ^ (3 << (offset * 2));
			data[index] = (byte) ((data[index] & mask) | (pixelValue << (offset * 2)));
			return;
		case 1:
			index = (y * bytesPerLine) + (x >> 3);
			theByte = data[index];
			mask = 1 << (7 - (x & 0x7));
			if ((pixelValue & 0x1) == 1) {
				data[index] = (byte) (theByte | mask);
			} else {
				data[index] = (byte) (theByte & (mask ^ -1));
			}
			return;
		}
		SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
	}