我正在尝试向左/向右旋转图像 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
有人对此有解决方案吗?