Ejemplo n.º 1
0
        public MainPage()
        {
            this.InitializeComponent();

            Sequensor.Controller.Create();
            Sequensor.Controller.AddItem += async(sender, item) =>
            {
                if (m_need_init && item is Sequence.Render.SequenceRenderObject)
                {
                    var w = (item as Sequence.Render.SequenceRenderObject).Width;
                    var h = (item as Sequence.Render.SequenceRenderObject).Height;

                    m_need_init = false;
                    await VideoProject.GetInstance().SetSettings((int)w, (int)h, MediaCore.Types.FPS.FPS10);

                    w = VideoProject.GetInstance().Width;
                    h = VideoProject.GetInstance().Heigth;

                    W2D.Width  = w;
                    W2D.Height = h;

                    canvas.Width  = w;
                    canvas.Height = h;
                }

                var render = item as Sequence.Render.SequenceRenderObject;

                if (render != null)
                {
                    var rect = new TransformationBox()
                    {
                        Width           = render.Width,
                        Height          = render.Height,
                        Background      = new SolidColorBrush(Colors.Transparent),
                        BorderBrush     = new SolidColorBrush(Colors.Red),
                        BorderThickness = new Thickness(2),
                        Render          = render
                    };

                    rect.CompositeTransformChange += (s) => {
                        W2D.Invalidate();
                    };

                    canvas.Children.Add(rect);
                }
            };

            Sequensor.Controller.OnDraw += () =>
            {
                W2D.Invalidate();
            };
        }
Ejemplo n.º 2
0
 private void Render(object sender, RoutedEventArgs e)
 {
     W2D.Invalidate();
 }