home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 1 / ACE CD 1.iso / files / utils / framema2.dms / in.adf / DEVELOPER / demo / demo.c next >
Encoding:
C/C++ Source or Header  |  1993-05-03  |  3.8 KB  |  146 lines

  1. /************************************************************************
  2.  
  3.  NAME               demo.c
  4.  
  5.  VERSION            1.00
  6.  
  7.  LAST EDIT          Thursday 08-Apr-93 23:50:35
  8.  
  9.  LOCKED BY          -
  10.  
  11.  DESCRIPTION        demo-functions for Library
  12.  
  13.  HISTORY            Author  Date        Comment
  14.                     ---------------------------------------------------
  15.                     ds      30-04-93    created
  16.  
  17. *************************************************************************/
  18.  
  19. #include    <exec/types.h>
  20. #include    <exec/libraries.h>
  21. #include    <proto/exec.h>
  22. #include    <proto/dos.h>
  23.  
  24. #include    "/include/fm.h"
  25. #include    "/include/fmpragma.h"
  26.  
  27.  
  28. struct  Library *FrameMachineBase;
  29. extern  struct  Library *SysBase;
  30. extern  struct  DOSBase *DOSBase;
  31.  
  32. VOID main(int argc, char *argv[])
  33. {
  34.     WORD    status;
  35.     WORD    xpos, ypos, loop;
  36.  
  37.     FrameMachineBase = OpenLibrary("framemachine.library",0);
  38.     if (FrameMachineBase)
  39.     {
  40.         /* NEVER! Forget to lock FrameMachine! */
  41.         LockFM();
  42.  
  43.         xpos = 0; ypos=0;
  44.         DisplaySize(PDP_360);
  45.         DisplayPos(&xpos, &ypos);
  46.  
  47.         if (PrismAttached())
  48.         {
  49.             /* Show RGB->YUV-Conversation:  */
  50.             printf("\nTransfering RGB24-Data to Prism24...\n");
  51.             status = PrepWrite(640,512, WRITE_COLOR, NULL, NULL, NULL);
  52.             if (!status)
  53.             {
  54.                 UBYTE r[640],g[640],b[640];
  55.                 WORD xloop, yloop;
  56.  
  57.                 for (yloop=0; yloop<512 && !status; yloop++)
  58.                 {
  59.                     /* Make new line of RGB-Data:   */
  60.                     for (xloop=0; xloop<640; xloop++)
  61.                     {
  62.                         r[xloop] = xloop;
  63.                         g[xloop] = yloop;
  64.                         b[xloop] = 0;
  65.                     }
  66.  
  67.                     status = WriteRGB24Line(r,g,b);
  68.                 }
  69.  
  70.                 EndWrite();
  71.  
  72.                 printf("...done. Errors:%s\n", ExplainStatus(status));
  73.             }
  74.         }
  75.  
  76.         printf("\nToying around with display...\n");
  77.         status = DisplaySize(PDP_360);
  78.         if (!status)
  79.         {
  80.             xpos = 0;
  81.             ypos = 100;
  82.             DisplayPos(&xpos, &ypos);
  83.         }
  84.  
  85.         DigiState(TRUE);   /* Activate Digitizer    */
  86.         Delay(100);
  87.  
  88.         DigiState(FALSE);  /* Hold current frame    */
  89.         Delay(100);
  90.         xpos=300;
  91.         ypos= 100;
  92.         DisplayPos(&xpos, &ypos);
  93.  
  94.         DigiState(TRUE);   /* Activate Digitizer    */
  95.         Delay(100);
  96.  
  97.         SnapShot();        /* make a full resolution snapshot  */
  98.         Delay(100);
  99.  
  100.         printf("\nPreviewing...\n");
  101.         status = FastPreview(MD_QUATER);
  102.         printf("...done. Errors:%s\n", ExplainStatus(status));
  103.  
  104.         /* Recording 10 frames to ram:  */
  105.         printf("\nRecording 10 frames to 'ram:test.edan'\n");
  106.         if (!status)    status = DisplaySize(PDP_360);
  107.         if (!status)    status = DigiState(TRUE);
  108.  
  109.         status = PrepSaveEDAN("RAM:test.EDAN", 10, EDAN_COLOR);
  110.         if (!status)
  111.             for (loop=0; loop<10 && !status; loop++)
  112.                 status = RecordFrame();
  113.         EndSaveEDAN();
  114.         printf("...done. Errors:%s\n", ExplainStatus(status));
  115.  
  116.         DisplaySize(PDP_720);
  117.         DigiState(TRUE);
  118.         Delay(100);
  119.  
  120.         printf("\nPlaying 10 frames from 'ram:test.edan' in slow motion...\n");
  121.         status = PrepLoadEDAN("ram:test.EDAN", 0);
  122.         while (!status)
  123.         {
  124.             status = NextFrame();
  125.             Delay(25);
  126.         }
  127.         EndLoadEDAN();
  128.         printf("...done. Errors:%s\n", ExplainStatus(status));
  129.  
  130.         printf("\nClearing display...\n");
  131.         status = ClearDisplay();
  132.         printf("...done. Errors:%s\n", ExplainStatus(status));
  133.  
  134.         printf("\n\n Thats all folks!\n");
  135.  
  136.         UnLockFM();
  137.     }
  138.  
  139.  
  140.  
  141.     if (FrameMachineBase)   CloseLibrary(FrameMachineBase);
  142. }
  143.  
  144.  
  145.  
  146.