private void sendBiColorLine(int[] pixels, int width, int y, int toX,
			int toY, int c0, int c1, DisplayMessage m) {
		int offset = y * width;
		int count = 0;// number of contiguous pixels

		int currentColor = pixels[offset];
		Vector<Integer> counts = new Vector<Integer>();
		// System.out.println("Analysing line");
		for (int i = 0; i < width; i++) {
			int p1 = pixels[offset];
			offset++;
			// System.out.print(p1 + " ,");
			if (p1 == currentColor) {
				count++;
			} else {
				counts.addElement(count);
				count = 1;
				currentColor = p1;
			}

		}
		if (count > 0) {
			counts.addElement(count);
		}
		// System.out.println();
		// System.out.println("Counts:");
		int offsetX = 0;
		int lastSentX = 0;
		// for (int i = 0; i < counts.size(); i++) {
		// int nb = counts.elementAt(i);
		// System.out.print(nb + " ,");
		// }
		// System.out.println();
		int size = counts.size();
		for (int i = 0; i < size; i++) {
			int nb = counts.elementAt(i);

			if (nb > 16) {
				// Sending mono
				int nbMono = offsetX - lastSentX;
				if (nbMono > 0) {
					// System.out.println("Bi "+(toX + lastSentX)+","+(toY +
					// y)+" "+nbMono+"x1");
					BitArray b = BitmapOperation.getBytes(pixels, width,
							lastSentX, y, nbMono, 1, c1);
					BitmapOperation bOp = new BitmapOperation(
							(toX + lastSentX), (toY + y), nbMono, 1, new Color(
									c0), new Color(c1), b);
					m.addOperation(bOp);
				}
				// Sending fill
				// System.out.println("Fill rect:"+(toX + offsetX)+","+(toY +
				// y)+" "+nb+"x1");
				FillOperation fOp = new FillOperation(toX + offsetX, toY + y,
						nb, 1, new Color(pixels[y * width + offsetX]));
				m.addOperation(fOp);
				lastSentX = offsetX + nb;
			}
			offsetX += nb;

		}
		int nbMono = offsetX - lastSentX;
		if (nbMono > 0) {
			// System.out.println("Bi "+(toX + lastSentX)+","+(toY +
			// y)+" "+nbMono+"x1");
			BitArray b = BitmapOperation.getBytes(pixels, width, lastSentX, y,
					nbMono, 1, c1);
			BitmapOperation bOp = new BitmapOperation((toX + lastSentX),
					(toY + y), nbMono, 1, new Color(c0), new Color(c1), b);
			m.addOperation(bOp);
		}
		// System.out.println();
	}