void bmp_drawTest(char * bmp_name, unsigned int x, unsigned int y) { unsigned int i=0; // unsigned char * lookup_table = &bmp_lookup_table[0]; unsigned long bmp_loc=0; unsigned int index; uint8_t nameLength; //uint8_t bmpNameLen = strlen(bmp_name); COLOR black = {0,0,0}; COLOR white = {255,255,255}; cli(); //disable interrupts bmp_loc = bmp_find(bmp_name); /* Bitmap not found error handling here */ #if 0 if (bmp_loc == 0) { /* Display the not found placeholder */ dispPutS(bmp_name,x,y,white,black); return; } #endif unsigned char bmp_buff[DATAFLASH_PAGESIZE]; /* Get the width and height */ dataflash_read_block(bmp_buff,bmp_loc,4); uint16_t width = (uint16_t)(bmp_buff[0]<<8) + bmp_buff[1]; uint16_t height = (uint16_t)(bmp_buff[2]<<8) + bmp_buff[3]; uint32_t length = (uint32_t)width * (uint32_t)height; uint16_t byteCnt=0; dispSetWindow(x,y,width-1,height); /* Incremement the bmp pointer passed the width/height */ bmp_loc+=4; dataflash_read_block(bmp_buff, bmp_loc, DATAFLASH_PAGESIZE); while (length--) { GraphicsColor.blue = bmp_buff[byteCnt]; GraphicsColor.green = bmp_buff[byteCnt+1]; GraphicsColor.red = bmp_buff[byteCnt+2]; dispPix(); byteCnt+=3; if (byteCnt>=528) { bmp_loc+=528; dataflash_read_block(bmp_buff, bmp_loc, DATAFLASH_PAGESIZE); byteCnt=0; } } sei(); //enable interrupts }
//******************************************************** // A processing style image loading function. // Returns image pointer to an external flash location PImage loadImage(char * fileName) { /* Get the image page location */ return (PImage)bmp_find(fileName); }