Esempio n. 1
0
        private void NewDrawingBoard(string fileName)
        {
            Engine.Workflow w = Engine.WorkflowCollection.NewWorkflow();

            if (string.IsNullOrEmpty(fileName))
            {
                w.SetCanvas(new Engine.Surface.Canvas(1200, 1200, Engine.Colors.White));
            }
            else
            {
                try
                {
                    w.SetCanvas(new Engine.Surface.Canvas(fileName));
                }
                catch (Exception e)
                {
                    MessageBox.Show(String.Format("Error reading file : ", e.Message));
                }
            }

            var db = new PaintualUI.Controls.DrawingBoard(w);

            NewDockPane(db, String.Format(t_defaultDocTabTitle + "{0}", w.Key));

            _app.ActiveContentHelper.SetCurrentDrawingBoard(db);

            // a suggested default tool to work with the new DrawingBoard
            SetActivity(new Engine.Tools.GrainyPen());
        }
        /// <summary>
        /// Creates an instance of the VisualPropertyPage and has it fills its content according to the
        /// current DrawingBoard and selected tool, effect, animation.
        /// </summary>
        public void Show(Engine.Workflow w)
        {
            if (t_visualPropertyPage != null)
            {
                t_docContent.Close -= Pane_Close;
                Grid g = (Grid)t_docContent.Content;
                g.Children.Remove(t_visualPropertyPage);
                t_visualPropertyPage = null;
                g = null;

                t_visualPropertyPage = new PaintualUI.Controls.PropertyPage.VisualPropertyPage();
                g                    = new Grid();
                g.Background         = Brushes.DarkGray;
                t_docContent.Content = g;
                g.Children.Add(t_visualPropertyPage);

                t_docContent.Close += Pane_Close;

                t_visualPropertyPage.Build(w);
                return;
            }

            t_visualPropertyPage = new PaintualUI.Controls.PropertyPage.VisualPropertyPage();

            if (t_docContent == null)
            {
                t_docContent = CreateContainer();
            }

            t_visualPropertyPage.Build(w);
        }
Esempio n. 3
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            Ripple r = new Ripple();

            r.Initialize(w);

            return(r);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new instance of an effect that will be attached to another Workflow.
        /// </summary>
        /// <param name="w">The workflow to which a copy of this effect is to be applied to.</param>
        /// <returns></returns>
        public virtual Engine.Tools.IGraphicActivity Duplicate(Engine.Workflow w)
        {
            AnimationBase ab = new AnimationBase();

            ab.Initialize(w);

            return(ab);
        }
Esempio n. 5
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            GrainyPen tlt = new GrainyPen();

            tlt.Initialize(w);

            return(tlt);
        }
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            QuickExtractAndSave qeas = new QuickExtractAndSave();

            qeas.Initialize(w);

            return(qeas);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a new instance of an effect that will be attached to another Workflow.
        /// </summary>
        /// <param name="w">The workflow to which a copy of this effect is to be applied to.</param>
        /// <returns></returns>
        public virtual Engine.Tools.IGraphicActivity Duplicate(Engine.Workflow w)
        {
            Effect eb = new Effect();

            eb.Initialize(w);

            return(eb);
        }
Esempio n. 8
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            Glitch g = new Glitch();

            g.Initialize(w);

            return(g);
        }
Esempio n. 9
0
        public override void Initialize(Engine.Workflow w)
        {
            base.Initialize(w);

            t_imagePerlin = Engine.Effects.Code.Noise.NoiseFactory_Static.CreatePerlinNoisePlane(t_imageSource, t_frequency, t_seed, t_octaves);

            CreateFlowField();
        }
Esempio n. 10
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            Brightness b = new Brightness();

            b.Initialize(w);

            return(b);
        }
Esempio n. 11
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            Flow_2 f2 = new Flow_2();

            f2.Initialize(w);

            return(f2);
        }
Esempio n. 12
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            NoiseFactory nf = new NoiseFactory();

            nf.Initialize(w);

            return(nf);
        }
Esempio n. 13
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            AttractorPen ap = new AttractorPen();

            ap.Initialize(w);

            return(ap);
        }
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            VarianceGradientEffect vge = new VarianceGradientEffect();

            vge.Initialize(w);

            return(vge);
        }
Esempio n. 15
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            ForceEffect fe = new ForceEffect();

            fe.Initialize(w);

            return(fe);
        }
Esempio n. 16
0
        public override IGraphicActivity Duplicate(Engine.Workflow w)
        {
            BlurEffect be = new BlurEffect();

            be.Initialize(w);

            return(be);
        }
Esempio n. 17
0
        public virtual void Initialize(Engine.Workflow w)
        {
            t_workflow            = w;
            t_attributeCollection = new Attributes.AttributeCollection();
            t_imageSource         = t_workflow.Canvas;

            // clear the drawing surface of all work layers created by previous tools or effects
            t_workflow.SelectionGlassRequest(SelectionGlassRequestType.Delete);
        }
Esempio n. 18
0
        internal void SetWorkflow(Engine.Workflow w)
        {
            t_workflow = w;
            if (t_timer.IsEnabled == false)
            {
                t_timer.Start();
            }

            t_workflow.Closing             += E_workflow_Closing;
            t_workflow.InvalidateRequested += E_Workflow_InvalidateRequested;
        }
Esempio n. 19
0
        public override void Initialize(Engine.Workflow w)
        {
            base.Initialize(w);
            t_attributeCollection.Add(t_folderPath_PropertyName, new Engine.Attributes.StringAttribute());
            t_attributeCollection.Add(t_prefix_PropertyName, new Engine.Attributes.StringAttribute());
            t_attributeCollection.Add(t_format_PropertyName, new Engine.Attributes.StringAttribute());

            // moved to HasErrors prop. because the property is set before the tool is used
            // so if errros, no selectionGlass is created for nothing
            //t_VIOM.SelectionGlassRequest(SelectionGlassRequestType.Create);
        }
Esempio n. 20
0
        private void SetActivity(Engine.Tools.IGraphicActivity activity)
        {
            Engine.Workflow w = GetWorkflowForCurrentDrawingBoard();

            if (w == null)
            {
                return;
            }

            w.SetActivity(activity);

            _app.VisualPropertyPageManager.Show(w);
        }
Esempio n. 21
0
        public void SetCurrentDrawingBoard(PaintualUI.Controls.DrawingBoard db)
        {
            if (db != t_currentDrawingBoard)
            {
                t_currentDrawingBoard = db;

                Engine.Workflow w = t_currentDrawingBoard.Workflow;
                Engine.WorkflowCollection.SetAsActiveWorkflow(w.Key);

                // VisualPropertyPage has registered to this event
                OnCurrentDrawingBoardChanged();
            }
        }
Esempio n. 22
0
        private Engine.Workflow GetWorkflowForCurrentDrawingBoard()
        {
            PaintualUI.Controls.DrawingBoard db = _app.ActiveContentHelper.GetCurrentDrawingBoard();

            if (db == null)
            {
                MessageBox.Show("Select a drawing board first");
                return(null);
            }

            Engine.Workflow w = db.Workflow;

            return(w);
        }
Esempio n. 23
0
        public static void EndWorkflow(int key)
        {
            if (key == -1)
            {
                return;
            }

            Engine.Workflow w = t_workflows[key];

            w.OnClosing();

            t_workflows.Remove(key);

            w.Dispose();
        }
Esempio n. 24
0
        public override void Initialize(Engine.Workflow w)
        {
            base.Initialize(w);

            // both have all values initialized at 0 by default;
            t_buffer_1 = new Engine.Effects.Particles.FluidField(t_imageSource.Width, t_imageSource.Height);
            t_buffer_2 = new Effects.Particles.FluidField(t_imageSource.Width, t_imageSource.Height);

            sum  = new double[t_imageSource.Width * t_imageSource.Height];
            b1_1 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_2 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_3 = new double[t_imageSource.Width * t_imageSource.Height];
            b1_4 = new double[t_imageSource.Width * t_imageSource.Height];

            b2_1 = new double[t_imageSource.Width * t_imageSource.Height];
        }
Esempio n. 25
0
        public static Engine.Workflow GetWorkflow(int key)
        {
            if (key == -1)
            {
                throw new ArgumentOutOfRangeException(String.Format("In {0}, the provided Workflow key {1} cannot be retrieved.", "WorkflowCollection.GetWorkflow", key));
            }

            Engine.Workflow w = t_workflows[key];

            if (w == null)
            {
                throw new ArgumentException(String.Format("The Viome with the specified key ({0}) does not exist in the Application.", key));
            }

            return(w);
        }
Esempio n. 26
0
        private void Extraction_QuickExtractAndSave_Click(object sender, RoutedEventArgs e)
        {
            PaintualUI.Controls.DrawingBoard db = _app.ActiveContentHelper.GetCurrentDrawingBoard();

            if (db == null)
            {
                MessageBox.Show("Select a drawing board first");
                return;
            }

            Engine.Workflow w = db.Workflow;

            Engine.Tools.QuickExtractAndSave qeas = new Engine.Tools.QuickExtractAndSave();

            w.SetActivity(qeas);

            _app.VisualPropertyPageManager.Show(w);

            // TODO : determine when double click should not be handled anymore and release handler
            db.SelectionDoubleClick += qeas.HandleDoubleClick;
        }
Esempio n. 27
0
        private void Save_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            PaintualUI.Controls.DrawingBoard db = _app.ActiveContentHelper.GetCurrentDrawingBoard();

            if (db == null)
            {
                MessageBox.Show("Select a drawing board first");
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog()
            {
                Filter = "PNG files(*.png)|*.png"
            };

            if (dialog.ShowDialog() == true)
            {
                Engine.Workflow w = db.Workflow;
                w.LastSavedFolder = dialog.FileName;
                w.SaveImage(dialog.FileName, Engine.Surface.ImageFileFormats.PNG);
            }
        }
Esempio n. 28
0
 public void DeleteDrawingBoard(PaintualUI.Controls.DrawingBoard db)
 {
     Engine.Workflow w = db.Workflow;
     Engine.WorkflowCollection.EndWorkflow(w.Key);
 }
Esempio n. 29
0
 public abstract IGraphicActivity Duplicate(Engine.Workflow w);
Esempio n. 30
0
 public WorkflowEventArgs(Engine.Workflow w)
 {
     Workflow = w;
 }