1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163:
| #include "stdafx.h" #include <windows.h> #include <psucapi.h>
int _tmain(int argc, _TCHAR* argv[]) { PSUC_HANDLE handle = PSUC_Open(); if( handle != NULL ) { PSUC_InitLCD(handle); Sleep(1000); printf("Test Textausgabe 1\n"); PSUC_Text2LCD(handle,TEXT("Test 1")); #if 1
Sleep(2000); printf("Test Textausgabe 2 (ANSI), Background color\n"); PSUC_Text2LCD(handle,TEXT("Test 1")); PSUC_SetBackgroundColor(handle,255,255,0); PSUC_Text2LCDA(handle,"Test 2 äöüßÄÖÜ"); Sleep(2000); printf("Test Textausgabe 3 (UNICODE), Foreground color\n"); PSUC_SetForegroundColor(handle,0,0,0); PSUC_Text2LCDW(handle,L"Test 3 äöüßÄÖÜ"); Sleep(2000);
PSUC_SetForegroundColor(handle,0,255,0); PSUC_SetBackgroundColor(handle,0,0,0);
printf("Test Textausgabe Raw Zeichen code 0 - 127\n");
BYTE CharSet[256]; for(int i = 0; i < sizeof(CharSet); i += 1 ) CharSet[i] = BYTE(i); PSUC_Text2LCDRaw(handle,CharSet,128);
Sleep(5000); printf("Test Textausgabe Raw Zeichen code 128 - 255\n");
PSUC_Text2LCDRaw(handle,&CharSet[128],128);
Sleep(5000);
printf("Test Invert\n");
for(int i = 0; i < 10; i += 1) { PSUC_SetMode(handle,1); Sleep(250); PSUC_SetMode(handle,0); Sleep(250); }
printf("Test Boot graphic\n");
PSUC_ShowBootGraphic(handle);
printf("Test Brightness\n");
for(int j = 0; j < 5; j += 1 ) { for(int i = 255; i >= 0 ; i -= 5 ) { PSUC_SetBrightness(handle,BYTE(i)); Sleep(50); }
for(int i = 0; i <= 255; i += 5 ) { PSUC_SetBrightness(handle,BYTE(i)); Sleep(50); } } #endif Sleep(1000); TCHAR *FileNames[] = { TEXT("PIC10.BMP"), TEXT("LION.BMP"), TEXT("PIC6.BMP"), NULL };
int index = 0; while(1) { TCHAR* pFileName = FileNames[index]; if( pFileName == NULL ) break; printf("Test Graphic %s\n",pFileName);
HBITMAP hbmp = NULL; HDC hdc = NULL; do { hbmp = (HBITMAP)LoadImage(NULL,pFileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); if( hbmp == INVALID_HANDLE_VALUE ) break;
HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL); if (hdc == NULL) break;
BITMAPINFO BMPInfo; memset(&BMPInfo,0,sizeof(BMPInfo)); BMPInfo.bmiHeader.biSize = sizeof(BMPInfo);
int r = GetDIBits(hdc,hbmp,0,0,NULL,&BMPInfo,DIB_RGB_COLORS); if( r == 0 ) break;
printf(" biSize %d/%d\n",BMPInfo.bmiHeader.biSize,sizeof(BMPInfo)); printf(" biSizeImage %d\n",BMPInfo.bmiHeader.biSizeImage); printf(" biWidth %d\n",BMPInfo.bmiHeader.biWidth); printf(" biHeight %d\n",BMPInfo.bmiHeader.biHeight); printf(" biBitCount %d\n",BMPInfo.bmiHeader.biBitCount); printf(" biPlanes %d\n",BMPInfo.bmiHeader.biPlanes); printf(" biClrUsed %d\n",BMPInfo.bmiHeader.biClrUsed);
if( BMPInfo.bmiHeader.biPlanes != 1 ) break; if( BMPInfo.bmiHeader.biHeight != 64 ) break; if( BMPInfo.bmiHeader.biWidth != 128 ) break; if( BMPInfo.bmiHeader.biBitCount != 1 && BMPInfo.bmiHeader.biBitCount != 24 && BMPInfo.bmiHeader.biBitCount != 32 ) break;
int BMPInfoSize = sizeof(BITMAPINFOHEADER); if( BMPInfo.bmiHeader.biCompression == BI_BITFIELDS ) BMPInfoSize += 12; else BMPInfoSize += BMPInfo.bmiHeader.biClrUsed * sizeof(RGBQUAD);
BITMAPINFO* pBMPInfo = (BITMAPINFO*) ( new BYTE[BMPInfoSize] ); if( pBMPInfo != NULL ) { *pBMPInfo = BMPInfo; }
BYTE* pBuffer = new BYTE[BMPInfo.bmiHeader.biSizeImage]; if( pBuffer != NULL ) { memset(pBuffer,0,BMPInfo.bmiHeader.biSizeImage); r = GetDIBits(hdc,hbmp,0,64,pBuffer,pBMPInfo,DIB_RGB_COLORS); printf( " GetDIBits %d\n",r); PSUC_Frame2LCD(handle,pBuffer,BMPInfo.bmiHeader.biSizeImage); } } while(0); if( hbmp != NULL ) CloseHandle(hbmp); if( hdc != NULL ) CloseHandle(hdc);
index += 1; Sleep(5000); }
PSUC_SetForegroundColor(handle,255,0,0); PSUC_SetBackgroundColor(handle,32,32,64);
PSUC_PrintA(handle,3,2*8,"End");
PSUC_Close(handle); } return 0; } |