WORD PutImage(SHORT left, SHORT top, void *bitmap, BYTE stretch) { FLASH_BYTE *flashAddress; BYTE colorDepth; WORD colorTemp; #ifndef USE_NONBLOCKING_CONFIG while(IsDeviceBusy() != 0); /* Ready */ #else if(IsDeviceBusy() != 0) return (0); #endif // Save current color colorTemp = _color; switch(*((SHORT *)bitmap)) { #ifdef USE_BITMAP_FLASH case FLASH: // Image address flashAddress = ((BITMAP_FLASH *)bitmap)->address; // Read color depth colorDepth = *(flashAddress + 1); // Draw picture switch(colorDepth) { case 1: PutImage1BPP(left, top, flashAddress, stretch); break; case 4: PutImage4BPP(left, top, flashAddress, stretch); break; case 8: PutImage8BPP(left, top, flashAddress, stretch); break; case 16: PutImage16BPP(left, top, flashAddress, stretch); break; } break; #endif #ifdef USE_BITMAP_EXTERNAL case EXTERNAL: // Get color depth ExternalMemoryCallback(bitmap, 1, 1, &colorDepth); // Draw picture switch(colorDepth) { case 1: PutImage1BPPExt(left, top, bitmap, stretch); break; case 4: PutImage4BPPExt(left, top, bitmap, stretch); break; case 8: PutImage8BPPExt(left, top, bitmap, stretch); break; case 16: PutImage16BPPExt(left, top, bitmap, stretch); break; default: break; } break; #endif default: break; } // Restore current color _color = colorTemp; return (1); }
/********************************************************************* * Function: void PutImage(SHORT left, SHORT top, void* bitmap, BYTE stretch) * * PreCondition: none * * Input: left,top - left top image corner, * bitmap - image pointer, * stretch - image stretch factor * * Output: none * * Side Effects: none * * Overview: outputs image starting from left,top coordinates * * Note: image must be located in flash * ********************************************************************/ void PutImage(SHORT left, SHORT top, void* bitmap, BYTE stretch){ FLASH_BYTE* flashAddress; BYTE colorDepth; WORD colorTemp; #ifndef USE_PORTRAIT top = GetMaxY() - top; #endif // Save current color colorTemp = _color.Val; switch(*((SHORT*)bitmap)) { #ifdef USE_BITMAP_FLASH case FLASH: // Image address flashAddress = ((BITMAP_FLASH*)bitmap)->address; // Read color depth colorDepth = *(flashAddress+1); // Draw picture switch(colorDepth){ case 1: PutImage1BPP(left, top, flashAddress, stretch); break; case 4: PutImage4BPP(left, top, flashAddress, stretch); break; case 8: PutImage8BPP(left, top, flashAddress, stretch); break; case 16: PutImage16BPP(left, top, flashAddress, stretch); break; } break; #endif #ifdef USE_BITMAP_EXTERNAL case EXTERNAL: // Get color depth ExternalMemoryCallback(bitmap, 1, 1, &colorDepth); // Draw picture switch(colorDepth){ case 1: PutImage1BPPExt(left, top, bitmap, stretch); break; case 4: PutImage4BPPExt(left, top, bitmap, stretch); break; case 8: PutImage8BPPExt(left, top, bitmap, stretch); break; case 16: PutImage16BPPExt(left, top, bitmap, stretch); break; default: break; } break; #endif default: break; } // Restore current color _color.Val = colorTemp; }