UTFT Lib and transparent bitmap

I have some bitmaps defined like such

prog_uint16_t Knight[255] PROGMEM={
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x212C, 0x212C, 0x212C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0010 (16) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x212C, 0x2D7B, 0x1C35, 0x1C35, 0x212C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0020 (32) pixels
0x0000, 0x0000, 0x212C, 0x2D7B, 0x1C35, 0x1A70, 0x1A70, 0x1A70, 0x212C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0030 (48) pixels
0x0000, 0x212C, 0x1C35, 0x8222, 0xF56B, 0xC427, 0xC427, 0x5142, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // 0x0040 (64) pixels
0x2061, 0x1A70, 0x5142, 0x2061, 0xF56B, 0x2061, 0x8222, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2061, 0x2061, 0x2061, 0x2061,   // 0x0050 (80) pixels
0x212C, 0x5142, 0x8222, 0x8222, 0x8222, 0x5142, 0x2061, 0x0000, 0x0000, 0x0000, 0x2061, 0xC674, 0xFFFF, 0xFFFF, 0xFFFF, 0x2061,   // 0x0060 (96) pixels
0x212C, 0x8222, 0xF56B, 0xC427, 0x1A70, 0xC674, 0x2061, 0x2061, 0x2061, 0x2061, 0x9532, 0xC674, 0x9532, 0x638C, 0x3A02, 0x2061,   // 0x0070 (112) pixels
0x2061, 0x2061, 0x2061, 0x2061, 0x638C, 0x3A02, 0x2D7B, 0x2061, 0x2061, 0x3A02, 0x2061, 0x5142, 0x2061, 0x638C, 0xFFFF, 0xFFFF,   // 0x0080 (128) pixels
0xC674, 0xC674, 0xC674, 0x3A02, 0x2061, 0x1C35, 0x2061, 0x0000, 0x2061, 0x8222, 0x8222, 0x2061, 0x3A02, 0xC674, 0x9532, 0x9532,   // 0x0090 (144) pixels
0x9532, 0xC674, 0x2061, 0x5142, 0x1C35, 0x2061, 0x0000, 0x5142, 0x8222, 0x8222, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x3A02,   // 0x00A0 (160) pixels
0x2061, 0x2061, 0x2061, 0x1C35, 0x2061, 0x0000, 0x2061, 0x5142, 0x9532, 0xFFFF, 0x638C, 0x2061, 0x1C35, 0x2D7B, 0x1C35, 0x2061,   // 0x00B0 (176) pixels
0x638C, 0x2061, 0x1A70, 0x2061, 0x0000, 0x2061, 0x2061, 0x9532, 0x638C, 0x2061, 0x1C35, 0x2D7B, 0x1A70, 0x1C35, 0x2061, 0x3A02,   // 0x00C0 (192) pixels
0x2061, 0x1A70, 0x2061, 0x0000, 0x0000, 0x2061, 0x2061, 0x2061, 0x1A70, 0x2D7B, 0x1A70, 0x212C, 0x1A70, 0x2061, 0x2061, 0x212C,   // 0x00D0 (208) pixels
0x1A70, 0x2061, 0x0000, 0x0000, 0x0000, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061, 0x2061,   // 0x00E0 (224) pixels
0x0000, 0x0000, 0x0000, 0x0000, 0x2061, 0x8222, 0x2061, 0x2061, 0x0000, 0x2061, 0x2061, 0x8222, 0x5142, 0x2061, 0x0000, 0x0000,   // 0x00F0 (240) pixels
};

I want to draw them with all the black (0x0000) as transparent.
right now I'm using myGLCD.drawBitmap(x,y,width,height,Knight) to draw them.

I was wondering if there is a function I am over looking to draw them transparent or if I can change it to another value to get transparent or do I need to try and work out my own drawBitmap function to get it to do transparent parts?

I would be very happy if transparent pixels where possible but I don't believe they are with the UTFT library, or any other TFT LCD library for that matter.

What you effectively require is the ability to have layers which is probably beyond the cabability of the Arduino.

My solution is to change the surounding pixels (the black 0x0000 in your case) to the same colour as the background that the bitmap will be printed on.

If your display use the SSD1289 controller, it is possible to read the color of a pixel with the RD pin:

http://forum.arduino.cc/index.php?topic=135848.0

So you read the color of the pixels where you want to draw "transparent" things.

I don't know if that is possible for other displays/controllers.

Hum.. well maybe I'll have to see if I can combine the two bitmaps in memory before drawing it to the screen. I think I can capture the cases I need to have "transparency" to only a few occasions. Maybe I can create a mask and do something with that. Thanks for the replies, if I come up with something I'll post the code here.

Here is what I came up with. I am sure it can be optimized, feel free to tweak and repost. It should be as fast as drawing a scaled bitmap. I will try and put in a few optimizations if I can think of them. Right off hand I can think of skipping several transparent colors if they are in a row. I did not test portrait at all yet so it may not work as intended. To use, simply add the following lines to utft.h and utft.cpp

utft.cpp @ line 1166

void UTFT::drawTransBitmap(int x, int y, int sx, int sy, bitmapdatatype data, word transColor)
{
	unsigned int col;
	int tx, ty, tc, tsx, tsy;
	byte r, g, b;
	
	if (orient==PORTRAIT)
	{
		cbi(P_CS, B_CS);
		for (ty=0; ty<sy; ty++)
		{
			for (tx=0; tx<sx; tx++)
			{
				setXY(x, y+ty, x+sx, y+ty);
				col=pgm_read_word(&data[(ty*sx)+tx]);
				if (col!=transColor)
					LCD_Write_DATA(col>>8,col & 0xff);
			}
		}
		sbi(P_CS, B_CS);
	}
	else
	{
		cbi(P_CS, B_CS);
		for (ty=0; ty<sy; ty++)
		{			
			for (tx=sx; tx>=0; tx--)
			{
				setXY(x+tx, y+ty+tsy, x+tx, y+ty+tsy);
				col=pgm_read_word(&data[(ty*sx)+tx]);
				if (col!=transColor)
					LCD_Write_DATA(col>>8,col & 0xff);
			}			
		}
		sbi(P_CS, B_CS);
	}
	clrXY();
}

utft.h @ line 184

void drawTransBitmap(int x, int y, int sx, int sy, bitmapdatatype data, word transColor);