public void Rotation() { Projet_Vincent_Poupet.MyImage imagetest = new Projet_Vincent_Poupet.MyImage("coco.bmp"); Projet_Vincent_Poupet.Pixel[,] matricetournée = new Projet_Vincent_Poupet.Pixel[imagetest.Largeur, imagetest.Hauteur]; for (int j = 0; j < imagetest.Largeur; j++) { for (int i = 0; i < imagetest.Hauteur; i++) { matricetournée[j, imagetest.Hauteur - i - 1] = imagetest.MatriceDePixels[i, j]; } } imagetest.RotationSensTrigo(); for (int i = 0; i < imagetest.Hauteur; i++) { for (int j = 0; j < imagetest.Largeur; j++) { Assert.AreEqual(imagetest.MatriceDePixels[i, j].rouge, matricetournée[i, j].rouge); Assert.AreEqual(imagetest.MatriceDePixels[i, j].bleu, matricetournée[i, j].bleu); Assert.AreEqual(imagetest.MatriceDePixels[i, j].vert, matricetournée[i, j].vert); } } }
/// <summary> /// Bouton qui permet de renverser l'image /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Rotation180(object sender, RoutedEventArgs e) { string nomfichier = this.CheminOrigine; try { Projet_Vincent_Poupet.MyImage imagerotation = new Projet_Vincent_Poupet.MyImage(nomfichier); imagerotation.RotationSensTrigo(); imagerotation.RotationSensTrigo(); imagerotation.EnregistrerImage(this.CheminEnregistrement); } catch (Exception) { } }