Guest User

Untitled

a guest
Oct 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. int main( int argc, char* argv[] )
  2. {
  3. BMP ImageIn;
  4. const char* source = "1.bmp";
  5. ImageIn.ReadFromFile( source );
  6.  
  7. int NewWidth = (int) ( ImageIn.TellWidth() * 2 / 100.0 );
  8. int NewHeight = (int) ( ImageIn.TellHeight() * 2 / 100.0 );
  9.  
  10. BMP ImageOut;
  11. ImageOut.SetSize( NewWidth, NewHeight );
  12.  
  13. if( ImageIn.TellBitDepth() == 32 )
  14. { ImageOut.SetBitDepth( 32 ); }
  15. else
  16. { ImageOut.SetBitDepth( 24 ); }
  17.  
  18. for(int j=0 ; j <ImageOut.TellHeight() ; j++)
  19. {
  20. for(int i=0 ; i < ImageOut.TellWidth() ; i++)
  21. {
  22. RGBApixel Temp = GetPixel( ImageIn , i , ImageOut.TellWidth() , j , ImageOut.TellHeight() );
  23. *ImageOut(i,j) = Temp;
  24. }
  25. }
  26. int width = bmp.TellWidth( void );
  27. int height = bmp.TellHeight( void );
  28. char * oncearray = new char[width*height*3];
  29. for(int j = 0; j<height; j++)
  30. for(int i = 0; i<width, i++)
  31. {
  32. oncearray[j*width+i] = bmp.GetPixel(i,j);
  33. }
  34. //какая-то обработка массива onesarray
  35.  
  36. for(int j = 0; j<height; j++)
  37. for(int i = 0; i<width, i++)
  38. {
  39. bmp.GetPixel(i,j) = oncearray[j*width+i];
  40. }
  41.  
  42. // determine the output filename
  43. char * OutputName = "2.bmp";
  44.  
  45. ImageOut.WriteToFile( OutputName );
Add Comment
Please, Sign In to add comment