bitetti

FreeImage overlay images

Nov 18th, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #include "FreeImage.h"
  6.  
  7. int main()
  8. {
  9.     cout << "Hello world!" << endl;
  10.  
  11.     FIBITMAP* arquivo = FreeImage_Load( FIF_JPEG , "_tela.02.jpg", 0);
  12.     FIBITMAP* paste = FreeImage_Load( FIF_JPEG , "tux-avatar-kakashi.jpg", 0);
  13.  
  14.  
  15.  
  16.     // coloca sobre
  17.     RGBQUAD src, dst;
  18.     int wSrc,hSrc, wDst, hDst;
  19.     int offset = 0;
  20.     int userOffset = 0;
  21.     wSrc = FreeImage_GetWidth(paste);
  22.     hSrc = FreeImage_GetHeight(paste);
  23.     wDst = FreeImage_GetWidth(arquivo);
  24.     hDst = FreeImage_GetHeight(arquivo);
  25.  
  26.     offset = ( hDst - userOffset) - hSrc;
  27.  
  28.     for( int x=0; x<wSrc; x++)
  29.     {
  30.         for( int y=0;y<hSrc; y++)
  31.         {
  32.             FreeImage_GetPixelColor(paste, x,y, &src);
  33.             FreeImage_SetPixelColor(arquivo, x,y+offset, &src );
  34.         }
  35.     }
  36.  
  37.     FreeImage_Save(FIF_JPEG,arquivo, "saida.jpg", 90);
  38.  
  39.     return 0;
  40. }
  41.  
  42.  
Add Comment
Please, Sign In to add comment