⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadbmp.c

📁 2410下面摄像头抓图程序
💻 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 + -