private void OnLoaded(object sender, RoutedEventArgs e)
        {
            ApplicationView.GetForCurrentView().TryResizeView(new Size(500, 355)); // for larger view size image recognition accuracy may drop

            imageProcessor = new ImageProcessor();
            perceptron     = new Perceptron();

            inkPresenter = inkCanvas.InkPresenter;

            inkSynchronizer = inkPresenter.ActivateCustomDrying();
            inkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            inkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
        }
示例#2
0
        public FunctionGraph()
        {
            InitializeComponent();
            _backgroundColor  = Background.SolidColor();
            _foregroundColor  = Foreground.SolidColor();
            Canvas.ClearColor = _backgroundColor;

            ManipulationMode =
                ManipulationModes.Scale
                | ManipulationModes.TranslateX
                | ManipulationModes.TranslateY
                | ManipulationModes.TranslateInertia
                | ManipulationModes.ScaleInertia;

            _dispatcher     = Window.Current.Dispatcher;
            _currentStrokes = _rootStrokes;

            InkPresenter inkPresenter = InkInput.InkPresenter;

            inkPresenter.UpdateDefaultDrawingAttributes(new InkDrawingAttributes()
            {
                Size  = new Size(4, 4),
                Color = _foregroundColor
            });

            CoreInkIndependentInputSource coreInputSource = CoreInkIndependentInputSource.Create(inkPresenter);

            coreInputSource.PointerMoving   += CoreInputSource_PointerMoving;
            coreInputSource.PointerPressing += CoreInputSource_PointerPressing;

            _inkInputProcessing            = inkPresenter.InputProcessingConfiguration;
            inkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            _inkSynchronizer = inkPresenter.ActivateCustomDrying();

            SizeChanged += (s, e) => ReduceFunctionDetail();
            RegisterPropertyChangedCallback(BackgroundProperty, OnBackgroundChanged);
            RegisterPropertyChangedCallback(ForegroundProperty, OnForegroundChanged);
        }