home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI10.ARJ / ictari.10 / C / BOINKOUT / CONVERT.C < prev    next >
C/C++ Source or Header  |  1987-04-22  |  2KB  |  110 lines

  1. /***************************************
  2.     convert.c
  3.  
  4. The file bout2.pi3 contains the monochrome
  5. images used in boinkout. This program converts
  6. a high res degas picture to 2 medium res pictures,
  7. one for the even scan lines and one for the odd scan
  8. lines of the original.  (half the resolution is lost
  9. going to medium res, and for each animation you can
  10. pick the half that looks better). The reason I use
  11. this program instead of degas' conversion is this
  12. one doesn't attempt anti-aliasing: The resulting
  13. medium res picture is just black and white.
  14. ***************************************/
  15.  
  16. #include <obdefs.h>
  17. #include <gemdefs.h>
  18. #include <osbind.h>
  19. #include <math.h>
  20.  
  21. int buf1[16500], buf2[16500], buf3[16500];
  22.  
  23. #define TRUE 1
  24. #define FALSE 0
  25.  
  26. /* A degas file header... */
  27. int junk[] = 
  28.     {
  29.     0x0001,
  30.     0x0777,
  31.     0x0700,
  32.     0x0070,
  33.     0x0000,
  34.     0x0777,
  35.     0x0700,
  36.     0x0070,
  37.     0x0770,
  38.     0x0007,
  39.     0x0707,
  40.     0x0077,
  41.     0x0555,
  42.     0x0333,
  43.     0x0733,
  44.     0x0373,
  45.     0x0773
  46.     };
  47.  
  48. main()
  49. {
  50.     register int *ptr1, *ptr2;
  51.     int *ptr3;
  52.     register int i,j,xhand;
  53.  
  54.     Cconws("\033E");
  55.  
  56.     xhand = Fopen("bout2.pi3",0);
  57.     if (xhand > 0)
  58.     {
  59.         Fread(xhand,(long)34L,buf1);
  60.         Fread(xhand,(long)32000L,buf1);
  61.         Fclose(xhand);
  62.     }
  63.     else Cconws("read error\r\n");
  64.  
  65.     ptr1 = buf1;
  66.     ptr2 = buf2;
  67.  
  68.     for (i=0; i<200; i++)
  69.     {
  70.         for (j=0;j<40;j++)
  71.         {
  72.             *ptr2++ = *ptr1;
  73.             *ptr2++ = *ptr1++;
  74.         }
  75.         ptr1 += 40;
  76.     }
  77.  
  78.     ptr1 = buf1;
  79.     ptr3 = buf3;
  80.  
  81.     for (i=0; i<200; i++)
  82.     {
  83.         ptr1 += 40;
  84.         for (j=0;j<40;j++)
  85.         {
  86.             *ptr3++ = *ptr1;
  87.             *ptr3++ = *ptr1++;
  88.         }
  89.     }
  90.  
  91.     xhand = Fcreate("bouteven.pi2",0);
  92.     if (xhand > 0)
  93.     {
  94.         Fwrite(xhand,(long)34L,junk);
  95.         Fwrite(xhand,(long)32000L,buf2);
  96.         Fclose(xhand);
  97.     }
  98.     else Cconws("create error\r\n");
  99.  
  100.     xhand = Fcreate("boutodd.pi2",0);
  101.     if (xhand > 0)
  102.     {
  103.         Fwrite(xhand,(long)34L,junk);
  104.         Fwrite(xhand,(long)32000L,buf3);
  105.         Fclose(xhand);
  106.     }
  107.     else Cconws("create error\r\n");
  108.     Cnecin();
  109. }
  110.