home *** CD-ROM | disk | FTP | other *** search
- //SAMPLE.C
-
- //---------------------------Include & Define (start)------------------------
- #include <conio.h>
- #include <dos.h>
- #include "video.h"
- //#include "draw.h"
-
- #define VIDEO 0x10
- #define TRUE 1
- #define FALSE 0
- #define ESC 27
-
-
- //-------------------------Local Function Declaration------------------------
- int _TestScale(void);
-
- // Memory buffer for storing video image data
- BYTE gbImageBuffer[60000];
-
- //-------------------------------Main program (start)------------------------
- main()
- {
- unsigned int i;
-
- VIDEO_SwitchMode(VIDEO_MODE_640x480x8);
-
- DRAW_LeadtekPattern();
-
- VIDEO_Initialize();
- VIDEO_SetVideoPos(0, 0, 640, 480);
- VIDEO_SetVideoSource(1);
- VIDEO_SetInputFormat(VIDEO_NTSC);
- VIDEO_SetHorizontalAlignment(102);
- VIDEO_SetVerticalAlignment(15);
- VIDEO_EnableVideo();
- VIDEO_UnfreezeVideo();
-
- getch();
-
- // for demostrating "Scale" function
- if(!_TestScale()) {
- VIDEO_End();
- VIDEO_SwitchMode(VIDEO_MODE_NORMAL);
- return 0;
- }
-
- VIDEO_SetVideoPos(0, 0, 640, 480);
- getch();
- // for demostrating "Freeze" function
- VIDEO_FreezeVideo();
- // for demostrating "Capture video data" function
- VIDEO_LoadImageRect((BYTE _huge *)gbImageBuffer,
- 10, 10, 160,120,
- VIDEO_BMP_8_GRAY, 0);
- getch();
-
- // for demostrating "Restore video data" function
- VIDEO_RestoreImageRect((BYTE _huge *)gbImageBuffer,
- 320, 210, 160, 120,
- VIDEO_BMP_8_GRAY, 0);
- getch();
-
- VIDEO_UnfreezeVideo();
- VIDEO_SetVideoPos(160, 120, 320, 240);
- DRAW_MovPal_WaitKey();
-
- VIDEO_End();
-
- VIDEO_SwitchMode(VIDEO_MODE_NORMAL);
- }
-
-
- //-------------------------Local Function (Start)----------------------------
- /*---------------------------------------------------------------------------
- | |
- | Function: _TestScale(void) |
- | |
- | Purpose: Test window scaling. |
- | |
- ---------------------------------------------------------------------------*/
- int _TestScale()
- {
- WORD lwWidth, lwHeight;
-
- for(lwWidth=75, lwHeight=55; lwHeight<=300; lwWidth+=20, lwHeight+=15) {
- VIDEO_SetVideoPos(320-lwWidth/2, 240-lwHeight/2, lwWidth, lwHeight);
- if(!DRAW_Delay_MovPal_WaitKey()) return 0;
- }
- return 1;
- }
-
- //----------------------------------(End)----------------------------------
-