home *** CD-ROM | disk | FTP | other *** search
/ The Party 1994: Try This At Home / disk_image.bin / source / vexsrc / mergepic.cpp < prev    next >
C/C++ Source or Header  |  1995-03-29  |  2KB  |  46 lines

  1. /*****************************************************************************
  2.                                   ATTENTION!
  3.                            this source is VOTEWARE,
  4.               you may only use it to the conditions listed below:
  5.  
  6.   -You may modify it, or use parts of it in your own source as long as
  7.     this header stays on top of all files containing this source.
  8.   -You must give proper credit to the author, Niklas Beisert / pascal.
  9.   -You may not use it in commercial productions without the written
  10.     permission of the author.
  11.   -AND MOST IMPORTANT: you have to buy an Assembly '94 CD-ROM
  12.     by Sound Solutions (if you don't have it already) and vote for VEX-InTrO
  13.     in the PC-64k-Intro-Compo! (if you have already sent your voting card,
  14.     buy another one and fill it out CORRECTLY!!!)
  15. *****************************************************************************/
  16.  
  17.  
  18.  
  19. // merge 2 4-color tgas for crossfade
  20.  
  21. #include <io.h>
  22. #include <fcntl.h>
  23. #include <sys\stat.h>
  24.  
  25. void main()
  26. {
  27.   unsigned char *buf=new unsigned char [64000];
  28.   unsigned char *buf2=new unsigned char [64000];
  29.   if (!buf||!buf2)
  30.     return;
  31.   int f=open("asscont.tga", O_RDONLY|O_BINARY);
  32.   lseek(f, 18+768, SEEK_SET);
  33.   read(f, buf, 64000);
  34.   close(f);
  35.   f=open("pdpres.tga", O_RDONLY|O_BINARY);
  36.   lseek(f, 18+768, SEEK_SET);
  37.   read(f, buf2, 64000);
  38.   close(f);
  39.   long i;
  40.   for (i=0; i<64000; i++)
  41.     buf2[i]|=buf[i]<<2;
  42.   f=open("pdpres.scr", O_WRONLY|O_BINARY|O_TRUNC|O_CREAT, S_IREAD|S_IWRITE);
  43.   write(f, buf2, 64000);
  44.   close(f);
  45. }
  46.