Пример #1
0
MyImage MyImage::over(MyImage& image, int posx, int posy){
	MyImage newImage(image.to4ChannelsImage());

	for(int y = 0; y< height && (y+posy)< newImage.height ; y++){
		for(int x = 0; x< width && (x+posx< newImage.width ); x++){
			for(int c = 0; c< 3; c++){
				newImage.data[c + (x+posx) *4 + (y+posy)*newImage.width*4]=
				newImage.data[c + (x+posx) *4 + (y+posy)*newImage.width*4] * (255-data[3+x*4+y*width*4])/255+data[c+ x*4 + y*width*4]*(data[3+x*4+y*width*4])/255;
				 
			}
		
		}
	}
	return newImage;

}