コード例 #1
0
ファイル: g15macro.c プロジェクト: garismaatti/g15daemon
//TODO: Put into libg15render instead
void drawXBM(g15canvas* canvas, unsigned char* data, int width, int height ,int pos_x, int pos_y)
{
	int y = 0;
	int z = 0;
	unsigned char byte;
	int bytes_per_row = ceil((double) width / 8);

	int bits_left = width;
	int current_bit = 0;

	for(y = 0; y < height; y ++)
	{
		bits_left = width;
		for(z=0;z < bytes_per_row; z++)
		{
			byte = data[(y * bytes_per_row) + z];
			current_bit = 0;
			while(current_bit < 8)
			{
				if(bits_left > 0)
				{
					if((byte >> current_bit) & 1) g15r_setPixel(canvas, (current_bit + (z*8) + pos_x),y + pos_y,G15_COLOR_BLACK);
					bits_left--;
				}
				current_bit++;
			}
		}
	}
}
コード例 #2
0
ファイル: g15.c プロジェクト: emteejay/lcdproc
MODULE_EXPORT void g15_num(Driver *drvthis, int x, int num)
{
	PrivateData *p = drvthis->private_data;

	x--;
	int ox = x * p->cellwidth;

	if ((num < 0) || (num > 10))
		return;

	int width = 0;
	int height = 43;

	if ((num >= 0) && (num <=9))
		width = 24;
	else
		width = 9;

	int i=0;

   	for (i=0;i<(width*height);++i)
   	{
      	int color = (g15_bignum_data[num][i] ? G15_COLOR_WHITE : G15_COLOR_BLACK);
      	int px = ox + i % width;
      	int py = i / width;
      	g15r_setPixel(p->canvas, px, py, color);
   	}
}