Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. case 6:
  2. scanf("%d",&num_rot);
  3. rot1=(pixel**)malloc(width*sizeof(pixel));
  4. for(i=0;i<width;i++)
  5. rot1[i]=(pixel*)malloc(height*sizeof(pixel));
  6.  
  7. rot2=(pixel**)malloc(height*sizeof(pixel));
  8. for(i=0;i<height;i++)
  9. rot2[i]=(pixel*)malloc(width*sizeof(pixel));
  10.  
  11. rot3=(pixel**)malloc(width*sizeof(pixel));
  12. for(i=0;i<width;i++)
  13. rot3[i]=(pixel*)malloc(height*sizeof(pixel));
  14.  
  15. if(num_rot==1)
  16. {for i=0;i<width;i++)
  17. for(j=0;j<height;j++)
  18. {rot1[i][j].r=matrice[height-1-j][i].r;
  19. rot1[i][j].g=matrice[height-1-j][i].g;
  20. rot1[i][j].b=matrice[height-1-j][i].b;
  21. }
  22.  
  23. for(i=0;i<width;i++)
  24. for(j=0;j<height;j++)
  25. {matrice[i][j].r=rot1[i][j].r;
  26. matrice[i][j].g=rot1[i][j].g;
  27. matrice[i][j].b=rot1[i][j].b;
  28. }
  29. }
  30.  
  31. else if (num_rot==2)
  32. {for i=0;i<width;i++)
  33. for(j=0;j<height;j++)
  34. {rot1[i][j].r=matrice[height-1-j][i].r;
  35. rot1[i][j].g=matrice[height-1-j][i].g;
  36. rot1[i][j].b=matrice[height-1-j][i].b;
  37. }
  38.  
  39. for(i=0;i<height;i++)
  40. for(j=0;j<width;j++)
  41. {rot2[i][j].r=rot1[height-1-j][i].r;
  42. rot2[i][j].g=rot1[height-1-j][i].g;
  43. rot2[i][j].b=rot1[height-1-j][i].b;
  44. }
  45.  
  46. for(i=0;i<height;i++)
  47. for(j=0;j<width;j++)
  48. {matrice[i][j].r=rot2[i][j].r;
  49. matrice[i][j].g=rot2[i][j].g;
  50. matrice[i][j].b=rot2[i][j].b;
  51. }
  52. }
  53.  
  54. else if(num_rot==3)
  55. {for i=0;i<width;i++)
  56. for(j=0;j<height;j++)
  57. {rot1[i][j].r=matrice[height-1-j][i].r;
  58. rot1[i][j].g=matrice[height-1-j][i].g;
  59. rot1[i][j].b=matrice[height-1-j][i].b;
  60. }
  61.  
  62. for(i=0;i<height;i++)
  63. for(j=0;j<width;j++)
  64. {rot2[i][j].r=rot1[height-1-j][i].r;
  65. rot2[i][j].g=rot1[height-1-j][i].g;
  66. rot2[i][j].b=rot1[height-1-j][i].b;
  67. }
  68.  
  69. for(i=0;i<width;i++)
  70. for(j=0;j<height;j++)
  71. {rot3[i][j].r=rot2[height-1-j][i].r;
  72. rot3[i][j].g=rot2[height-1-j][i].g;
  73. rot3[i][j].b=rot2[height-1-j][i].b;
  74. }
  75.  
  76. for(i=0;i<width;i++)
  77. for(j=0;j<height;j++)
  78. {matrice[i][j].r=rot3[i][j].r;
  79. matrice[i][j].g=rot3[i][j].g;
  80. matrice[i][j].b=rot3[i][j].b;
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement