画像 ppm を左/または右に回転させようとしています。180度回転には成功したのですが、90度回転がうまくいかないようです..
これは私のコードです
// working 1-D array of pixels pixel
*n_array = new Image(width, height);
// set up the new array dimensions based on ROTATION type
switch (the rotation)
{
case ROTCW:
case ROTCCW:
...
break;
case ROT180:
default: .. break;
}
for (unsigned int idx = 0; idx < (o_width * o_height); idx++)
{
old_y = idx / o_width;
switch (rotation)
{
case ROTCCW: ...
default: cout << "Oups" << std::endl; break;
}
// put pixel into n_array
}
これが私の結果です..
http://i.stack.imgur.com/Cj6AM.png
http://i.stack.imgur.com/yTnbS.png
誰かがこれに対する解決策を持っていますか?