コード例 #1
0
ファイル: Form1.cs プロジェクト: kschoos/simple_photo_app
        public void AddPixelToStroke()
        {
            var _x1           = Form1._previousContactPt.X;
            var _y1           = Form1._previousContactPt.Y;
            var _x2           = Form1._currentContactPt.X;
            var _y2           = Form1._currentContactPt.Y;
            var currentStroke = Form1.polylineList[Form1.polylineList.Count - 1];

            if (Distance(_x1, _y1, _x2, _y2) > 2.0)
            {
                PixelAdder.AddPixels(_x2, _y2, false, ref currentStroke);
                Form1._previousContactPt = Form1._currentContactPt;
            }
        }
コード例 #2
0
        private void StartAddingStroke(Point pt)
        {
            _previousContactPt = pt;

            _currentStroke.Points.Clear();
            var points = _currentStroke.Points;

            PixelAdder.AddPixels(pt.X, pt.Y, false, ref points);
            _currentStroke.Points = points;

            _currentStroke.StrokeThickness = 5;
            _currentStroke.Stroke          = new SolidColorBrush(Colors.Blue);
            _currentStroke.Opacity         = 1;
            InkCanvas.Children.Add(_currentStroke);
        }
コード例 #3
0
        private void AddPixelToStroke()
        {
            _x1 = _previousContactPt.X;
            _y1 = _previousContactPt.Y;
            _x2 = _currentContactPt.X;
            _y2 = _currentContactPt.Y;

            var color = Colors.Blue;
            var size  = 10;

            if (Distance(_x1, _y1, _x2, _y2) > 2.0)
            {
                if (_currentStroke.Points.Count == 0)
                {
                    _currentStroke.StrokeThickness = size;
                    _currentStroke.Stroke          = new SolidColorBrush(color);
                    try
                    {
                        InkCanvas.Children.Remove(_currentStroke);
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        InkCanvas.Children.Add(_currentStroke);
                    }
                    catch (Exception)
                    {
                    }
                }
                var points = _currentStroke.Points;
                PixelAdder.AddPixels(_x2, _y2, false, ref points);
                _currentStroke.Points = points;

                _previousContactPt = _currentContactPt;
            }
        }