コード例 #1
0
        public void AddFilter(ImageFilter filter)
        {
            var filterVM = new SelectedFilterTileViewModel(filter.Name, filter);

            filterVM.ParamChanged.Subscribe(_ => _ParamChanged.OnNext(Unit.Default));
            filterVM.Remove.Subscribe(_ => _Filters.Remove(filterVM));
            filterVM.MoveUp.Subscribe(_ =>
            {
                var theList = _Filters.ToList();
                var curIdx  = theList.IndexOf(filterVM);
                if (curIdx != theList.Count - 1)
                {
                    _Filters.Move(curIdx, curIdx + 1);
                }
            });
            filterVM.MoveDown.Subscribe(_ =>
            {
                var theList = _Filters.ToList();
                var curIdx  = theList.IndexOf(filterVM);
                if (curIdx > 0)
                {
                    _Filters.Move(curIdx, curIdx - 1);
                }
            });

            Filters.Add(filterVM);
        }
コード例 #2
0
        private static ImageFilter CreateImageFilterModel(SelectedFilterTileViewModel fvm)
        {
            var @params = new List <ImageFilterParam>();

            foreach (var p in fvm.Parameters)
            {
                @params.Add(new ImageFilterParam(p.Name, p.Min, p.Max, p.Step, p.Default)
                {
                    Value = p.Value
                });
            }
            return(ImageFilterFactory.CreateFilter(fvm.FilterType, @params.ToArray()));
        }