#include #include "EasyBMP.h" #include using namespace std; int main( int argc, char* argv[] ) { BMP Background, Foreground; Background.ReadFromFile(argv[1]); Foreground.ReadFromFile(argv[2]); BMP Output; int w2, h2, w1, h1; w2 = Background.TellWidth(); h2 = Background.TellHeight(); w1 = Foreground.TellWidth(); h1 = Foreground.TellHeight(); Output.SetSize( w2, h2 ); Output.SetBitDepth( 24 ); RangedPixelToPixelCopy( Background, 0, w2-1, h2-1 , 0, Output, 0,0 ); for (int i = 0; i < w1; ++i) for (int j = 0; j < h1; ++j) { int clr = 1; if (Foreground(i,j)->Blue < 50 && Foreground(i,j)->Red < 50 && Foreground(i,j)->Green < 50) clr = 0; if (clr == 0) { Output(w2 - w1 + i,j)->Blue = Foreground(i,j)->Blue; Output(w2 - w1 + i,j)->Red = Foreground(i,j)->Red; Output(w2 - w1 + i,j)->Green = Foreground(i,j)->Green; } }; Output.WriteToFile(argv[3]); return 0; }