Пример #1
0
        public void FilterElement()
        {
            IPipe pipeNull = new PipeNull();

            //Creamos una tag de Image
            Dictionary <string, Attribute> attributeList = new Dictionary <string, Attribute>();
            Attribute attribute  = new Attribute("Name", "image1");
            Attribute attribute2 = new Attribute("PositionY", "100");
            Attribute attribute3 = new Attribute("PositionX", "100");
            Attribute attribute4 = new Attribute("Length", "100");
            Attribute attribute5 = new Attribute("Width", "100");
            Attribute attribute6 = new Attribute("ImagePath", "Oceano.jpg");

            attributeList.Add(attribute.Key, attribute);
            attributeList.Add(attribute2.Key, attribute2);
            attributeList.Add(attribute3.Key, attribute3);
            attributeList.Add(attribute4.Key, attribute4);
            attributeList.Add(attribute5.Key, attribute5);
            attributeList.Add(attribute6.Key, attribute6);
            Tag tag = new Tag("Image", attributeList);

            //Creamos un filterImage
            IFilterConditional filterImage = new FilterImage();
            IPipe pipe0 = new PipeConditional(filterImage, pipeNull, pipeNull);

            //Testeamos que el resultado de la pipe sea el correcto.
            Assert.True(pipe0.Send(tag) is VisitorImage);
        }
Пример #2
0
        static void Main(string[] args)
        {
            PictureProvider p = new PictureProvider();

            IPicture pic = p.GetPicture("matrix.png");

            FilterGreyscale   filterGreyscale   = new FilterGreyscale();
            FilterNegative    filterNegative    = new FilterNegative();
            FilterPostTwitter filterPostTwitter = new FilterPostTwitter();

            PipeNull        pipeNull = new PipeNull();
            PipeConditional pipeSerialConditional = new PipeConditional(filterPostTwitter, filterNegative, pipeNull);

            pic = pipeSerialConditional.Send(pic);

            Persist(pic, "imagenFiltrada.jpg");
        }
Пример #3
0
        public void FilterScreen()
        {
            IPipe pipeNull = new PipeNull();

            //Creamos una tag de Screen falsa
            Dictionary <string, Attribute> attributeList = new Dictionary <string, Attribute>();
            Attribute attribute = new Attribute("Name", "screen1");

            attributeList.Add(attribute.Key, attribute);
            Tag tag = new Tag("Screen", attributeList);

            //Creamos un filterScreen
            IFilterConditional filterScreen = new FilterScreen();
            IPipe pipe0 = new PipeConditional(filterScreen, pipeNull, pipeNull);

            //Nos fijamos que devuelva el Visitor correcto
            Assert.True(pipe0.Send(tag) is VisitorScreen);
        }
Пример #4
0
        public void FilterLevelTest()
        {
            IPipe pipeNull = new PipeNull();

            //Creamos una tag falsa de Level
            Dictionary <string, Attribute> attributeList = new Dictionary <string, Attribute>();
            Attribute attribute = new Attribute("Name", "level1");

            attributeList.Add(attribute.Key, attribute);
            Tag tag = new Tag("Level", attributeList);

            //Creamos un filter Level
            IFilterConditional filterLevel = new FilterLevel();
            IPipe pipe0 = new PipeConditional(filterLevel, pipeNull, pipeNull);

            //Nos fijamos que el resultado de la pipe sea un VisitorLevel
            Assert.True(pipe0.Send(tag) is VisitorLevel);
        }
Пример #5
0
        static void Main(string[] args)
        {
            PictureProvider pictureProvider = new PictureProvider();
            IPicture        picOrig         = pictureProvider.GetPicture("jac.jpg");

            FilterNegative negative = new FilterNegative();
            //https://twitter.com/POOUCU?lang=en&lang=en
            FilterTwitterPublish twitterPublish = new FilterTwitterPublish();
            FilterCognitive      faceRecog      = new FilterCognitive();

            IConvolutionMatrix matrix    = new BlurConvolutionMatrix();
            FilterConvolution  blurConvo = new FilterConvolution(matrix);

            PipeNull pipeEnd = new PipeNull();
            //PipeSerial pipe32 = new PipeSerial(negative,pipeEnd);
            PipeSerial      pipe22 = new PipeSerial(negative, pipeEnd);
            PipeSerial      pipe21 = new PipeSerial(twitterPublish, pipeEnd);
            PipeConditional pipe1  = new PipeConditional(faceRecog, pipe21, pipe22);

            pictureProvider.SavePicture(pipe1.Send(picOrig), "jacFiltrado.jpg");
        }
Пример #6
0
        static void Main(string[] args)
        {
            PictureProvider imgProvider = new PictureProvider();
            IPicture        pictureProv = imgProvider.GetPicture("Vikings.jpg");

            IConvolution      matrix     = new BlurConvolutionMatriz();
            FilterConvolution blurFilter = new FilterConvolution(matrix);


            FilterNegative  negativeFilter  = new FilterNegative();
            FilterTwitter   twitterFilter   = new FilterTwitter();
            FilterCognitive faceRecognition = new FilterCognitive();


            PipeNull   pipeEnd      = new PipeNull();
            PipeSerial pipeTwitter  = new PipeSerial(twitterFilter, pipeEnd);
            PipeSerial pipeBlur     = new PipeSerial(blurFilter, pipeEnd);
            PipeSerial pipeNegative = new PipeSerial(negativeFilter, pipeEnd);

            PipeConditional pipeFace = new PipeConditional(faceRecognition, pipeTwitter, pipeNegative);

            imgProvider.SavePicture(pipeFace.Send(pictureProv), "Vikings.jpg");
        }