private void AddTextToRoot(BlendEffectMode blendEffectMode)
        {
            var redBrushWrapper  = CreateTextToBrushWrapper(blendEffectMode.ToString(), Colors.Red);
            var blueBrushWrapper = CreateTextToBrushWrapper(blendEffectMode.ToString(), Colors.Cyan);

            blueBrushWrapper.Brush.Offset = new Vector2(-4f, 0);
            var blueMaskBrush = CreateGradientBrush();

            var textVisual = Compositor.CreateSpriteVisual();

            textVisual.Brush = CreateBrush(blueBrushWrapper.Brush, redBrushWrapper.Brush, blendEffectMode);
            textVisual.Size  = new Vector2(400, 70);
            var background = new Rectangle {
                Height = 70, Width = 400
            };

            ElementCompositionPreview.SetElementChildVisual(background, textVisual);
            Root.Children.Add(background);
        }
Exemplo n.º 2
0
        private void BlendComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //throw new NotImplementedException();
            //object item = ((ComboBox)sender).SelectedValue;

            BlendEffectMode selmode = (BlendEffectMode)Enum.Parse(typeof(BlendEffectMode), ((ComboBox)sender).SelectedItem.ToString());

            simplePhotoEditor.edgeDetectionBlendEffectMode = selmode;

            StartWritingOutput("Blend Mode :" + selmode.ToString());

            simplePhotoEditor.applyEdgeDetectionEffects();
            canvas2d.Invalidate();
        }
Exemplo n.º 3
0
        public void AddTextBlendBlock(StackPanel stackPanel, string text, BlendEffectMode blendEffectMode, SelectionChangedEventHandler selectionChangedEventHandler)
        {
            TextBlock textBlock = new TextBlock();

            textBlock.Text   = text;
            textBlock.Margin = new Thickness(10, 10, 10, 10);

            ComboBox comboBox = new ComboBox();

            foreach (BlendEffectMode blendmode in Enum.GetValues(typeof(BlendEffectMode)))
            {
                comboBox.Items.Add(blendmode.ToString());
            }
            comboBox.SelectedItem      = blendEffectMode.ToString();
            comboBox.SelectionChanged += selectionChangedEventHandler;

            stackPanel.Children.Add(textBlock);
            stackPanel.Children.Add(comboBox);
        }