home *** CD-ROM | disk | FTP | other *** search
/ Computer Tool Software / soft.iso / Multimed / WINFAST / WFST230 / DOS / EXAMPLE1 / SAMPLE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-19  |  2.8 KB  |  94 lines

  1. //SAMPLE.C
  2.  
  3. //---------------------------Include & Define (start)------------------------
  4. #include <conio.h>
  5. #include <dos.h>
  6. #include "video.h"
  7. //#include "draw.h"
  8.  
  9. #define     VIDEO                   0x10
  10. #define     TRUE                    1                                      
  11. #define     FALSE                   0
  12. #define     ESC                     27                      
  13.  
  14.  
  15. //-------------------------Local Function Declaration------------------------
  16. int              _TestScale(void);
  17.  
  18. // Memory buffer for storing video image data
  19. BYTE gbImageBuffer[60000];
  20.  
  21. //-------------------------------Main program (start)------------------------
  22. main()
  23. {
  24.     unsigned int i;
  25.  
  26.     VIDEO_SwitchMode(VIDEO_MODE_640x480x8);
  27.  
  28.     DRAW_LeadtekPattern();
  29.  
  30.     VIDEO_Initialize();
  31.     VIDEO_SetVideoPos(0, 0, 640, 480);
  32.     VIDEO_SetVideoSource(1);
  33.     VIDEO_SetInputFormat(VIDEO_NTSC);
  34.     VIDEO_SetHorizontalAlignment(102);
  35.     VIDEO_SetVerticalAlignment(15);        
  36.     VIDEO_EnableVideo();
  37.     VIDEO_UnfreezeVideo();
  38.  
  39.     getch();
  40.  
  41.     // for demostrating "Scale" function
  42.     if(!_TestScale()) {
  43.         VIDEO_End();     
  44.         VIDEO_SwitchMode(VIDEO_MODE_NORMAL);
  45.         return 0;
  46.     }
  47.  
  48.     VIDEO_SetVideoPos(0, 0, 640, 480);
  49.     getch();
  50.     // for demostrating "Freeze" function
  51.     VIDEO_FreezeVideo();
  52.     // for demostrating "Capture video data" function
  53.     VIDEO_LoadImageRect((BYTE _huge *)gbImageBuffer,
  54.                         10, 10, 160,120,
  55.                         VIDEO_BMP_8_GRAY, 0);
  56.     getch();              
  57.  
  58.     // for demostrating "Restore video data" function
  59.     VIDEO_RestoreImageRect((BYTE _huge *)gbImageBuffer,
  60.                         320, 210, 160, 120,
  61.                         VIDEO_BMP_8_GRAY, 0);
  62.     getch();
  63.  
  64.     VIDEO_UnfreezeVideo();
  65.     VIDEO_SetVideoPos(160, 120, 320, 240);
  66.     DRAW_MovPal_WaitKey();
  67.  
  68.     VIDEO_End();     
  69.  
  70.     VIDEO_SwitchMode(VIDEO_MODE_NORMAL);
  71. }
  72.  
  73.  
  74. //-------------------------Local Function (Start)----------------------------
  75. /*---------------------------------------------------------------------------
  76. |                                                                           |
  77. |  Function: _TestScale(void)                                               |
  78. |                                                                           |
  79. |  Purpose: Test window scaling.                                            |
  80. |                                                                           |
  81. ---------------------------------------------------------------------------*/
  82. int _TestScale()
  83. {
  84.     WORD        lwWidth, lwHeight;
  85.  
  86.     for(lwWidth=75, lwHeight=55; lwHeight<=300; lwWidth+=20, lwHeight+=15) {
  87.         VIDEO_SetVideoPos(320-lwWidth/2, 240-lwHeight/2, lwWidth, lwHeight);
  88.         if(!DRAW_Delay_MovPal_WaitKey()) return 0;
  89.     }
  90.     return 1;
  91. }
  92.         
  93. //----------------------------------(End)----------------------------------
  94.