コード例 #1
0
        public void StartTrackPoint(PointF rgPoint, Size uiFrame)
        {
            var clr = _displayedTransformation.GetPixelColor(rgPoint, Current, this);

            _trackPoint = new Tuple <Color, PointF, CPoint>(clr, rgPoint, CPoint.New(rgPoint, CProjection.C1C2));
            DrawTrackPointDynamics(0);
        }
コード例 #2
0
        public override Color GetPixelColor(PointF ptF, RGScene scene, RGProcessor processor)
        {
            var cpt = CPoint.New(ptF, CProjection.C1C2);

            if (!cpt.IsNormal)
            {
                return(RGScene.BackgroundColr);
            }

            var rg  = cpt.RG(CProjection.C1C2);
            var clr = GetC1C2Color(cpt, rg, scene, processor);

            return(clr);
        }
コード例 #3
0
        public void StartBoundaryAnalysis(RectangleF rgFrame, Size uiFrame)
        {
            var mid  = rgFrame.Y + rgFrame.Height / 2;
            var left = rgFrame.X;

            Tuple <Color, PointF, CPoint> pt1 = null;
            Tuple <Color, PointF, CPoint> pt2 = null;
            const float acc = 0.00001f;

            for (var x = left; x <= left + rgFrame.Width; x += acc)
            {
                var fpt1 = new PointF(x, mid);
                var clr1 = _displayedTransformation.GetPixelColor(fpt1, Current, this);
                var fpt2 = new PointF(x + acc, mid);
                var clr2 = _displayedTransformation.GetPixelColor(fpt2, Current, this);
                if (clr1 != clr2)
                {
                    pt1 = new Tuple <Color, PointF, CPoint>(clr1, fpt1, CPoint.New(fpt1, CProjection.C1C2));
                    pt2 = new Tuple <Color, PointF, CPoint>(clr2, fpt2, CPoint.New(fpt2, CProjection.C1C2));
                    break;
                }
            }

            if (pt1 != null && pt2 != null)
            {
                var curPt1  = pt1.Item2;
                var curClr1 = pt1.Item1;
                var curPt2  = pt2.Item2;
                var curClr2 = pt2.Item1;

                var acc1                       = 0.000001f;
                var accuracyChanged1           = false;
                var afterAccuracyChangedSteps1 = 0;
                while (true)
                {
                    var testPt  = new PointF(curPt1.X + acc1, curPt1.Y);
                    var testClr = _displayedTransformation.GetPixelColor(testPt, Current, this);
                    if (testClr != curClr1)
                    {
                        if (acc1 >= float.Epsilon * 2)
                        {
                            acc1                       = acc1 / 2;
                            accuracyChanged1           = true;
                            afterAccuracyChangedSteps1 = 0;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        curPt1 = testPt;
                        if (accuracyChanged1)
                        {
                            afterAccuracyChangedSteps1++;
                            if (afterAccuracyChangedSteps1 >= 4)
                            {
                                break;
                            }
                        }
                    }
                }
                _boundaryPointLeft = new Tuple <Color, PointF, CPoint>(pt1.Item1, curPt1, CPoint.New(curPt1, CProjection.C1C2));

                var acc2                       = 0.000001f;
                var accuracyChanged2           = false;
                var afterAccuracyChangedSteps2 = 0;
                while (true)
                {
                    var testPt  = new PointF(curPt2.X - acc2, curPt1.Y);
                    var testClr = _displayedTransformation.GetPixelColor(testPt, Current, this);
                    if (testClr != curClr2)
                    {
                        if (acc2 >= float.Epsilon * 2)
                        {
                            acc2                       = acc2 / 2;
                            accuracyChanged2           = true;
                            afterAccuracyChangedSteps2 = 0;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        curPt2 = testPt;
                        if (accuracyChanged2)
                        {
                            afterAccuracyChangedSteps2++;
                            if (afterAccuracyChangedSteps2 >= 4)
                            {
                                break;
                            }
                        }
                    }
                }

                _boundaryPointRight = new Tuple <Color, PointF, CPoint>(pt2.Item1, curPt2, CPoint.New(curPt2, CProjection.C1C2));
            }

            DrawBoundaryPointDynamics(0);
        }