示例#1
0
        public static ZoomProcessArguments Parse(string query)
        {
            query = (query ?? String.Empty).Trim();

            var result = new ZoomProcessArguments();
            var large  = MatchNullable <int>(m_rLarge, query);

            result.Large           = large.HasValue && large.Value == 1;
            result.Width           = MatchNullable <int>(m_rWidth, query);
            result.Height          = MatchNullable <int>(m_rHeigth, query);
            result.Multiple        = MatchNullable <int>(m_rMultiple, query);
            result.Quality         = MatchNullable <int>(m_rQuality, query);
            result.AbsoluteQuality = MatchNullable <int>(m_rAbsoluteQuality, query);
            result.Edge            = Match <EdgeEnum>(m_rEdge, query);
            result.Format          = Match <string>(m_rFormat, query);
            return(result);
        }
示例#2
0
        public static IImageProcessor[] ParseQuery(string query, out string extension)
        {
            extension = String.Empty;
            if (String.IsNullOrWhiteSpace(query))
            {
                return(new IImageProcessor[0]);
            }
            else
            {
                query = query.Trim();
                if (query[0] == '@')
                {
                    query = query.Substring(1);
                }

                var querys = query.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                if (querys.Length == 0)
                {
                    return(new IImageProcessor[0]);
                }
                else
                {
                    var result = new List <IImageProcessor>();
                    foreach (var item in querys)
                    {
                        var args = ZoomProcessArguments.Parse(item);
                        if (args.IsNeetProcess())
                        {
                            extension = args.Format;
                            result.Add(new ZoomProcessor(args));
                        }
                    }
                    return(result.ToArray());
                }
            }
        }
示例#3
0
 public ZoomProcessor(ZoomProcessArguments args)
 {
     ExceptionHelper.ThrowIfNull(args, "args");
     _Args = args;
 }
示例#4
0
        public static System.IO.Stream Zoom(this System.IO.Stream imageStream, ZoomProcessArguments args)
        {
            var processor = new ZoomProcessor(args);

            return(processor.Process(null, imageStream));
        }