int build_transformation(Mat float[4][12] matA, Mat float[4][12] matB, 
	int x, int y, float degree, String filename) {

	Mat float [4][12] matC;
	Mat int [4][12] output;
	float sum;
	int i;
	int j;

	matA = matA * (1.0 - degree);
	matB = matB * (degree);
	matC = matA + matB;

	for(i=0; i< 4; i = i+1) {
		for(j =0; j<12; j=j+1) {
			sum = matC[i][j];
			output[i][j] = to_int(sum);
		}
	}
	write_image(**output, x, y, filename);

	return 0;
}

int main() {
	Mat float [4][12] matA;
	Mat float [4][12] matB;
	Img imgA;
	Img imgB;
	int k;
	int i;
	int j;
	int x;
	int y;

	imgA = read_image("block.ppm");
	imgB = read_image("block2.ppm");

	y = &imgA;
	imgA = ++imgA;
	x = &imgB;
	imgA = ++imgA;
	imgB = ++imgB;
	imgB = ++imgB;
	
	for(i=0; i<4; i = i+1) {
		for(j=0; j<12; j = j+1) {
			k = &imgA;			
			matA[i][j] = to_float(k);
			imgA = ++imgA;
		}
	}

	for(i=0; i<4; i = i+1) {
		for(j=0; j<12; j = j+1) {
			k = &imgB;			
			matB[i][j] = to_float(k);
			imgB = ++imgB;
		}
	}
	
	build_transformation(matA, matB, x, y, 0.0, "block_trans0.ppm");
	build_transformation(matA, matB, x, y, 0.25, "block_trans1.ppm");
	build_transformation(matA, matB, x, y, 0.5, "block_trans2.ppm");
	build_transformation(matA, matB, x, y, 0.75, "block_trans3.ppm");
	build_transformation(matA, matB, x, y, 1.0, "block_trans4.ppm");
	
	return 0;
}


