?? loadbmp.c
字號:
/****************************************************************************Mouse-capture Version 2:2006-7-5This program is used to get continuous pictures from a jpeg webcam to show them in lcd(240x320,Of course,you can modify the size).It is made for ARM9.It is modified from servfox by daily3(戴麗-戴小鼠 in Hefei University of Technology and HHCN-BBS).Thanks to 我愛狗熊.If you have problems ,you can contact me.Email:daily3@126.comWish you some useful help!Best Wish to the orignal authors! Thank you very much!****************************************************************************/#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>#include "spcav4l.h"#define IDTIMER 100static BITMAP bmp;static int LoadBmpWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ HDC hdc; RECT rc={0,0,240,320}; switch (message) { case MSG_CREATE: SetTimer(hWnd,IDTIMER,100); return 0; case MSG_ERASEBKGND: { RECT rcTemp; if( LoadBitmap(HDC_SCREEN,&bmp,"/tmp/1.jpg")) { printf("load wrong!\n"); return -1; } else printf("load ok!\n"); GetClientRect(hWnd, &rcTemp); hdc = BeginPaint (hWnd); FillBoxWithBitmap (hdc, rcTemp.left, rcTemp.top, rcTemp.right-rcTemp.left, rcTemp.bottom-rcTemp.top, &bmp); EndPaint(hWnd, hdc); return 0; } case MSG_PAINT: if( LoadBitmap(HDC_SCREEN,&bmp,"/tmp/1.jpg")) { printf("load wrong!\n"); return -1; } else printf("load ok!\n"); hdc = BeginPaint (hWnd); FillBoxWithBitmap (hdc, 0, 0, 240, 320, &bmp); Rectangle (hdc, 0, 0, 240, 320); EndPaint (hWnd, hdc); return 0; case MSG_TIMER: InvalidateRect(hWnd,&rc,TRUE); return 0; case MSG_CLOSE: UnloadBitmap (&bmp); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){ MSG Msg; HWND hMainWnd; MAINWINCREATE CreateInfo; char videodevice[] = "/dev/video0"; char jpegfile[] = "/tmp/1.jpg"; int grabmethod = 0; int format = VIDEO_PALETTE_JPEG; int width = 240; int height = 320; int i;#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION; CreateInfo.dwExStyle = WS_EX_NONE; CreateInfo.spCaption = "jpeg show make by daily3"; CreateInfo.hMenu = 0; CreateInfo.hCursor = GetSystemCursor(0); CreateInfo.hIcon = 0; CreateInfo.MainWindowProc = LoadBmpWinProc; CreateInfo.lx = 0; CreateInfo.ty = 0; CreateInfo.rx = 240; CreateInfo.by = 320; CreateInfo.iBkColor = PIXEL_lightwhite; CreateInfo.dwAddData = 0; CreateInfo.hHosting = HWND_DESKTOP; hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; ShowWindow (hMainWnd, SW_SHOWNORMAL); memset(&videoIn, 0, sizeof (struct vdIn)); if(init_videoIn(&videoIn, videodevice, width, height, format,grabmethod) == 0) { printf("init is ok!\n"); } else printf("init is wrong!\n"); while (GetMessage(&Msg, hMainWnd)) { TranslateMessage(&Msg); v4lGrab(&videoIn, jpegfile); DispatchMessage(&Msg); } close_v4l (&videoIn); MainWindowThreadCleanup (hMainWnd); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -