Beispiel #1
0
        public FiltersViewModel(Models.Models models)
        {
            this.models        = models;
            this.ApplyCommand  = new ApplyFiltersCommand(this);
            this.CancelCommand = new CancelFiltersCommand(this);
            this.statisticsInfo.Add(new TextBlock
            {
                Text         = StatisticsListBoxItem.Text,
                TextWrapping = TextWrapping.Wrap
            });

            // load default filter
            var disableGl = models.GlContext.Enable();

            try
            {
                var loader = new FilterLoader(models.App.App.ExecutionPath + "\\Filter\\gamma.comp", models.GlContext);

                AddFilter(new FilterModel(loader));

                Apply();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                if (disableGl)
                {
                    models.GlContext.Disable();
                }
            }
        }
Beispiel #2
0
 public ActionResult Delete_Model(string Id, string IdMark)
 {
     Models.Models model = db.Models.FirstOrDefault(m => m.Id == Id && m.IdMark == IdMark);
     db.Models.Remove(model);
     db.SaveChanges();
     return(RedirectToAction("Select"));
 }
Beispiel #3
0
 /// <summary>
 ///     Lists the specified qb builder.
 /// </summary>
 /// <param name="qbBuilder">The qb builder.</param>
 /// <returns>ActionResult.</returns>
 public ActionResult List(QueryBuilder qbBuilder)
 {
     using (Models.Models contextModels = new Models.Models())
     {
         var result = contextModels.MyEntities.Where(qbBuilder).ToList();
         return(this.Json(result));
     }
 }
Beispiel #4
0
 /// <summary>
 ///     Lists the specified qb builder.
 /// </summary>
 /// <param name="qbBuilder">The qb builder.</param>
 /// <returns>ActionResult.</returns>
 public ActionResult List(QueryBuilder qbBuilder)
 {
     using (Models.Models contextModels = new Models.Models())
     {
         var result = contextModels.MyEntities.Where(qbBuilder).ToList();
         return this.Json(result);
     }
 }
Beispiel #5
0
 public ImportEquationImageCommand(Models.Models models)
 {
     this.models = models;
     for (var i = 0; i < models.FinalImages.NumImages; ++i)
     {
         models.FinalImages.Get(i).PropertyChanged += FinalImageOnPropertyChanged;
     }
 }
Beispiel #6
0
        public ExportDialog(Models.Models models, string filename, ImageLoader.ImageFormat defaultPixelFormat, ExportModel.FileFormat format)
        {
            models.Export.Init(filename, defaultPixelFormat, format);
            viewModel   = new ExportViewModel(models);
            DataContext = viewModel;

            InitializeComponent();
        }
Beispiel #7
0
 public ActionResult Edit_Model(Models.Models modell)
 {
     if (ValidModel(modell))
     {
         db.Entry(modell).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     return(RedirectToAction("Select"));
 }
Beispiel #8
0
 public ProgressController(Models.Models models)
 {
     this.models          = models;
     this.imageController = new List <ImageCombineController>();
     for (var i = 0; i < models.Equations.NumEquations; ++i)
     {
         imageController.Add(new ImageCombineController(models.Equations.Get(i), models.FinalImages.Get(i), models, i));
     }
 }
Beispiel #9
0
        public DisplayViewModel(Models.Models models)
        {
            this.models                       = models;
            this.selectedSplitMode            = AvailableSplitModes[models.Display.Split == DisplayModel.SplitMode.Vertical ? 0 : 1];
            models.Display.PropertyChanged   += DisplayModelOnPropertyChanged;
            models.Images.PropertyChanged    += ImagesModelOnPropertyChanged;
            models.Equations.PropertyChanged += EquationsOnPropertyChanged;

            CreateViewModes();
        }
Beispiel #10
0
 public ViewModeController(Models.Models models)
 {
     this.models = models;
     models.Display.PropertyChanged        += ViewModeModelOnPropertyChanged;
     models.GlContext.GlControl.MouseWheel += GlControlOnMouseWheel;
     models.GlContext.GlControl.MouseDown  += GlControlOnMouseDown;
     models.GlContext.GlControl.MouseUp    += GlControlOnMouseUp;
     models.GlContext.GlControl.MouseLeave += GlControlOnMouseLeave;
     models.GlContext.GlControl.MouseMove  += GlControlOnMouseMove;
 }
Beispiel #11
0
 public EquationsViewModel(Models.Models models)
 {
     this.models = models;
     this.Apply  = new ApplyImageFormulasCommand(this);
     viewModels  = new EquationViewModel[models.Equations.NumEquations];
     for (var i = 0; i < viewModels.Length; ++i)
     {
         viewModels[i] = new EquationViewModel(models.Equations.Get(i), models, i);
         viewModels[i].PropertyChanged += OnPropertyChanged;
     }
 }
 public ImageCombineStepable(
     ImageEquationModel equation,
     FinalImageModel finalImage,
     Models.Models models,
     ImageCombineBuilder builder)
 {
     this.equation   = equation;
     this.finalImage = finalImage;
     this.models     = models;
     this.builder    = builder;
 }
 public ImageCombineController(ImageEquationModel equation, FinalImageModel finalImage, Models.Models models, int equationId)
 {
     this.equation   = equation;
     this.finalImage = finalImage;
     this.models     = models;
     this.equationId = equationId;
     equation.ColorFormula.PropertyChanged += FormulaOnPropertyChanged;
     equation.AlphaFormula.PropertyChanged += FormulaOnPropertyChanged;
     equation.PropertyChanged           += EquationOnPropertyChanged;
     this.models.Images.PropertyChanged += ImagesOnPropertyChanged;
     this.models.Filter.Changed         += FilterOnChanged;
 }
Beispiel #14
0
        public StatisticViewModel(int index, Models.Models models, StatisticsViewModel viewModel)
        {
            this.index     = index;
            this.models    = models;
            this.viewModel = viewModel;
            this.models.Statistics.StatisticChanged            += ModelOnStatisticChanged;
            this.models.Statistics.PropertyChanged             += ModelOnPropertyChanged;
            this.models.Equations.Get(index).PropertyChanged   += OnEquationPropertyChanged;
            this.models.FinalImages.Get(index).PropertyChanged += OnFinalImagePropertyChanged;

            viewModel.PropertyChanged += ViewModelOnPropertyChanged;
        }
Beispiel #15
0
        public PaintController(Models.Models models)
        {
            this.models = models;

            this.models.GlContext.GlControl.Paint += OnPaint;
            this.models.GlContext.PropertyChanged += GlContextOnPropertyChanged;
            this.models.Export.PropertyChanged    += ExportOnPropertyChanged;
            this.models.Display.PropertyChanged   += DisplayOnPropertyChanged;

            this.viewModeController = new ViewModeController(models);
            this.progressController = new ProgressController(models);
        }
Beispiel #16
0
        public ActionResult Edit_Model(string Id, string IdMark)
        {
            var MarkLst   = new List <Marks>();
            var MarkQuery = from d in db.Marks
                            orderby d.Mark
                            select d;

            MarkLst.AddRange(MarkQuery.Distinct());
            ViewBag.MarkLst = MarkLst;
            Models.Models model = db.Models.FirstOrDefault(m => m.Id == Id && m.IdMark == IdMark);
            return(View(model));
        }
Beispiel #17
0
        bool ValidModel(Models.Models model)
        {
            bool Notnull  = model.IdMark != null && model.Model != null;
            bool ModelVal = model.Model.Length <= 30;

            if (Notnull && ModelVal)
            {
                if (db.Models.Count(m => m.IdMark == model.IdMark & m.Model == model.Model) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #18
0
 public FilterStepableBase(
     Models.Models models,
     FilterModel model,
     ImageCombineBuilder builder,
     int layer,
     int mipmap,
     int iteration)
 {
     Model          = model;
     this.iteration = iteration;
     this.Builder   = builder;
     this.models    = models;
     this.layer     = layer;
     this.mipmap    = mipmap;
 }
        public PixelDisplayViewModel(Models.Models models)
        {
            this.models = models;
            this.models.Display.PropertyChanged += DisplayOnPropertyChanged;
            this.decimalPlaces = models.Display.TexelDecimalPlaces;
            this.radius        = models.Display.TexelRadius;
            this.alpha         = models.Display.TexelDisplayAlpha;

            AvailableFormats.Add(new ComboBoxItem <DisplayModel.TexelDisplayMode>("decimal linear", DisplayModel.TexelDisplayMode.LinearDecimal));
            AvailableFormats.Add(new ComboBoxItem <DisplayModel.TexelDisplayMode>("decimal srgb", DisplayModel.TexelDisplayMode.SrgbDecimal));
            AvailableFormats.Add(new ComboBoxItem <DisplayModel.TexelDisplayMode>("byte linear", DisplayModel.TexelDisplayMode.LinearByte));
            AvailableFormats.Add(new ComboBoxItem <DisplayModel.TexelDisplayMode>("byte srgb", DisplayModel.TexelDisplayMode.SrgbByte));

            selectedFormat = AvailableFormats.Find(box => box.Cargo == models.Display.TexelDisplay);
        }
Beispiel #20
0
        public StatisticsViewModel(Models.Models models)
        {
            this.models        = models;
            selectedColorSpace = AvailableColorSpaces[0];
            selectedChannel    = AvailableChannels[0];
            this.models.Statistics.PropertyChanged += StatisticsOnPropertyChanged;

            viewModels = new StatisticViewModel[models.Statistics.NumStatistics];
            for (int i = 0; i < viewModels.Length; ++i)
            {
                viewModels[i] = new StatisticViewModel(i, models, this);
            }

            models.App.Window.TabControl.SelectionChanged += TabControlOnSelectionChanged;
        }
Beispiel #21
0
        public ExportViewModel(Models.Models models)
        {
            this.models = models;

            // init layers
            for (var i = 0; i < models.Images.NumLayers; ++i)
            {
                AvailableLayers.Add(new ComboBoxItem <int>("Layer " + i, i));
            }
            selectedLayer = AvailableLayers[models.Export.Layer];
            Debug.Assert(selectedLayer.Cargo == models.Export.Layer);

            // init mipmaps
            for (var i = 0; i < models.Images.NumMipmaps; ++i)
            {
                AvailableMipmaps.Add(new ComboBoxItem <int>("Mipmap " + i, i));
            }
            selectedMipmap = AvailableMipmaps[models.Export.Mipmap];
            Debug.Assert(selectedMipmap.Cargo == models.Export.Mipmap);

            // all layer option for ktx and dds
            if (models.Images.NumLayers > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds))
            {
                AvailableLayers.Add(new ComboBoxItem <int>("All Layer", -1));
                selectedLayer       = AvailableLayers.Last();
                models.Export.Layer = selectedLayer.Cargo;
            }

            // all mipmaps option for ktx and dds
            if (models.Images.NumMipmaps > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds))
            {
                AvailableMipmaps.Add(new ComboBoxItem <int>("All Mipmaps", -1));
                selectedMipmap       = AvailableMipmaps.Last();
                models.Export.Mipmap = selectedMipmap.Cargo;
            }

            // init formats
            foreach (var format in models.Export.SupportedFormats)
            {
                AvailableFormat.Add(new ComboBoxItem <DisplayedFormat>(format.DisplayedName, format));
                if (format == models.Export.TexFormat)
                {
                    SelectedFormat = AvailableFormat.Last();
                }
            }

            models.Export.PropertyChanged += ExportOnPropertyChanged;
        }
Beispiel #22
0
        public EquationViewModel(ImageEquationModel model, Models.Models models, int imageId)
        {
            this.model             = model;
            this.models            = models;
            this.imageId           = imageId;
            this.Color             = new FormulaViewModel(model.ColorFormula, models.Images, this);
            this.Alpha             = new FormulaViewModel(model.AlphaFormula, models.Images, this);
            Color.PropertyChanged += FormulaOnPropertyChanged;
            Alpha.PropertyChanged += FormulaOnPropertyChanged;

            this.useFilter = model.UseFilter;

            this.model.PropertyChanged          += ModelOnPropertyChanged;
            this.models.Display.PropertyChanged += DisplayOnPropertyChanged;
            this.models.FinalImages.Get(imageId).PropertyChanged += FinalImageOnPropertyChanged;
        }
Beispiel #23
0
        public WindowViewModel(App app, MainWindow window)
        {
            this.models = new Models.Models(app, window, this);

            // controller
            this.paintController = new PaintController(models);

            // model views
            Images     = new ImagesViewModel(models, this);
            Display    = new DisplayViewModel(models);
            Equations  = new EquationsViewModel(models);
            Progress   = new ProgressViewModel(models);
            Filter     = new FiltersViewModel(models);
            Statistics = new StatisticsViewModel(models);

            // commands
            var import = new ImportImageCommand(models, this);

            ImportCommand = import;
            ResizeCommand = new ResizeWindowCommand(models);
            ImportEquationImageCommand = new ImportEquationImageCommand(models);
            OpenCommand             = new OpenImageCommand(models, import);
            ExportCommand           = new ExportImageCommand(models);
            AddFilterCommand        = new AddFilterCommand(models, Filter);
            ShowPixelDisplayCommand = new ShowPixelDialogCommand(models);
            ShowPixelColorCommand   = new ShowPixelColorCommand(models);
            GenerateMipmapsCommand  = new GenerateMipmapsCommand(models);
            DeleteMipmapsCommand    = new DeleteMipmapsCommand(models);

            window.KeyUp += WindowOnKeyUp;
            models.GlContext.GlControl.DragDrop += GlControlOnDragDrop;

            HelpAboutCommand        = new HelpCommand("help\\about.md");
            HelpEquationCommand     = new HelpCommand("help\\equation.md");
            HelpFilterManualCommand = new HelpCommand("help\\filter_manual.md");
        }
Beispiel #24
0
 public MultiDispatchStepper(Models.Models models, FilterModel model, ImageCombineBuilder builder, int layer, int mipmap, int iteration) :
     base(models, model, builder, layer: layer, mipmap: mipmap, iteration: iteration)
 {
     this.width  = GetNumMinimalInvocations(models.Images.GetWidth(mipmap));
     this.height = GetNumMinimalInvocations(models.Images.GetHeight(mipmap));
 }
 public SingleDispatchStepper(Models.Models models, FilterModel model, ImageCombineBuilder builder, int layer, int mipmap, int iteration) :
     base(models, model, builder, layer: layer, mipmap: mipmap, iteration: iteration)
 {
     this.width  = Utility.Utility.DivideRoundUp(models.Images.GetWidth(mipmap), FilterShader.LocalSize);
     this.height = Utility.Utility.DivideRoundUp(models.Images.GetHeight(mipmap), FilterShader.LocalSize);
 }
Beispiel #26
0
 public ProgressViewModel(Models.Models models)
 {
     this.models = models;
     this.models.Progress.PropertyChanged += ProgressOnPropertyChanged;
     this.models.Export.PropertyChanged   += ExportOnPropertyChanged;
 }
Beispiel #27
0
 public OpenImageCommand(Models.Models models, ImportImageCommand import)
 {
     this.models = models;
     this.import = import;
 }
Beispiel #28
0
 public PolarTextureView(Models.Models models) : base(models)
 {
     shader = new PolarViewShader();
 }
 public ShowPixelDialogCommand(Models.Models models)
 {
     this.models = models;
 }
 protected ProjectionTextureView(Models.Models models)
 {
     this.models = models;
 }
Beispiel #31
0
 public SingleTextureView(Models.Models models) : base(models)
 {
 }