Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 6:
- scanf("%d",&num_rot);
- rot1=(pixel**)malloc(width*sizeof(pixel));
- for(i=0;i<width;i++)
- rot1[i]=(pixel*)malloc(height*sizeof(pixel));
- rot2=(pixel**)malloc(height*sizeof(pixel));
- for(i=0;i<height;i++)
- rot2[i]=(pixel*)malloc(width*sizeof(pixel));
- rot3=(pixel**)malloc(width*sizeof(pixel));
- for(i=0;i<width;i++)
- rot3[i]=(pixel*)malloc(height*sizeof(pixel));
- if(num_rot==1)
- {for i=0;i<width;i++)
- for(j=0;j<height;j++)
- {rot1[i][j].r=matrice[height-1-j][i].r;
- rot1[i][j].g=matrice[height-1-j][i].g;
- rot1[i][j].b=matrice[height-1-j][i].b;
- }
- for(i=0;i<width;i++)
- for(j=0;j<height;j++)
- {matrice[i][j].r=rot1[i][j].r;
- matrice[i][j].g=rot1[i][j].g;
- matrice[i][j].b=rot1[i][j].b;
- }
- }
- else if (num_rot==2)
- {for i=0;i<width;i++)
- for(j=0;j<height;j++)
- {rot1[i][j].r=matrice[height-1-j][i].r;
- rot1[i][j].g=matrice[height-1-j][i].g;
- rot1[i][j].b=matrice[height-1-j][i].b;
- }
- for(i=0;i<height;i++)
- for(j=0;j<width;j++)
- {rot2[i][j].r=rot1[height-1-j][i].r;
- rot2[i][j].g=rot1[height-1-j][i].g;
- rot2[i][j].b=rot1[height-1-j][i].b;
- }
- for(i=0;i<height;i++)
- for(j=0;j<width;j++)
- {matrice[i][j].r=rot2[i][j].r;
- matrice[i][j].g=rot2[i][j].g;
- matrice[i][j].b=rot2[i][j].b;
- }
- }
- else if(num_rot==3)
- {for i=0;i<width;i++)
- for(j=0;j<height;j++)
- {rot1[i][j].r=matrice[height-1-j][i].r;
- rot1[i][j].g=matrice[height-1-j][i].g;
- rot1[i][j].b=matrice[height-1-j][i].b;
- }
- for(i=0;i<height;i++)
- for(j=0;j<width;j++)
- {rot2[i][j].r=rot1[height-1-j][i].r;
- rot2[i][j].g=rot1[height-1-j][i].g;
- rot2[i][j].b=rot1[height-1-j][i].b;
- }
- for(i=0;i<width;i++)
- for(j=0;j<height;j++)
- {rot3[i][j].r=rot2[height-1-j][i].r;
- rot3[i][j].g=rot2[height-1-j][i].g;
- rot3[i][j].b=rot2[height-1-j][i].b;
- }
- for(i=0;i<width;i++)
- for(j=0;j<height;j++)
- {matrice[i][j].r=rot3[i][j].r;
- matrice[i][j].g=rot3[i][j].g;
- matrice[i][j].b=rot3[i][j].b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement