Mohit
Mohit

Reputation: 516

Draw on touch with Highlighter in Windows phone 8

How to draw a in windows phone 8 with highlighter that's why background context is visible.I am creating a drawing app But I stuck in this point if any one have idea about this please give me some hint Thanks in advance.

Upvotes: 0

Views: 484

Answers (2)

JustinAngel
JustinAngel

Reputation: 16102

For on-screen drawing you should consider using InkPresenter as it's suited to handle those usecases @ http://www.nickharris.net/2010/03/silverlight-for-mobile-on-windows-phone-7-inkpresenter-fun/

Upvotes: 1

Mohit
Mohit

Reputation: 516

void Touch_FrameReported(object sender, TouchFrameEventArgs e) { try { int pointsNumber = e.GetTouchPoints(drawCanvas).Count; TouchPointCollection pointCollection = e.GetTouchPoints(drawCanvas);

            for (int i = 0; i < pointsNumber; i++)
            {
                if (pointCollection[i].Action == TouchAction.Down)
                {
                    preXArray[i] = pointCollection[i].Position.X;
                    preYArray[i] = pointCollection[i].Position.Y;
                }
                if (pointCollection[i].Action == TouchAction.Move)
                {
                    line = new Line();

                    line.X1 = preXArray[i];
                    line.Y1 = preYArray[i];
                    line.X2 = pointCollection[i].Position.X;
                    line.Y2 = pointCollection[i].Position.Y;

                    line.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromArgb(50,84,255,159));

                   // line.Stroke = new SolidColorBrush(Colors.Red);
                   // line.StrokeThickness = 100.0;
                    line.StrokeThickness = 20;


                  //  line.Height = 10;

                    SolidColorBrush scb = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 29, 177, 0));
                    //postconstruction technique



                    line.Fill = new SolidColorBrush(Colors.Red);


                    drawCanvas.Children.Add(line);

                    preXArray[i] = pointCollection[i].Position.X;
                    preYArray[i] = pointCollection[i].Position.Y;

                    lastObject = i;
                    // drawCanvas.Children.RemoveAt(1);

                }
            }
        }

        catch (Exception er)
        {
            MessageBox.Show(er.Message);
        }
    }

Upvotes: 1

Related Questions