static void Main(string[] args) { PictureProvider foto = new PictureProvider(); IPicture foto1 = foto.GetPicture(@"C:\Users\estudiante.fit\Documents\GitHub\CompAndDel\fotojpg.jpg"); int[,] matriz = new int[3, 3] { { -1, 0, -1, }, { 0, 4, 0 }, { -1, 0, -1 } }; Propiedades data = new Propiedades(matriz, 1, 27); FilterConvolution FiltroDeMatriz = new FilterConvolution(data); FilterGreyscale FiltroGreyscale = new FilterGreyscale(); BoolFilter FiltroBooleano = new BoolFilter(); TwitterImage sender = new TwitterImage("dtOgpyjBBXglAzMEjMMZtFf73", "Qzm0FxotJ9YyoXiGLJ4JI9IZFWmYvB4LWpteWPGVYofxSG4FnN", "1396065818-13uONd7FgFVXhW1xhUCQshKgGv4UOnKeDipg4cz", "HXtlP1SRnJCL5a37R98hFrIRlEIouZX3Ra4s6JuFOpXZF"); TwitterFilter FiltroTwitter = new TwitterFilter(sender); PipeNull cañofinal = new PipeNull(); PipeSerial caño3 = new PipeSerial(FiltroGreyscale, cañofinal); PipeSerial caño1 = new PipeSerial(FiltroTwitter, cañofinal); BoolPipe CañoBifurcado = new BoolPipe(caño1, caño3, FiltroBooleano); IPicture foto2 = CañoBifurcado.Send(foto1); foto.SavePicture(foto2, @"C:\Users\estudiante.fit\Documents\GitHub\CompAndDel\foto12.jpg"); }
static void Main(string[] args) { PictureProvider provider = new PictureProvider(); IPicture picture = provider.GetPicture("../../assets/yacht.jpg"); IPipe pipeNull = new PipeNull(); IFilter filterSavePicture = new FilterSavePicture(); IFilter filterPublish = new FilterPublishPicture(); IPipe thirdPipeSerial = new PipeSerial(filterPublish, pipeNull); IPipe secondPipeSerialSave = new PipeSerial(filterSavePicture, thirdPipeSerial); IFilter filterNegative = new FilterNegative(); IPipe secondPipeSerial = new PipeSerial(filterNegative, secondPipeSerialSave); IPipe firstPipeSerialSave = new PipeSerial(filterSavePicture, secondPipeSerial); IFilter filterGreyScale = new FilterGreyscale(); IPipe pipeConditional = new PipeConditionalBifurcation(thirdPipeSerial, secondPipeSerial); IPipe pipeSerial = new PipeSerial(filterGreyScale, firstPipeSerialSave); IPicture newPicture = pipeSerial.Send(picture); }
static void Main(string[] args) { // creamos un objeto PictureProvider y obtenemos una imagen PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("C:/Users/FIT/programacion2/ejercicio_en_clase/ComposicionYDelegacion/PII_Pipes_Filters-master/gato.png"); // creamos un pipeNull IPipe pipenull = new PipeNull(); // creamos instancias de todos los filtros que nos interecen FilterSave filtersave = new FilterSave("../../gato2.png"); FilterTwitter filtertwitter = new FilterTwitter(filtersave.path); FilterNegative filternegative = new FilterNegative(); FilterGreyscale filtergreyscale = new FilterGreyscale(); ConditionalFilter conditionalfilter = new ConditionalFilter(filtersave.path); FilterBlurConvolution filterblurconvolution = new FilterBlurConvolution(); // creamos instancias de todos los pipeSerial que vayamos a utilizar IPipe pipeserial7 = new PipeSerial(filtertwitter, pipenull); IPipe pipeserial6 = new PipeSerial(filtersave, pipeserial7); // en este caso se sobrescribe la imagen guardada ya que estoy usando el mismo filtersave con el mismo path IPipe pipeserial5 = new PipeSerial(filterblurconvolution, pipeserial6); IPipe pipeserial4 = new PipeSerial(filtertwitter, pipenull); IPipe pipefork = new PipeFork(conditionalfilter, pipeserial4, pipeserial5); IPipe pipeserial3 = new PipeSerial(filtersave, pipefork); IPipe pipeserial2 = new PipeSerial(filternegative, pipeserial3); IPipe pipeserial = new PipeSerial(filtergreyscale, pipeserial2); // enviamos la imagen al primer pipeSerial pipeserial.Send(pic); }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture(@"Silla.jpg"); PipeSerial greyscale = new PipeSerial(new FilterGreyscale(), new PipeNull()); pic = greyscale.Send(pic); //p.SavePicture(pic,@"matrix2.jpg"); /* * La idea es que cuando pase por el FilterSaving se guarde la imagen con el filtro aplicado de donde viene. * Le paso la foto al pipe grayScale que lo va a pasar por FilterGrayScale y de ahi a un pipe que se llama saveImage * creado para este ejercicio, este pipe le aplica el filto que guarda la imagen. De ahi se va al pipe fork donde decide * dependiendo de si tiene cara o no si va al twitterfilter o al negative. * Después de ese filtro llega al pipe null. */ FilterSaving saving = FilterSaving.Instance; PipeSerial saveImageAlreadyWentThrough = new PipeSerial(saving, new PipeNull()); PipeSerial negative = new PipeSerial(new FilterNegative(), saveImageAlreadyWentThrough); PipeSerial twitterFilter = new PipeSerial(new TwitterFilter(), new PipeNull()); PipeFork DoesItHaveAFace = new PipeFork(twitterFilter, negative, new HasFaceConditional()); PipeSerial saveImage = new PipeSerial(saving, DoesItHaveAFace); PipeSerial grayScale = new PipeSerial(new FilterGreyscale(), saveImage); grayScale.Send(pic); }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("../../Sequence-1.png"); FilterGreyscale greyscale = new FilterGreyscale(); FilterNegative filternegative = new FilterNegative(); PipeNull pipeNull = new PipeNull(); FilterSave saveFilter = new FilterSave(); TwitterSave twitterSave = new TwitterSave(); PipeSerial pipeserial3 = new PipeSerial(saveFilter, pipeNull); PipeSerial pipeserial4 = new PipeSerial(twitterSave, pipeNull); PipeFork pipeFork4 = new PipeFork(pipeNull, pipeserial4); PipeFork pipeFork3 = new PipeFork(pipeNull, pipeserial3); PipeSerial pipeserial2 = new PipeSerial(filternegative, pipeFork3); PipeFork pipeFork5 = new PipeFork(pipeserial2, pipeserial4); PipeFork pipeFork2 = new PipeFork(pipeFork5, pipeserial3); PipeSerial pipeSerial = new PipeSerial(greyscale, pipeFork2); PipeFork pipeFork1 = new PipeFork(pipeSerial, pipeserial3); pipeFork1.Send(pic); }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("TestImg.jpg"); //consumo imagen //Parte 1 PipeSerial firstSerial = new PipeSerial(new FilterGreyscale(), new PipeSerial(new FilterNegative(), new PipeNull())); //Genero mi series de Pipes //firstSerial.Send(pic); //envío la pic por la serie de pipes del ejercicio //Parte 2 PipeSerial secondSerial = new PipeSerial(new FilterGreyscale(), new PipeSerial(new FilterSave(), //en este caso entre filtro y filtro guardo la imagen new PipeSerial(new FilterNegative(), new PipeSerial(new FilterSave(), new PipeNull())))); //Genero mi series de Pipes //secondSerial.Send(pic); //envio la pic por la serie de pipes de la segunda parte del ejercicio //Parte 3 PipeSerial thirdSerial = new PipeSerial(new FilterGreyscale(), new PipeSerial(new FilterSave(), //en este caso entre filtro y filtro guardo la imagen new PipeSerial(new FilterNegative(), new PipeSerial(new FilterSave(), new PipeSerial(new FilterTwitter(), //publico la imagen con todos los filtros en ucuTW new PipeNull()))))); //Genero mi series de Pipes //thirdSerial.Send(pic); //envio la pic por la serie de pipes de la tercera parte del ejercicio //Parte 4 PipeSerial fourthSerial = new PipeSerial(new FilterGreyscale(), new PipeSerial(new FilterSave(), //guardo new PipeFork( //ingreso a la bifurcación, fue modificada para primero tener que aplicar el filtro condicional new FilterConditionalFace(), //paso filtro de condición new PipeSerial(new FilterTwitter(), //si es true envío a twitter new PipeNull()), new PipeSerial(new FilterNegative(), //serie si es false, primero aplico negativo new PipeSerial(new FilterSave(), //luego de aplicar negativo, guardo new PipeNull()))) )); //fourthSerial.Send(pic); //envio la pic por la serie de pipes de la cuarta parte del ejercicio //Parte 5 (bonus) PipeSerial fifthSerial = new PipeSerial(new FilterBlurConvolution(), //Aplico filtro de convolución new PipeSerial(new FilterSave(), //Guardo la imagen con el filtro aplicada new PipeSerial(new FilterTwitter(), //subo la misma a twitter new PipeNull()))); fifthSerial.Send(pic); //envío la pic por la serie de pipes de la quinta parte del ejercicio }
static void Main(string[] args) { PictureProvider pictureProvider = new PictureProvider(); IPicture firstPicture = pictureProvider.GetPicture("perro foto.jpg"); IPicture resultPicture = new PipeSerial(new FilterGreyscale(), new PipeSerial( new FilterSaveImage(), new PipeSerial(new FilterNegative(), new PipeNull())) ).Send(firstPicture); pictureProvider.SavePicture(resultPicture, "perro foto final.jpg"); }
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"); }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("..\\..\\ImagenPruebas.jpg"); IFilter filter = new FilterGreyscale(); IFilter filterDos = new FilterNegative(); IPipe isnull = new PipeNull(); IPipe serialDos = new PipeSerial(filterDos, isnull); IPipe serial = new PipeSerial(filter, serialDos); IPicture pic2 = serial.Send(pic); IPicture pic3 = serialDos.Send(pic2); p.SavePicture(pic2, "..\\..\\ImagenPruebas1.jpg"); p.SavePicture(pic3, "..\\..\\ImagenPruebas2.jpg"); }
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"); }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture(@"./../../images/bill.jpg"); var blur = new FilterBlurConvolution(); var grey = new FilterGreyscale(); var negative = new FilterNegative(); var invento = new FilterInvento(); var saving = FilterSave.Instance; var pipe1 = new PipeSerial(saving, new PipeNull()); var pipe2 = new PipeSerial(grey, pipe1); var twitt = new PipeSerial(new FilterTwitter(), pipe2); var pipe3 = new PipeSerial(saving, twitt); var pipe4 = new PipeSerial(negative, pipe3); pipe4.Send(pic); // var fork = new PipeFork(prueba2, prueba1); }
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"); }
static void Main(string[] args) { string Shrek = @"..\..\SmilingShrek.jpg"; string NewShrek = @"..\..\" + Guid.NewGuid().ToString() + ".jpg"; string NewShrek2 = @"..\..\" + Guid.NewGuid().ToString() + ".jpg"; string NewShrek3 = @"..\..\" + Guid.NewGuid().ToString() + ".jpg"; string NewShrek4 = @"..\..\" + Guid.NewGuid().ToString() + ".jpg"; PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture(Shrek); // Conjunto de filtros a utilizar en las 5 partes IFilter GrayFilter = new FilterGreyscale(); IFilter NegativeFilter = new FilterNegative(); IFilter Save = new FilterSaver(NewShrek); IFilter Tweet1 = new FilterTwitterPublish("Shrek is love, Shrek is life.", NewShrek); IFilter Tweet2 = new FilterTwitterPublish("Shrek is love, Shrek is life.", NewShrek2); IFilter Tweet3 = new FilterTwitterPublish("Shrek is love, Shrek is life.", NewShrek3); IFilter Tweet4 = new FilterTwitterPublish("Shrek is love, Shrek is life.", NewShrek4); IConditionFilter FaceCondition = new FilterSearchFace(Shrek); FilterBlurConvolution LightBlur = new FilterBlurConvolution(); //PipeNull IPipe NullPipe = new PipeNull(); // Parte1 PipeSerial pipe2 = new PipeSerial(NegativeFilter, NullPipe); IPipe pipe1 = new PipeSerial(GrayFilter, pipe2); pipe1.Send(pic); // Parte 2 (guardar una copia de la imagen cada vez que se le aplica un filtro) IPipe FourthPipe2 = new PipeSerial(Save, NullPipe); IPipe ThirdPipe2 = new PipeSerial(NegativeFilter, FourthPipe2); IPipe SecondPipe2 = new PipeSerial(Save, ThirdPipe2); IPipe InitialPipe2 = new PipeSerial(GrayFilter, SecondPipe2); InitialPipe2.Send(pic); // Parte 3 IPipe FifthPipe3 = new PipeSerial(Tweet2, NullPipe); IPipe FourthPipe3 = new PipeSerial(Save, FifthPipe3); IPipe ThirdPipe3 = new PipeSerial(NegativeFilter, FourthPipe3); IPipe SecondPipe3 = new PipeSerial(Save, ThirdPipe3); IPipe InitialPipe3 = new PipeSerial(GrayFilter, SecondPipe3); InitialPipe3.Send(pic); // Parte 4 IPipe SerialTweet4 = new PipeSerial(Tweet3, NullPipe); IPipe SerialSave = new PipeSerial(Save, NullPipe); IPipe PipeFork4 = new PipeFork(SerialTweet4, SerialSave, FaceCondition.condition); IPipe InitialPipe4 = new PipeSerial(GrayFilter, PipeFork4); InitialPipe4.Send(pic); // Parte 5 IPipe ThirdPipe5 = new PipeSerial(Tweet4, NullPipe); IPipe SecondPipe5 = new PipeSerial(Save, ThirdPipe5); IPipe InitialPipe5 = new PipeSerial(LightBlur, SecondPipe5); InitialPipe5.Send(pic); }
static void Main(string[] args) { // Se obtiene la imagen. PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture(@"download.jpg"); // Se crean los filtros que se van a utilizar. FilterGreyscale filterGreyscale = new FilterGreyscale(); FilterNegative filterNegative = new FilterNegative(); FilterSaveImage filterSaveImage = new FilterSaveImage(); FilterTwitterApi filterTwitterApi = new FilterTwitterApi(); FilterHasFace filterHasFace = new FilterHasFace(); // Parte 1 /* * PipeNull pipeNull = new PipeNull(); * PipeSerial pipeFilterNegative = new PipeSerial(filterNegative, pipeNull); * PipeSerial pipeFilterGreyScale = new PipeSerial(filterGreyscale, pipeFilterNegative); * pipeFilterGreyScale.Send(pic);*/ // Parte 2 /* * PipeNull pipeNull = new PipeNull(); * PipeSerial pipeFilterSaveImageTwo = new PipeSerial(filterSaveImage, pipeNull); * PipeSerial pipeFilterNegative = new PipeSerial(filterNegative, pipeFilterSaveImageTwo); * PipeSerial pipeFilterSaveImageOne = new PipeSerial(filterSaveImage, pipeFilterNegative); * PipeSerial pipeFilterGreyScale = new PipeSerial(filterGreyscale, pipeFilterSaveImageOne); * pipeFilterGreyScale.Send(pic);*/ // Parte 3 /* * PipeNull pipeNull = new PipeNull(); * PipeSerial pipeTwitterApiTwo = new PipeSerial(filterTwitterApi, pipeNull); * PipeSerial pipeFilterSaveImageTwo = new PipeSerial(filterSaveImage, pipeTwitterApiTwo); * PipeSerial pipeFilterNegative = new PipeSerial(filterNegative, pipeFilterSaveImageTwo); * PipeSerial pipeTwitterApi = new PipeSerial(filterTwitterApi, pipeFilterNegative); * PipeSerial pipeFilterSaveImageOne = new PipeSerial(filterSaveImage, pipeTwitterApi); * PipeSerial pipeFilterGreyScale = new PipeSerial(filterGreyscale, pipeFilterSaveImageOne); * pipeFilterGreyScale.Send(pic);*/ // Parte 4. /* * PipeNull pipeNull = new PipeNull(); * PipeSerial pipeFilterSaveImageTwo = new PipeSerial(filterSaveImage, pipeNull); * PipeSerial pipeFilterNegative = new PipeSerial(filterNegative, pipeFilterSaveImageTwo); * PipeSerial pipeTwitterApi = new PipeSerial(filterTwitterApi, pipeNull); * PipeFork pipeConditionalFork = new PipeFork(pipeFilterNegative, pipeTwitterApi); * PipeSerial pipeFilterHasFace = new PipeSerial(filterHasFace, pipeConditionalFork); * PipeSerial pipeFilterSaveImageOne = new PipeSerial(filterSaveImage, pipeFilterHasFace); * PipeSerial pipeFilterGreyScale = new PipeSerial(filterGreyscale, pipeFilterSaveImageOne); * pipeFilterGreyScale.Send(pic);*/ pic = p.GetPicture(@"Imagen2.jpg"); //Filtro FilterBlackAndWhite PipeNull pipeNull = new PipeNull(); FilterSaveImage2 filterSaveImage2 = new FilterSaveImage2(); PipeSerial pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterBlackAndWhite filterBAndW = new FilterBlackAndWhite(20); PipeSerial pipeFilterBAndW = new PipeSerial(filterBAndW, pipeFilterSaveImage2); pipeFilterBAndW.Send(pic.Clone()); //Filtro FilterClearOut pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterClearOut filterClearOut = new FilterClearOut(); PipeSerial pipeFilterClearOut = new PipeSerial(filterClearOut, pipeFilterSaveImage2); pipeFilterClearOut.Send(pic.Clone()); //Filtro FilterColoredLines pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterColoredLines filterColoredLines = new FilterColoredLines(); PipeSerial pipeFilterColoredLines = new PipeSerial(filterColoredLines, pipeFilterSaveImage2); pipeFilterColoredLines.Send(pic.Clone()); //Filtro FilterDarken pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterDarken filterDarken = new FilterDarken(); PipeSerial pipeFilterDarken = new PipeSerial(filterDarken, pipeFilterSaveImage2); pipeFilterDarken.Send(pic.Clone()); //Filtro FilterNeon pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterNeon filterNeon = new FilterNeon(); PipeSerial pipeFilterNeon = new PipeSerial(filterNeon, pipeFilterSaveImage2); pipeFilterNeon.Send(pic.Clone()); //Filtro FilterPencil pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterPencil filterPencil = new FilterPencil(); PipeSerial pipeFilterPencil = new PipeSerial(filterPencil, pipeFilterSaveImage2); pipeFilterPencil.Send(pic.Clone()); //Filtro FilterRelief pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterRelief filterRelief = new FilterRelief(); PipeSerial pipeFilterRelief = new PipeSerial(filterRelief, pipeFilterSaveImage2); pipeFilterRelief.Send(pic.Clone()); //Filtro FilterGreyScale pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterGreyscale filterGreyScale = new FilterGreyscale(); PipeSerial pipeFilterGreyscale = new PipeSerial(filterGreyScale, pipeFilterSaveImage2); pipeFilterGreyscale.Send(pic.Clone()); //Filtro BlurConvolution pipeNull = new PipeNull(); pipeFilterSaveImage2 = new PipeSerial(filterSaveImage2, pipeNull); FilterBlurConvolution filterBlurConvolution = new FilterBlurConvolution(); PipeSerial pipeFilterBlurConvolution = new PipeSerial(filterBlurConvolution, pipeFilterSaveImage2); pipeFilterBlurConvolution.Send(pic.Clone()); }
static void Main(string[] args) { //Ejercicio1 PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("..\\Adds\\índice.jpg"); IPipe thirdpipe = new PipeNull(); IPipe secondpipe = new PipeSerial(new FilterNegative(), thirdpipe); IPipe firstpipe = new PipeSerial(new FilterGreyscale(), secondpipe); p.SavePicture(firstpipe.Send(pic), "..\\Adds\\Ejercicio1.jpg"); //Ejercicio2 PictureProvider p1 = new PictureProvider(); IPicture pic1 = p1.GetPicture("..\\Adds\\índice.jpg"); IPipe fifthpipe1 = new PipeNull(); IPipe fourthpipe1 = new PipeSerial(new FilterSave(), fifthpipe1); IPipe thirdpipe1 = new PipeSerial(new FilterNegative(), fourthpipe1); IPipe secondpipe1 = new PipeSerial(new FilterSave(), thirdpipe1); IPipe firstpipe1 = new PipeSerial(new FilterGreyscale(), secondpipe1); firstpipe1.Send(pic1); //Ejercicio3 PictureProvider p2 = new PictureProvider(); IPicture pic2 = p2.GetPicture("..\\Adds\\índice.jpg"); IPipe fifthpipe2 = new PipeNull(); IPipe fourthpipe2 = new PipeSerial(new FilterTwitter(), fifthpipe2); IPipe thirdpipe2 = new PipeSerial(new FilterNegative(), fourthpipe2); IPipe secondpipe2 = new PipeSerial(new FilterTwitter(), thirdpipe2); IPipe firstpipe2 = new PipeSerial(new FilterGreyscale(), secondpipe2); firstpipe2.Send(pic2); //Ejercicio4 PictureProvider p3 = new PictureProvider(); PictureProvider p4 = new PictureProvider(); IPicture pic3 = p3.GetPicture("..\\Adds\\índice.jpg"); IPicture pic4 = p4.GetPicture("..\\Adds\\Auto.jpg"); IPipe fifthpipe3 = new PipeNull(); IPipe fourthpipe3 = new PipeSerial(new FilterNegative(), fifthpipe3); IPipe thirdpipe3 = new PipeSerial(new FilterTwitter(), fifthpipe3); IPipe secondpipe3 = new PipeConditionalFork(new FilterConditional(), thirdpipe3, fourthpipe3); IPipe firstpipe3 = new PipeSerial(new FilterGreyscale(), secondpipe3); firstpipe3.Send(pic3); p4.SavePicture(firstpipe.Send(pic4), "..\\Adds\\auto2.jpg"); //Ejercicio5 PictureProvider p5 = new PictureProvider(); IPicture pic5 = p5.GetPicture("..\\Adds\\índice.jpg"); IPipe secondpipe5 = new PipeNull(); IPipe firstpipe5 = new PipeSerial(new FilterRandomConvolution(), secondpipe5); p5.SavePicture(firstpipe5.Send(pic5), "..\\Adds\\Ejercicio5.jpg"); }
static void Main(string[] args) { IFilter Greyscale = new FilterGreyscale(); IFilter Negative = new FilterNegative(); IFilter Twitter = new FilterTwitter(); IFilter Save = new FilterSave(); IFilter Sharpen = new FilterSharpenConvolution(); IFilterBool HasFace = new FilterFace(); PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("..\\Images\\image.jpg"); /// <summary> /// Las clases Pipe que aplican algún filtro a la imagen delegan la responsabilidad de modificar /// la imagen a la clase Filter que la compone. /// </summary> /// <returns></returns> #region Ejercicio 1 IPipe Pipe1_3 = new PipeNull(); IPipe Pipe1_2 = new PipeSerial(Negative, Pipe1_3); IPipe Pipe1_1 = new PipeSerial(Greyscale, Pipe1_2); Pipe1_1.Send(pic); #endregion #region Ejercicio 2 IPipe Pipe2_5 = new PipeNull(); IPipe Pipe2_4 = new PipeSerial(Save, Pipe2_5); IPipe Pipe2_3 = new PipeSerial(Negative, Pipe2_4); IPipe Pipe2_2 = new PipeSerial(Save, Pipe2_3); IPipe Pipe2_1 = new PipeSerial(Greyscale, Pipe2_2); Pipe2_1.Send(pic); #endregion #region Ejercicio 3 IPipe Pipe3_5 = new PipeNull(); IPipe Pipe3_4 = new PipeSerial(Twitter, Pipe2_5); IPipe Pipe3_3 = new PipeSerial(Negative, Pipe2_4); IPipe Pipe3_2 = new PipeSerial(Twitter, Pipe2_3); IPipe Pipe3_1 = new PipeSerial(Greyscale, Pipe2_2); Pipe3_1.Send(pic); #endregion #region Ejercicio 4 IPipe Pipe4_5 = new PipeNull(); IPipe Pipe4_4 = new PipeSerial(Negative, Pipe4_5); IPipe Pipe4_3 = new PipeSerial(Twitter, Pipe4_5); IPipe Pipe4_2 = new PipeConditionalFork(Pipe4_3, Pipe4_4, HasFace); IPipe Pipe4_1 = new PipeSerial(Greyscale, Pipe4_2); Pipe4_1.Send(pic); #endregion #region Ejercicio Bonus IPipe PipeBonus_3 = new PipeNull(); IPipe PipeBonus_2 = new PipeSerial(Save, PipeBonus_3); IPipe PipeBonus_1 = new PipeSerial(Sharpen, PipeBonus_2); PipeBonus_1.Send(pic); #endregion }
static void Main(string[] args) { PictureProvider p = new PictureProvider(); IPicture pic = p.GetPicture("../faceImage.jpg"); IFilter filterGreyscale = new FilterGreyscale(); IFilter filterNegative = new FilterNegative(); IFilter filterProvider = new FilterProvider(); IFilter filterTwiter = new FilterTwitter(); IFilter filterConditional = new FilterConditional(); IFilter filterBlurConvolution = new FilterBlurConvolution(); IFilter filterSharpenConvolution = new FilterSharpenConvolution(); //EJERCICIO 1 IPipe pipeNull_ej1 = new PipeNull(); IPipe pipeSerial2_ej1 = new PipeSerial(filterNegative, pipeNull_ej1); IPipe pipeSerial1_ej1 = new PipeSerial(filterGreyscale, pipeSerial2_ej1); pipeSerial1_ej1.Send(pic); //EJERCICIO 2 IPipe pipeNull_ej2 = new PipeNull(); IPipe pipeProvider2_ej2 = new PipeSerial(filterProvider, pipeNull_ej2); IPipe pipeSerial2_ej2 = new PipeSerial(filterNegative, pipeProvider2_ej2); IPipe pipeProvider1_ej2 = new PipeSerial(filterProvider, pipeSerial2_ej2); IPipe pipeSerial1_ej2 = new PipeSerial(filterGreyscale, pipeProvider1_ej2); pipeSerial1_ej2.Send(pic); //EJERCICIO 3 IPipe pipeNull_ej3 = new PipeNull(); IPipe pipeTwiter2_ej3 = new PipeSerial(filterTwiter, pipeNull_ej3); IPipe pipeProvider2_ej3 = new PipeSerial(filterProvider, pipeTwiter2_ej3); IPipe pipeSerial2_ej3 = new PipeSerial(filterNegative, pipeProvider2_ej3); IPipe pipeTwiter1_ej3 = new PipeSerial(filterTwiter, pipeSerial2_ej3); IPipe pipeProvider1_ej3 = new PipeSerial(filterProvider, pipeTwiter1_ej3); IPipe pipeSerial1_ej3 = new PipeSerial(filterGreyscale, pipeProvider1_ej3); pipeSerial1_ej3.Send(pic); //EJERCICIO 4 IPipe pipeNull_ej4 = new PipeNull(); IPipe pipeProvider2_ej4 = new PipeSerial(filterProvider, pipeNull_ej4); IPipe pipeSerial2_ej4 = new PipeSerial(filterNegative, pipeProvider2_ej4); IPipe pipeTwiter1_ej4 = new PipeSerial(filterTwiter, pipeNull_ej4); IPipe pipeConditionalFork1_ej4 = new PipeConditionalFork(filterConditional, pipeTwiter1_ej4, pipeSerial2_ej4); IPipe pipeProvider1_ej4 = new PipeSerial(filterProvider, pipeConditionalFork1_ej4); IPipe pipeSerial1_ej4 = new PipeSerial(filterGreyscale, pipeProvider1_ej4); pipeSerial1_ej4.Send(pic); //EJERCICIO BONUS IPipe pipeNull_ejB = new PipeNull(); IPipe pipeProvider2_ejB = new PipeSerial(filterProvider, pipeNull_ejB); IPipe pipeSerial2_ejB = new PipeSerial(filterSharpenConvolution, pipeProvider2_ejB); IPipe pipeProvider1_ejB = new PipeSerial(filterProvider, pipeSerial2_ejB); IPipe pipeSerial1_ejB = new PipeSerial(filterBlurConvolution, pipeProvider1_ejB); pipeSerial1_ejB.Send(pic); }