コード例 #1
0
        private async void SetImage(byte[] ImageData)
        {
            MedicalCanvas.Children.Clear();
            if (ImageData == null)
            {
                MedcialInkManager = new InkManager();
                return;
            }
            InkManager inkMgr = MedcialInkManager;

            renderer = new XamlInkRenderer(MedicalCanvas);

            using (var stream = new InMemoryRandomAccessStream())
            {
                await stream.WriteAsync(ImageData.AsBuffer());

                await stream.FlushAsync();

                stream.Seek(0);

                await inkMgr.LoadAsync(stream);

                var iskList  = inkMgr.GetStrokes();
                int iskCount = iskList.Count;
                renderer.Clear();
                renderer.AddInk(iskList);
            }
        }
コード例 #2
0
        public InkPage()
        {
            InitializeComponent();

            thisView = ApplicationView.GetForCurrentView();
            if (thisView != null)
            {
                thisView.VisibleBoundsChanged += thisView_VisibleBoundsChanged;
            }

            navigationHelper = new NavigationHelper(this);

            drawingAttributes       = new InkDrawingAttributes();
            drawingAttributes.Color = coffeeColor;
            double penSize = 3.0;

            drawingAttributes.Size           = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = true;
            drawingAttributes.FitToCurve     = true;

            try
            {
                inkManager = new InkManager();
                inkManager.SetDefaultDrawingAttributes(drawingAttributes);
                renderer = new XamlInkRenderer(inkCanvas);
                renderer.Clear();
            }
            catch (Exception ex)
            {
                App.ShowMessage(ex.ToString(), true);
                if (Frame != null && Frame.CanGoBack)
                {
                    Frame.GoBack();
                }
            }

            inkCanvas.PointerPressed  += new PointerEventHandler(InkCanvas_PointerPressed);
            inkCanvas.PointerMoved    += new PointerEventHandler(InkCanvas_PointerMoved);
            inkCanvas.PointerReleased += new PointerEventHandler(InkCanvas_PointerReleased);
            inkCanvas.PointerExited   += new PointerEventHandler(InkCanvas_PointerReleased);
        }