Пример #1
0
        public void MyImagePassageGris()
        {
            Projet_Vincent_Poupet.MyImage imagetest     = new Projet_Vincent_Poupet.MyImage("coco.bmp");
            Projet_Vincent_Poupet.MyImage imageresultat = new Projet_Vincent_Poupet.MyImage("coco.bmp");

            imagetest.PassageGris();

            for (int i = 0; i < imageresultat.Hauteur; i++)
            {
                for (int j = 0; j < imageresultat.Largeur; j++)
                {
                    imageresultat.MatriceDePixels[i, j].PassageGris();
                }
            }

            for (int i = 0; i < imagetest.Hauteur; i++)
            {
                for (int j = 0; j < imagetest.Largeur; j++)
                {
                    Assert.AreEqual(imagetest.MatriceDePixels[i, j].rouge, imageresultat.MatriceDePixels[i, j].rouge);
                    Assert.AreEqual(imagetest.MatriceDePixels[i, j].bleu, imageresultat.MatriceDePixels[i, j].bleu);
                    Assert.AreEqual(imagetest.MatriceDePixels[i, j].vert, imageresultat.MatriceDePixels[i, j].vert);
                }
            }
        }
Пример #2
0
        //ON MET DES TRY/CATCH POUR EVITER QUE L'ON AIT DES ERREURS DE BUILT A CAUSE DE LA TAILLE DU MOT "nomfichier" QUI SERA NUL SI L'ON CLIQUE SUR "ANNULER"

        /// <summary>
        /// Bouton qui permet de faire passer l'image en niveau de gris en fonction de la valeur renvoyée par le slider associé
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_PassageNiveauGris(object sender, RoutedEventArgs e)
        {
            string nomfichier = this.CheminOrigine;;

            try
            {
                Projet_Vincent_Poupet.MyImage imagegrise = new Projet_Vincent_Poupet.MyImage(nomfichier);
                imagegrise.PassageGris();
                imagegrise.EnregistrerImage(this.CheminEnregistrement);
            }
            catch (Exception)
            {
            }
        }