The original picture:
The original picture
How I want to display it:
Original picture with mirrored image
So far, I believe I will need to make a copy of original picture(transformPic) into another variable (lets call it Temp), then resize transformedPic for double width. Copy Temp into transformedPic. Then I will store a mirrored image of the original picture into Temp and copy it into the second half of transformedPic.
My code so far:
int Height = transformedPic.GetLength(0); //rows
int Width = transformedPic.GetLength(1); //columns
Color Temp;
//copying transformedPic into temp variable
for (int i = 0; i < Height; i++)
{
for (int j = 0; j < Width; j++)
{
Temp = transformedPic[i, j];
transformedPic[i, j] = transformedPic[i, j];
transformedPic[i, j] = Temp;
}
}
//doubling the width of transformedPic
for (int i = 0; i < Height; i++)
{
for (int j = 0; j < Width*2; j++)
{
transformedPic[i, j-1] = transformedPic[i, j-1];
}
}
//copying temp into transformedPic variable
for (int i = 0; i < Height; i++)
{
for (int j = 0; j < Width; j++)
{
Temp = transformedPic[i, j];
transformedPic[i, j] = transformedPic[i, j];
transformedPic[i, j] = Temp;
}
}
//Mirroring original picture horizontally in Temp variable
for (int i = 0; i < Height; i++)
{
for (int j = 0; j < Width / 2; j++)
{
Temp = transformedPic[i, j];
transformedPic[i, j] = transformedPic[i, Width - 1 - j];
transformedPic[i, Width - 1 - j] = Temp;
}
}
How can I store the Temp array(mirrored original image) into the second half of the transformedPic(original picture) and both of them one picture itself?
I have to do all this with the concepts of copying, resizing, and for looping 2D arrays.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…