Image Rotation in ExIf

ExIf rotation makes no rational or logical sense. Below is code that rotates an image based on its present position in increments of one quarter turn (90 degrees) at a time.


private
int rotateImg(int currentOrientation, int rotate)

{


int next = 0;


int prev = 0;


switch (currentOrientation)

{


//1,6,3,8


case 0: next = 6; prev = 8; break;


case 1: next = 6; prev = 8; break;


case 6: next = 3; prev = 1; break;


case 3: next = 8; prev = 6; break;


case 8: next = 1; prev = 3; break;

}


if (rotate == 1)

{


return next;

}


else
if (rotate == -1)

{


return prev;

}


else

{


return next;

}

}