Ejemplo n.º 1
0
        public IImageWrapper Spectrum()
        {
            var gif = new GifWrapper(image);

            image.Dispose();
            return(gif.Spectrum());
        }
Ejemplo n.º 2
0
        public IImageWrapper Implode()
        {
            var gif = new GifWrapper(image);

            image.Dispose();
            return(gif.Implode());
        }
Ejemplo n.º 3
0
        public IImageWrapper Lsd()
        {
            var gif = new GifWrapper(image);

            image.Dispose();
            return(gif.Lsd());
        }
Ejemplo n.º 4
0
        public async Task <IImageWrapper?> ProcessImageAsync(string url, string[] args)
        {
            IImageWrapper?img;

            if (url.Contains("tenor.com"))
            {
                string tenorGif = await GetTenorImageUrl(url);

                img = new GifWrapper(await DownloadImageAsync(tenorGif));
            }
            else if (url.Contains(".gif"))
            {
                img = new GifWrapper(await DownloadImageAsync(url));
            }
            else
            {
                img = new ImageWrapper(await DownloadImageAsync(url));
            }

            if (args[0].ToLower() == "text")
            {
                string top    = "";
                string bottom = "";
                if (args.Length > 1)
                {
                    top = args[1];
                }
                if (args.Length > 2)
                {
                    bottom = args[2];
                }
                img.Text(top, bottom);
                return(img);
            }

            foreach (var effect in args)
            {
                switch (effect.ToLower())
                {
                case "magik":
                    img.Magik();
                    break;

                case "edge":
                    img.Edge();
                    break;

                case "wave":
                    img.Wave();
                    break;

                case "deepfry":
                    img.Deepfry();
                    break;

                case "jpgify":
                    img.Jpgify();
                    break;

                case "waaw":
                    img.Waaw();
                    break;

                case "haah":
                    img.Haah();
                    break;

                case "contrast":
                    img.Contrast();
                    break;

                case "negate":
                    img.Negate();
                    break;

                case "bulge":
                    img.Bulge();
                    break;

                case "implode":
                    img = img.Implode();
                    break;

                case "drift":
                    img = img.Drift();
                    break;

                case "expand":
                    img = img.Expand();
                    break;

                case "explode":
                    img = img.Explode();
                    break;

                case "dance":
                    img = img.Dance();
                    break;

                case "angry":
                    img = img.Angry();
                    break;

                case "spectrum":
                    img = img.Spectrum();
                    break;

                case "lsd":
                    img = img.Lsd();
                    break;

                default:
                    throw new Exception($"Invalid effect `{effect}`");
                }
            }
            return(img);
        }