Наследование: IInkDrawingAttributes
Пример #1
0
 private void ChangeColor(object sender, TappedRoutedEventArgs e)
 {
     var b = ((Ellipse)sender).Fill as SolidColorBrush;
     var da = new InkDrawingAttributes();
     da.Color = b.Color;
     InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(da);
 }
Пример #2
0
        public Page1()
        {
            this.InitializeComponent();

            penSize = minPenSize;// + penSizeIncrement * PenThickness.SelectedIndex;

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;


            // Show the available recognizers
            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;
        }
		private void LineupEditPage_Loaded(object sender, RoutedEventArgs e)
		{
			if (App.MainViewModel.SelectedLineup == null)
			{
				App.MainViewModel.ShowPage(typeof(TeamManagerPage));
				return;
			}

			// build view model
			_model = new LineupViewModel(App.MainViewModel.SelectedTeam.Players, App.MainViewModel.SelectedTeam);
			this.DataContext = _model;

			// setup
			this.InkCanvas.InkPresenter.InputDeviceTypes =
					CoreInputDeviceTypes.Pen |
					CoreInputDeviceTypes.Touch |
					CoreInputDeviceTypes.Mouse;

			var drawingAttributes = new InkDrawingAttributes
			{
				DrawAsHighlighter = false,
				PenTip = PenTipShape.Circle,
				Size = new Size(4, 4),
				Color = Colors.WhiteSmoke
			};

			this.InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
		}
        public TrailsTestInstruction()
        {
            this.InitializeComponent();
            DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Landscape; //Landscape mode
            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;

            nodes = new List<TrailNode>();
            ink_manager = new Windows.UI.Input.Inking.InkManager();

            //Set the ink to not use bezeir curves
            drawingAttributes = new Windows.UI.Input.Inking.InkDrawingAttributes();
            // True is the Default value for fitToCurve.
            drawingAttributes.FitToCurve = false;
            ink_manager.SetDefaultDrawingAttributes(drawingAttributes);

            disp = new DispatcherTimer();
            disp.Interval = new TimeSpan(0, 0, 0, 0, 1);
            disp.Tick += timer_tick;

            instructionTimer = new DispatcherTimer();
            instructionTimer.Interval = new TimeSpan(0, 0, 3);
            instructionTimer.Tick += instruction_tick;
            instructionTimer.Start();

            pen = new Image();

            instructions = new List<string>();
            amountToMove = 3;
        }
        public Scenario4()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description4_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description4_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);
            this.txtBoxAddress.PlaceholderText = ResourceManagerHelper.ReadValue("IP");

            penSize = minPenSize + penSizeIncrement * selectThickness;
            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            this.SizeChanged += Scenario4_SizeChanged;
            this.radioBtnClient.Checked += radioBtnClient_Checked;
            this.radioBtnServer.Checked += radioBtnServer_Checked;
        }
Пример #6
0
        public MainPage()
        {
            this.InitializeComponent();
            this.Loaded += MainPage_Loaded;

            //Atributos da caneta
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            //Cor da caneta
            drawingAttributes.Color = Windows.UI.Colors.Green;
            //tamanho
            drawingAttributes.Size = new Size(penSize, penSize);
            //verificação de pressão de caneta
            drawingAttributes.IgnorePressure = false;
            //
            drawingAttributes.FitToCurve = true;

            //atualiza os atributos de desenho com os atributos definidos acima
            areaDesenho.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            //Define os tipos de inputs para desenho no canvas
            areaDesenho.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;


            output.Height = Window.Current.Bounds.Height;
            output.Width = Window.Current.Bounds.Width;
            areaDesenho.Height = Window.Current.Bounds.Height;
            areaDesenho.Width = Window.Current.Bounds.Width;


            radio_desenhar.IsChecked = true;

            //registrando para share
            RegisterForShare();
        }
Пример #7
0
        public InkView()
        {
            this.InitializeComponent();

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            Ink.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            Ink.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;
        }
Пример #8
0
        private void PenButton_Click(object sender, RoutedEventArgs e)
        {
            this.InkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            var drawingAttributes = new InkDrawingAttributes
            {
                DrawAsHighlighter = false
            };

            this.InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
        }
Пример #9
0
 public BattleCanvas()
 {
     this.InitializeComponent();
     InkDrawingAttributes inkDrawingAttributes = new InkDrawingAttributes();
     inkDrawingAttributes.Color = Utils.ColorUtils.GetColorFromHex("#FF616668");
     inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(inkDrawingAttributes);
     inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
     inkCanvas.InkPresenter.StrokeInput.StrokeEnded += StrokeInput_StrokeEnded;
     Window.Current.SizeChanged += Current_SizeChanged;
     inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;
 }
Пример #10
0
        public MainPage()
        {
            this.InitializeComponent();

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            InkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
        }
Пример #11
0
        public MainPage()
        {
            this.InitializeComponent();
            _inkCanvas = inkCanvas;
            _inkPresenter = inkCanvas.InkPresenter;
            _inkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;
            _inkDrawingAttributes = new InkDrawingAttributes();

            webView.Visibility = Visibility.Collapsed;
            searchBox.Visibility = Visibility.Collapsed;
            goButton.Visibility = Visibility.Collapsed;
            backButton.Visibility = Visibility.Collapsed;
            
        }
Пример #12
0
        private void HighlighterButtoner_Click(object sender, RoutedEventArgs e)
        {
            this.InkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            var drawingAttributes = new InkDrawingAttributes
            {
                DrawAsHighlighter = true,
                PenTip = PenTipShape.Rectangle,
                Size = new Size(4, 10),
                Color = Colors.Yellow
            };

            this.InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
        }
Пример #13
0
        public SelectedModel()
        {
            InitializeComponent();
            penSize = minPenSize + penSizeIncrement * 1;
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Orange;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;
            inkToolbar.PenSize = new Size(penSize, penSize);

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;

            navigationHelper = new NavigationHelper(this);
            navigationHelper.LoadState += navigationHelper_LoadState;
            navigationHelper.SaveState += navigationHelper_SaveState;
            var view = ApplicationView.GetForCurrentView();

            view.TitleBar.BackgroundColor = Color.FromArgb(255, 253, 115, 19);
            view.TitleBar.ForegroundColor = Colors.White;

            view.TitleBar.ButtonBackgroundColor = Color.FromArgb(255, 253, 115, 19);
            view.TitleBar.ButtonForegroundColor = Colors.White;

            view.TitleBar.ButtonHoverBackgroundColor = Colors.Orange;
            view.TitleBar.ButtonHoverForegroundColor = Colors.White;

            view.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(255, 240, 115, 19);
            view.TitleBar.ButtonPressedForegroundColor = Colors.White;

            Window.Current.CoreWindow.SizeChanged += (ss, ee) =>
            {
                HubSectionGraph.MinWidth = ee.Size.Width - 500;
                listViewResults.Height = ee.Size.Height - 310;
                listView.Margin = new Thickness(264, Window.Current.Bounds.Height - 184, 0, 0);
                listView.Height = Window.Current.Bounds.Height - listViewResults.Height;
                LineChart.Height = ee.Size.Height - 119;
                if (ee.Size.Width - 531 > 0)
                    LineChart.MinWidth = ee.Size.Width - 531;
                inkCanvas.Height = LineChart.Height;
                if (Window.Current.Bounds.Width - 531 > 0)
                    inkCanvas.MinWidth = Window.Current.Bounds.Width - 531;
                inkToolbar.Margin = new Thickness(Window.Current.Bounds.Width - 156, 61, 0, 0);
                toggleSwitch.Margin = new Thickness(26, bResult.Margin.Top + 50, 0, 0);
                ProgressRing.Margin = new Thickness(85, toggleSwitch.Margin.Top + 60, 0, 0);
                bListen.Margin = new Thickness(26, bResult.Margin.Top + 120, 0, 0);
                sayText.Margin = new Thickness(86, bResult.Margin.Top + 120, 0, 0);
            };
        }
Пример #14
0
		private void OnLoaded(object sender, RoutedEventArgs e)
		{
			inkAttr = new InkDrawingAttributes();
			inkAttr.IgnorePressure = false;
			inkAttr.PenTip = PenTipShape.Circle;
			inkAttr.Size = new Size(4, 4);
			inkAttr.Color = Colors.Black;
			ResetInkManager();

#if NETWORK
			Network.OnNetworkRecieved += OnNetworkRecieved;
			Network.connect();
#endif
		}
Пример #15
0
        public InkNotesControl()
        {
            this.InitializeComponent();

            penSize = minPenSize + penSizeIncrement * PenThickness.SelectedIndex;

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
        }
        public Scenario1()
        {
            this.InitializeComponent();
     
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
        }
        public Scenario2()
        {
            this.InitializeComponent();

            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            double penSize = 4;
            drawingAttributes.Size = new Windows.Foundation.Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            // Show the available recognizers
            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            // Initialize reco tooltip
            recoTooltip = new ToolTip();
            recoTooltip.Content = InstallRecoText;
            ToolTipService.SetToolTip(InstallReco, recoTooltip);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            this.Unloaded += Scenario2_Unloaded;
            this.SizeChanged += Scenario2_SizeChanged;
        }
        public Scenario2()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description2_p1");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());

            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            double penSize = 4;
            drawingAttributes.Size = new Windows.Foundation.Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            // Show the available recognizers
            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            this.SizeChanged += Scenario2_SizeChanged;
        }
        protected override InkDrawingAttributes CreateInkDrawingAttributesCore(Brush brush, double strokeWidth)
        {

            InkDrawingAttributes inkDrawingAttributes = new InkDrawingAttributes();
            inkDrawingAttributes.PenTip = PenTipShape.Circle;
            inkDrawingAttributes.IgnorePressure = false;
            SolidColorBrush solidColorBrush = (SolidColorBrush)brush;

            if (solidColorBrush != null)
            {
                inkDrawingAttributes.Color = solidColorBrush.Color;
            }

            inkDrawingAttributes.Size = new Size(strokeWidth, 2.0f * strokeWidth);
            inkDrawingAttributes.PenTipTransform = System.Numerics.Matrix3x2.CreateRotation(45.0f);

            return inkDrawingAttributes;
        }
        public MainPage()
        {
            this.InitializeComponent();

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Black;
            drawingAttributes.Size = new Size(4, 4);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;


            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;



            InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            InkCanvas.InkPresenter.InputDeviceTypes = 
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                Windows.UI.Core.CoreInputDeviceTypes.Pen |
                Windows.UI.Core.CoreInputDeviceTypes.Touch;

            // 音声合成の追加
            synthesizer = new SpeechSynthesizer();

        }
Пример #21
0
        public MainPage()
        {
            this.InitializeComponent();

            roamingSettings = ApplicationData.Current.RoamingSettings;
            localSettings = ApplicationData.Current.LocalSettings;

            //Setup the default ink canvas attributes
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();

            drawingAttributes.Color = Windows.UI.Colors.Black;
            drawingAttributes.Size = new Size(4, 4);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkRecognizerContainer = new InkRecognizerContainer();
            recognizerView = inkRecognizerContainer.GetRecognizers();

            if(localSettings.Values.Keys.Contains("RecogniserName"))
            {
                var recogniserName = localSettings.Values["RecogniserName"];
                SetRecognizerByName(recogniserName.ToString());
                Status.Text = recogniserName.ToString();
            }
           
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);

            //Allow Mouse, Pen and Touch inputs to the ink canvas (default is pen only)
            inkCanvas.InkPresenter.InputDeviceTypes =
                CoreInputDeviceTypes.Mouse |
                //CoreInputDeviceTypes.Touch |
                CoreInputDeviceTypes.Pen;

            //Register the StrokeCollected event
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;

            GetTextFile();
        }
Пример #22
0
        public Ink()
        {
            this.InitializeComponent();
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Color.FromArgb(255,243,156,17);
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            pancakeInk.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            pancakeInk.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;           
            pancakeInk.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            pancakeInk.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            preClickedButton = pen;
            linkageButtons.Add(pen);
            linkageButtons.Add(penWP);
            linkageButtons.Add(eraser);
            linkageButtons.Add(eraserWP);       
        }
Пример #23
0
        public MainPage()
        {


            this.InitializeComponent();
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Black;
            drawingAttributes.Size = new Size(4, 4);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            InkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

        }
Пример #24
0
        public void inking_initialization()
        {

            
            myInkCanvas.Width = rootGrid.ActualWidth;
            myInkCanvas.Height = rootGrid.ActualHeight;

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Black;
            drawingAttributes.Size = new Size(4, 4);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;


            try
            {
                inkRecognizerContainer = new InkRecognizerContainer();
                recoView = inkRecognizerContainer.GetRecognizers();
                if (recoView.Count > 0)
                {
                    inkRecognizerContainer.SetDefaultRecognizer(recoView.First());
                }
            }
            catch (Exception)
            {
                System.Diagnostics.Debug.WriteLine("Couldn't initialize InkRecognizer");
            }

            myInkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(
                drawingAttributes);
            myInkCanvas.InkPresenter.InputDeviceTypes =
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                Windows.UI.Core.CoreInputDeviceTypes.Pen |
                Windows.UI.Core.CoreInputDeviceTypes.Touch;


        }
Пример #25
0
        void canvas_pointer_pressed(object sender, PointerRoutedEventArgs e)
        {

            if (tool != "eraser")
                Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Cross, 1);
            else
                Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.UniversalNo, 1);


            switch (tool)
            {

                case "line":
                    {
                        NewLine = new Line();
                        NewLine.X1 = e.GetCurrentPoint(canvas).Position.X;
                        NewLine.Y1 = e.GetCurrentPoint(canvas).Position.Y;
                        NewLine.X2 = NewLine.X1 + 1;
                        NewLine.Y2 = NewLine.Y1 + 1;
                        NewLine.StrokeThickness = StrokeThickness;
                        NewLine.Stroke = new SolidColorBrush(BorderColor);
                        canvas.Children.Add(NewLine);
                    }
                    break;

                case "pencil":
                    {

                        /* old code
                         StartPoint = e.GetCurrentPoint(canvas).Position;
                         Pencil = new Polyline();
                         Pencil.Stroke = new SolidColorBrush(BorderColor);
                         Pencil.StrokeThickness = StrokeThickness;
                         canvas.Children.Add(Pencil);
                         * */


                        var MyDrawingAttributes = new InkDrawingAttributes();
                        MyDrawingAttributes.Size = new Size(StrokeThickness, StrokeThickness);
                        MyDrawingAttributes.Color = BorderColor;
                        MyDrawingAttributes.FitToCurve = true;
                        MyInkManager.SetDefaultDrawingAttributes(MyDrawingAttributes);

                        PreviousContactPoint = e.GetCurrentPoint(canvas).Position;
                        //PointerDeviceType pointerDevType = e.Pointer.PointerDeviceType;  to identify the pointer device
                        if (e.GetCurrentPoint(canvas).Properties.IsLeftButtonPressed)
                        {
                            // Pass the pointer information to the InkManager.
                            MyInkManager.ProcessPointerDown(e.GetCurrentPoint(canvas));
                            PenID = e.GetCurrentPoint(canvas).PointerId;
                            e.Handled = true;
                        }
                    }
                    break;

                case "rect":
                    {
                        NewRectangle = new Rectangle();
                        X1 = e.GetCurrentPoint(canvas).Position.X;
                        Y1 = e.GetCurrentPoint(canvas).Position.Y;
                        X2 = X1;
                        Y2 = Y1;
                        NewRectangle.Width = Math.Abs(X2 - X1);
                        NewRectangle.Height = Math.Abs(Y2 - Y1);
                        NewRectangle.StrokeThickness = StrokeThickness;
                        NewRectangle.Stroke = new SolidColorBrush(BorderColor);
                        NewRectangle.Fill = new SolidColorBrush(FillColor);
                        canvas.Children.Add(NewRectangle);
                    }
                    break;

                case "ellipse":
                    {
                        NewEllipse = new Ellipse();
                        X1 = e.GetCurrentPoint(canvas).Position.X;
                        Y1 = e.GetCurrentPoint(canvas).Position.Y;
                        X2 = X1;
                        Y2 = Y1;
                        NewEllipse.Width = Math.Abs(X2 - X1);
                        NewEllipse.Height = Math.Abs(Y2 - Y1);
                        NewEllipse.StrokeThickness = StrokeThickness;
                        NewEllipse.Stroke = new SolidColorBrush(BorderColor);
                        NewEllipse.Fill = new SolidColorBrush(FillColor);
                        canvas.Children.Add(NewEllipse);
                    }
                    break;

                case "eraser":
                    {
                        Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.UniversalNo, 1);
                        StartPoint = e.GetCurrentPoint(canvas).Position;
                        Pencil = new Polyline();
                        Pencil.Stroke = new SolidColorBrush(Colors.White);
                        Pencil.StrokeThickness = 10;
                        canvas.Children.Add(Pencil);
                    }
                    break;

                default:
                    break;
            }
        }
        public PictureEditorWP()
        {
            this.InitializeComponent();
            prePositon.X = -1;
            prePositon.Y = -1;
            barList.Add(bar1);
            barList.Add(bar2);
            barList.Add(bar3);
            barList.Add(bar4);
            ListBoxItemMapping.Add(listBoxItemCrop, clippingBarGrid);
            ListBoxItemMapping.Add(listBoxItemRotate, rotateBarGrid);
            ListBoxItemMapping.Add(listBoxItemInk, inkGrid);
            ListBoxItemMapping.Add(listBoxItemText,textGrid);
            stageMapping.Add(listBoxItemCrop, GLOABOALSTAGE.EDITPAGE_CROP);
            stageMapping.Add(listBoxItemRotate, GLOABOALSTAGE.EDITPAGE_ROTATE);
            stageMapping.Add(listBoxItemText, GLOABOALSTAGE.EDITPAGE_TEXT);
            stageMapping.Add(listBoxItemInk, GLOABOALSTAGE.EDITPAGE_INK);
            menuList.SelectedIndex = 0;
            thisViewId = ApplicationView.GetForCurrentView().Id;

            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Color.FromArgb(255, 243, 156, 17);
            drawingAttributes.Size = new Size(2, 2);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            ink.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            ink.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            ink.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            ink.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            coreDispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
            listBoxItemCrop.Width = listBoxItemInk.Width = listBoxItemRotate.Width = listBoxItemText.Width = Window.Current.Bounds.Width / 4;
        }
Пример #27
0
        public TrailsTestTimeViz()
        {
            this.InitializeComponent();

            inkManager = new Windows.UI.Input.Inking.InkManager();

            // Create the trails test background. The test image is 117X917 px but to fit on a screen (surface) it is 686 X 939
            nodes = new List<TrailNode>();
            //populateNodes(testVersion, nodes);
            currentLine = new List<Line>();
            allLines = new Dictionary<InkStroke, List<Line>>();

            nextIndex = 0;
            currentIndex = 0;
            incorrectNodes = new Queue<int>();
            currentEdge = new List<Line>();


            screenHeight = Window.Current.Bounds.Height;
            screenWidth = Window.Current.Bounds.Width;

            //Set the ink to not use bezeir curves
            drawingAttributes = new Windows.UI.Input.Inking.InkDrawingAttributes();
            // True is the Default value for fitToCurve.
            drawingAttributes.FitToCurve = false;
            inkManager.SetDefaultDrawingAttributes(drawingAttributes);
        }
Пример #28
0
 private void blueButton_Click(object sender, RoutedEventArgs e)
 {
     InkDrawingAttributes inkDrawingAttributes = new InkDrawingAttributes();
     inkDrawingAttributes.Color = Windows.UI.Colors.Blue;
     inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(inkDrawingAttributes);
 }
Пример #29
0
        private void InitializeInker()
        {
            try
            {
                inker.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Pen;

                var drawingAttributes = new InkDrawingAttributes();

                drawingAttributes.DrawAsHighlighter = false;
                drawingAttributes.IgnorePressure = false;

                drawingAttributes.Color = PenColor;
                drawingAttributes.PenTip = PenTip;
                drawingAttributes.Size = PenSize;

                inker.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
                inker.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }

        }
Пример #30
0
        void OnPenTypeChanged(object sender, RoutedEventArgs e)
        {
            if (inkCanvas != null)
            {
                InkDrawingAttributes drawingAttributes = inkCanvas.InkPresenter.CopyDefaultDrawingAttributes();
                string value = ((ComboBoxItem)PenType.SelectedItem).Content.ToString();

                if (value == "Ballpoint")
                {
                    if (drawingAttributes.Kind != InkDrawingAttributesKind.Default) 
                    {
                        var newDrawingAttributes = new InkDrawingAttributes();
                        newDrawingAttributes.Color = drawingAttributes.Color;
                        drawingAttributes = newDrawingAttributes;
                    }
                    drawingAttributes.Size = new Size(penSize, penSize);
                    drawingAttributes.PenTip = PenTipShape.Circle;
                    drawingAttributes.DrawAsHighlighter = false;
                    drawingAttributes.PenTipTransform = System.Numerics.Matrix3x2.Identity;
                }
                else if (value == "Highlighter")
                {
                    if (drawingAttributes.Kind != InkDrawingAttributesKind.Default)
                    {
                        var newDrawingAttributes = new InkDrawingAttributes();
                        newDrawingAttributes.Color = drawingAttributes.Color;
                        drawingAttributes = newDrawingAttributes;
                    }
                    // Make the pen rectangular for highlighter
                    drawingAttributes.Size = new Size(penSize, penSize * 2);
                    drawingAttributes.PenTip = PenTipShape.Rectangle;
                    drawingAttributes.DrawAsHighlighter = true;
                    drawingAttributes.PenTipTransform = System.Numerics.Matrix3x2.Identity;
                }
                else if (value == "Calligraphy")
                {
                    if (drawingAttributes.Kind != InkDrawingAttributesKind.Default)
                    {
                        var newDrawingAttributes = new InkDrawingAttributes();
                        newDrawingAttributes.Color = drawingAttributes.Color;
                        drawingAttributes = newDrawingAttributes;
                    }
                    drawingAttributes.Size = new Size(penSize, penSize * 2);
                    drawingAttributes.PenTip = PenTipShape.Rectangle;
                    drawingAttributes.DrawAsHighlighter = false;

                    // Set a 45 degree rotation on the pen tip
                    double radians = 45.0 * Math.PI / 180;
                    drawingAttributes.PenTipTransform = System.Numerics.Matrix3x2.CreateRotation((float)radians);
                }
                else if (value == "Pencil")
                {
                    if (drawingAttributes.Kind != InkDrawingAttributesKind.Pencil)
                    {
                        var newDrawingAttributes = InkDrawingAttributes.CreateForPencil();
                        newDrawingAttributes.Color = drawingAttributes.Color;
                        newDrawingAttributes.Size = drawingAttributes.Size;
                        drawingAttributes = newDrawingAttributes;
                    }
                }
                inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            }
        }