Question: void testFlipHor ( ) { ? ? 1 { : ? ? | I - ) | d o t s d o t s
void testFlipHor
:
The method name should be mirrorHorizontal and will Flip the image
Horizontally or from left to right.
Create two Picture image objects using the same image file
Picture new PicturePictureExplorerimageFolderName "bees.PNG;
Apply the student code and solution code
Logic.mirrorHorizontal p;
Pixel studentSol pgetPixelsD;
Pixel pixels pgetPixelsD;
The leftmost and rightmost pixel colors should be swapped if flipped was
successful
check value values of a couple of pixels check red
assertTruepixelsgetRed studentSolstudentSollength getRed;
check green
assertTruepixels getGreen studentSol studentSol length getGreen;
check blue
assertTruepixelsgetBlue studentSolstudentSollength getBlue;
Hello I am trying to flip in image horizontaly, the code above is what I need to test and the hint I was given was: You may be tempted to swap Pixel objects, but for this assignment, just swap colors between Pixel objects. This is the start of my code:
public static void mirrorHorizontalDigitalPicture picture
Pixel pixelD picture.getPixelsD;
for int r ; r pixelDlength; r
for int c ; c pixelDrlength; c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
