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