Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //считывание в main
- FILE * source = fopen(sourcefn, "rb");
- BMP ImageIn;
- ImageIn.ReadFromFile( sourcefn );
- int width = ImageIn.TellWidth();
- int height = ImageIn.TellHeight();
- cout<<"readRGBA"<<endl;
- char * buffer = new char[width*height*BYTES];
- for(int j = 0; j<height; j++)
- {
- for(int i = 0; i<width; i++)
- {
- RGBApixel pix = ImageIn.GetPixel(i,j);
- buffer[BYTES*(j*width+i) + 0] = pix.Blue;
- buffer[BYTES*(j*width+i) + 1] = pix.Green;
- buffer[BYTES*(j*width+i) + 2] = pix.Red;
- buffer[BYTES*(j*width+i) + 3] = 127;
- }
- }
- //запись в rekurswrite
- BMP ImageOut;
- ImageOut.SetSize( 1024, 1024 );
- ImageOut.SetBitDepth( 32 );
- for(int j = 0; j<SCBLOCK_H; j++)
- for(int i = 0; i< SCBLOCK_W; i++)
- {
- RGBApixel pix;
- pix.Red = subimage[BYTES*j*SCBLOCK_W+i + 0];
- pix.Green = subimage[BYTES*j*SCBLOCK_W+i + 1];
- pix.Blue = subimage[BYTES*j*SCBLOCK_W+i + 2];
- pix.Alpha = 0;
- ImageOut.SetPixel( i, j, pix);
- }
- string title = source+string(".bmp");
- const char * name = title.c_str();
- ImageOut.WriteToFile(name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement