Пример #1
0
        public List <Color> getPathLine()
        {
            DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
            Point        sp, cp;
            List <Color> cl = new List <Color>();

            if (p == null)
            {
                return(null);
            }
            PathGeometry pg = p.Data as PathGeometry;

            if (pg == null)
            {
                return(null);
            }
            foreach (PathFigure pf in pg.Figures)
            {
                sp = DrawGraphic.getImagePosition(pf.StartPoint, TargetImage);

                foreach (LineSegment ls in pf.Segments)
                {
                    cp = DrawGraphic.getImagePosition(ls.Point, TargetImage);
                    List <Color> scl = pt.getLine(TargetImage.Source as WriteableBitmap, sp, cp);
                    foreach (Color cc in scl)
                    {
                        cl.Add(cc);
                    }
                    sp = new Point(cp.X, cp.Y);
                }
            }
            return(cl);
        }
Пример #2
0
        public List <Color> getPathColor(List <Point> ipl)
        {
            if (ipl.Count == 0)
            {
                return(null);
            }
            List <Color> cl = new List <Color>();
            Point        sp = ipl[0];

            for (int i = 1; i < ipl.Count; i++)
            {
                List <Color> tcl = pt.getLine((WriteableBitmap)TargetImage.Source, sp, ipl[i]);
                foreach (Color c in tcl)
                {
                    cl.Add(c);
                }
                sp = ipl[i];
            }
            return(cl);
        }
Пример #3
0
        //public void DeActiveDrawPath()
        //{
        //    if (Target == null) { return; }

        //    if (selectPath == null) { return; }

        //    Canvas drawCanvas = Target.getCanvas();
        //    if (drawCanvas.Children.Contains(selectPath)) { drawCanvas.Children.Remove(selectPath); }
        //    selectPath = null;
        //}

        //public void DeActiveDrawLine()
        //{
        //    if (Target == null) { return; }

        //    if (selectPath == null) { return; }

        //    Canvas drawCanvas = Target.getCanvas();
        //    if (drawCanvas.Children.Contains(selectLine)) { drawCanvas.Children.Remove(selectLine); }
        //    selectLine = null;
        //}

        //public void DeActiveDrawArea()
        //{
        //    if (Target == null) { return; }

        //    if (selectPath == null) { return; }

        //    Canvas drawCanvas = Target.getCanvas();
        //    if (drawCanvas.Children.Contains(selectRec)) { drawCanvas.Children.Remove(selectRec); }
        //    selectRec = null;
        //}


        public List <Color> getPathLine()
        {
            DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
            Point        sp, cp;
            List <Color> cl = new List <Color>();

            if (selectPath == null)
            {
                return(null);
            }
            if (selectPath.Points.Count == 0)
            {
                return(null);
            }
            sp = DrawGraphic.getImagePosition(selectPath.Points[0], TargetImage);
            for (int i = 1; i < selectPath.Points.Count; i++)
            {
                cp = DrawGraphic.getImagePosition(selectPath.Points[i], TargetImage);
                List <Color> scl = pt.getLine(TargetImage.Source as WriteableBitmap, sp, cp);
                foreach (Color cc in scl)
                {
                    cl.Add(cc);
                }
                sp = cp;
            }
            //PathGeometry pg = selectPath.Data as PathGeometry;
            //if (pg == null) { return null; }
            //foreach (PathFigure pf in pg.Figures)
            //{
            //    sp = DrawGraphic.getImagePosition(pf.StartPoint, TargetImage);

            //    foreach (LineSegment ls in pf.Segments)
            //    {
            //        cp = DrawGraphic.getImagePosition(ls.Point, TargetImage);

            //        sp = new Point(cp.X, cp.Y);
            //    }
            //}
            return(cl);
        }