public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) {
public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) {
public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) {	if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);	if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);	if (putWidth == 0) return;	int index;	int theByte;	int mask;	int n = putWidth;	int i = startIndex;	int pixel;	int srcX = x, srcY = y;	if (depth == 1) {		index = (y * bytesPerLine) + (x >> 3);		while (n > 0) {			mask = 1 << (7 - (srcX & 0x7));			if ((pixels[i] & 0x1) == 1) {				data[index] = (byte)((data[index] & 0xFF) | mask);			} else {				data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));			}			i++;			n--;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				srcX = 0;			} else {				if (mask == 1) {					index++;				}			}		}		return;	}	if (depth == 2) {		byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F };		index = (y * bytesPerLine) + (x >> 2);		int offset = 3 - (x % 4);		while (n > 0) {			theByte = pixels[i] & 0x3;			data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));			i++;			n--;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				offset = 3;				srcX = 0;			} else {				if (offset == 0) {					index++;					offset = 3;				} else {					offset--;				}			}		}		return;	}	if (depth == 4) {		index = (y * bytesPerLine) + (x >> 1);		boolean high = (x & 0x1) == 0;		while (n > 0) {			theByte = pixels[i] & 0x0F;			if (high) {				data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));			} else {				data[index] = (byte)((data[index] & 0xF0) | theByte);			}			i++;			n--;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				high = true;				srcX = 0;			} else {				if (!high) index++;				high = !high;			}		}		return;	}	if (depth == 8) {		index = (y * bytesPerLine) + x;		for (int j = 0; j < putWidth; j++) {			data[index] = (byte)(pixels[i] & 0xFF);			i++;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				srcX = 0;			} else {				index++;			}		}		return;	}	if (depth == 16) {		index = (y * bytesPerLine) + (x * 2);		for (int j = 0; j < putWidth; j++) {			pixel = pixels[i];			data[index] = (byte)(pixel & 0xFF);			data[index + 1] = (byte)((pixel >> 8) & 0xFF);			i++;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				srcX = 0;			} else {				index += 2;			}		}		return;	}	if (depth == 24) {		index = (y * bytesPerLine) + (x * 3);		for (int j = 0; j < putWidth; j++) {			pixel = pixels[i];			data[index] = (byte)((pixel >> 16) & 0xFF);			data[index + 1] = (byte)((pixel >> 8) & 0xFF);			data[index + 2] = (byte)(pixel & 0xFF);			i++;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				srcX = 0;			} else {				index += 3;			}		}		return;	}	if (depth == 32) {		index = (y * bytesPerLine) + (x * 4);		for (int j = 0; j < putWidth; j++) {			pixel = pixels[i];			data[index] = (byte)((pixel >> 24) & 0xFF);			data[index + 1] = (byte)((pixel >> 16) & 0xFF);			data[index + 2] = (byte)((pixel >> 8) & 0xFF);			data[index + 3] = (byte)(pixel & 0xFF);			i++;			srcX++;			if (srcX >= width) {				srcY++;				index = srcY * bytesPerLine;				srcX = 0;			} else {				index += 4;			}		}		return;	}	SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);}