예제 #1
0
        Pixel DoRenderPlanet(IntCoordinate c, int width, int height, RenderInfo info,
                             Vector3 sunvec)
        {
            const double starClose = 2;

            info.InitializeRow(c.Y);

            var sv = new Vector3(sunvec.X, sunvec.Y * info.dy, sunvec.Z * info.sqomdysq);

            double azimuth = Math.Asin(((double)c.Y / (height - 1)) * 2 - 1);
            int    lcos    = (int)((height / 2) * Math.Abs(Math.Cos(azimuth)));

            if (c.X >= width / 2 - lcos && c.X <= width / 2 + lcos)
            {
                double r = info.CalculateR(c.X);

                var rgb = (r >= 128) ? RenderLand(r) : RenderWater(r);

                double icet = Math.Pow(Math.Abs(Math.Sin(azimuth)), 1.0 / _icelevel)
                              - 0.5;
                RenderPolarIceCaps(r, icet, rgb);

                return(ApplyDarkening(width, height, c.X, sv, info.dysq, rgb));
            }
            else if (c.X < width / 2 - (lcos + starClose) ||
                     c.X > width / 2 + (lcos + starClose))
            {
                return(_starFactory.Generate());
            }
            else
            {
                return(new Pixel(3));
            }
        }
예제 #2
0
        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

              ExposeEvent += delegate {sliceData.Draw(Renderer);};
              Realized += delegate
            {
              var gc = new Gdk.GC(GdkWindow);
              Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
              Draw(drawable);
            };
              SizeAllocated += delegate {Draw(drawable);};

              Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
            EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
            EventMask.LeaveNotifyMask;

              ButtonPressEvent += (o, args) =>
            {
              var c = new IntCoordinate((int) args.Event.X, (int) args.Event.Y);
              Func.GetActualFunc(c).OnButtonPress(o, args);
            };

              MotionNotifyEvent += (o, args) =>
            {
              GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

              Func = new SelectFunc(sliceData, this);
        }
예제 #3
0
        public static MouseFunc GetActualFunc(IntCoordinate c, MouseFunc func)
        {
            var slice = func.SliceData.FindSlice(c);

            return(func.SliceIsSelectable(slice)
        ? new MoveSliceFunc(func.SliceData, func.Preview, slice) : func);
        }
예제 #4
0
        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

            ExposeEvent += delegate { sliceData.Draw(Renderer); };
            Realized    += delegate
            {
                var gc = new Gdk.GC(GdkWindow);
                Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
                Draw(drawable);
            };
            SizeAllocated += delegate { Draw(drawable); };

            Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
                     EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
                     EventMask.LeaveNotifyMask;

            ButtonPressEvent += (o, args) =>
            {
                var c = new IntCoordinate((int)args.Event.X, (int)args.Event.Y);
                Func.GetActualFunc(c).OnButtonPress(o, args);
            };

            MotionNotifyEvent += (o, args) =>
            {
                GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

            Func = new SelectFunc(sliceData, this);
        }
예제 #5
0
 protected override void OnPress(IntCoordinate c)
 {
     var slice = SliceData.MayRemove(c);
       if (slice != null)
     {
       SliceData.Remove(slice);
       Redraw();
     }
 }
예제 #6
0
        public Pixel GetColor(IntCoordinate c)
        {
            int row = c.Y * _matrixRows / _height;
            int col = c.X * _matrixColumns / _width;

            var list = _matrix[row, col];

            return((list == null) ? _backgroundColor : GetNearestColor(list, c));
        }
예제 #7
0
        /// <summary>
        ///     Left hand normal
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <returns></returns>
        public static Coordinate<double> Normal(IntCoordinate c1, IntCoordinate c2)
        {
            var normal = new Coordinate<double>(c1.Y - c2.Y, -(c1.X - c2.X));
            var mag = Math.Sqrt(normal.X*normal.X + normal.Y*normal.Y);
            normal.X = normal.X/mag;
            normal.Y = normal.Y/mag;

            return normal;
        }
예제 #8
0
 public Raindrop(IntCoordinate coordinate, int newSize, double newCoeff)
 {
     _newSize  = newSize;
     _radius   = newSize / 2;    // Half of current raindrop
     _newCoeff = newCoeff;
     _s        = _radius / Math.Log(newCoeff * _radius + 1);
     X         = coordinate.X;
     Y         = coordinate.Y;
 }
예제 #9
0
 public Raindrop(IntCoordinate coordinate, int newSize, double newCoeff)
 {
     _newSize = newSize;
       _radius = newSize / 2;		// Half of current raindrop
       _newCoeff = newCoeff;
       _s = _radius / Math.Log(newCoeff * _radius + 1);
       X = coordinate.X;
       Y = coordinate.Y;
 }
예제 #10
0
 override protected void OnPress(IntCoordinate c)
 {
     _x          = c.X;
     _y          = c.Y;
     _rectangle  = SliceData.FindRectangle(c);
     _slice      = _rectangle.CreateHorizontalSlice(_y);
     _horizontal = true;
     Preview.Renderer.Function = Gdk.Function.Equiv;
     _slice.Draw(Preview.Renderer);
 }
예제 #11
0
        public bool Fits(Painter painter, BoolMatrix A, IntCoordinate p)
        {
            var color = painter.GetPixel(p);

            return(TrueForAll(offset =>
            {
                var c = new IntCoordinate(p.X + offset.X, p.Y + offset.Y);
                return A.IsInside(c) && !A.Get(c) && painter.IsSameColor(c, color);
            }));
        }
예제 #12
0
 public void Fits(BoolMatrix A, IntCoordinate c)
 {
     foreach (var shape in this)
     {
         if (shape.Fits(A, c))
         {
             break;
         }
     }
 }
예제 #13
0
        override protected void OnPress(IntCoordinate c)
        {
            var slice = SliceData.MayRemove(c);

            if (slice != null)
            {
                SliceData.Remove(slice);
                Redraw();
            }
        }
예제 #14
0
 public void Fits(BoolMatrix A, IntCoordinate c)
 {
     foreach (var shape in this)
     {
       if (shape.Fits(A, c))
     {
       break;
     }
     }
 }
예제 #15
0
        public int Calc(int b, IntCoordinate c)
        {
            for (int k = 0; k < _points * 4; k++)
            {
                _distances[k] = c.Distance(_vp[b, k]);
            }

            int val = (int)(255.0 * Math.Sqrt((double)Select(_closest) / _area));

            return(255 - val); // invert
        }
예제 #16
0
        Pixel DoRenderClouds(IntCoordinate c, RenderInfo info)
        {
            const double rgbQuant = 255;

            info.InitializeRow(c.Y);
            double r = info.CalculateR(c.X);

            byte w = (byte)((r > 127.0) ? (rgbQuant * ((r - 127.0) / 128.0)) : 0);

            return(new Pixel(w, w, (byte)rgbQuant));
        }
예제 #17
0
        public void Rectangle(IntCoordinate c, int w, int h)
        {
            w *= Size;
            h *= Size;

            LineStart(c);
            HLine(w);
            VLine(h);
            HLine(-w);
            VLine(-h);
        }
예제 #18
0
 void Draw(IntCoordinate c, int hline1, int vline1, int hline2, int vline2, 
     int hline3, int vline3)
 {
     LineStart(c);
       HLine(hline1);
       VLine(vline1);
       HLine(hline2);
       VLine(vline2);
       HLine(hline3);
       VLine(vline3);
 }
예제 #19
0
 void Draw(IntCoordinate c, int hline1, int vline1, int hline2, int vline2,
           int hline3, int vline3)
 {
     LineStart(c);
     HLine(hline1);
     VLine(vline1);
     HLine(hline2);
     VLine(vline2);
     HLine(hline3);
     VLine(vline3);
 }
예제 #20
0
 public bool Fits(BoolMatrix A, IntCoordinate c)
 {
     foreach (var shape in _set[_random.Next(0, _set.Count)])
     {
       if (shape.Fits(Painter, A, c))
     {
       shape.Fill(A, c);
       return true;
     }
     }
       return false;
 }
예제 #21
0
 public bool Fits(BoolMatrix A, IntCoordinate c)
 {
     foreach (var shape in _set[_random.Next(0, _set.Count)])
     {
         if (shape.Fits(Painter, A, c))
         {
             shape.Fill(A, c);
             return(true);
         }
     }
     return(false);
 }
예제 #22
0
 protected override void OnPress(IntCoordinate c)
 {
     var rows = new Variable<int>(3);
       var columns = new Variable<int>(3);
       var dialog = new TableDialog(rows, columns);
       dialog.ShowAll();
       if (dialog.Run() == ResponseType.Ok)
     {
       SliceData.CreateTable(c, rows.Value, columns.Value);
       Redraw();
     }
       dialog.Destroy();
 }
예제 #23
0
        override protected void OnPress(IntCoordinate c)
        {
            var rows    = new Variable <int>(3);
            var columns = new Variable <int>(3);
            var dialog  = new TableDialog(rows, columns);

            dialog.ShowAll();
            if (dialog.Run() == ResponseType.Ok)
            {
                SliceData.CreateTable(c, rows.Value, columns.Value);
                Redraw();
            }
            dialog.Destroy();
        }
예제 #24
0
        Pixel DoNCP(IntCoordinate c)
        {
            int b = 0;
              Func<int> func = () => _calculator.Calc(b++, c);

              if (_color)
            {
              _pixel.Fill(func);
            }
              else
            {
              _pixel.FillSame(func);
            }
              return _pixel;
        }
예제 #25
0
        Pixel DoNCP(IntCoordinate c)
        {
            int        b    = 0;
            Func <int> func = () => _calculator.Calc(b++, c);

            if (_color)
            {
                _pixel.Fill(func);
            }
            else
            {
                _pixel.FillSame(func);
            }
            return(_pixel);
        }
예제 #26
0
        override protected void OnMove(IntCoordinate c)
        {
            var coordinate = (_horizontal) ? new IntCoordinate(c.X, _y)
        : new IntCoordinate(_x, c.Y);
            var rectangle = SliceData.FindRectangle(coordinate);

            bool rectangleChanged = rectangle != _endRectangle;

            _endRectangle = rectangle;

            bool horizontal         = Math.Abs(c.X - _x) > Math.Abs(c.Y - _y);
            bool orientationChanged = horizontal != _horizontal;

            _horizontal = horizontal;

            if (orientationChanged || rectangleChanged)
            {
                _slice.Draw(Preview.Renderer);
                if (_horizontal)
                {
                    if (rectangle.X1 <= _rectangle.X1)
                    {
                        _slice = new HorizontalSlice(rectangle.Left,
                                                     _rectangle.Right, _y);
                    }
                    else
                    {
                        _slice = new HorizontalSlice(_rectangle.Left,
                                                     rectangle.Right, _y);
                    }
                }
                else
                {
                    if (rectangle.Y1 <= _rectangle.Y1)
                    {
                        _slice = new VerticalSlice(rectangle.Top,
                                                   _rectangle.Bottom, _x);
                    }
                    else
                    {
                        _slice = new VerticalSlice(_rectangle.Top,
                                                   rectangle.Bottom, _x);
                    }
                }
                _slice.Draw(Preview.Renderer);
            }
        }
예제 #27
0
        Pixel GetNearestColor(List <ColorCoordinate> list, IntCoordinate c)
        {
            int             distance = int.MaxValue;
            ColorCoordinate closest  = null;

            list.ForEach(coordinate =>
            {
                int d = coordinate.Distance(c);
                if (d < distance)
                {
                    distance = d;
                    closest  = coordinate;
                }
            });

            return(distance < _cellSize2 / 4 ? closest.Color : _backgroundColor);
        }
예제 #28
0
        protected override void OnMove(IntCoordinate c)
        {
            var coordinate = (_horizontal) ? new IntCoordinate(c.X, _y)
            : new IntCoordinate(_x, c.Y);
              var rectangle = SliceData.FindRectangle(coordinate);

              bool rectangleChanged = rectangle != _endRectangle;
              _endRectangle = rectangle;

              bool horizontal = Math.Abs(c.X - _x) > Math.Abs(c.Y - _y);
              bool orientationChanged = horizontal != _horizontal;
              _horizontal = horizontal;

              if (orientationChanged || rectangleChanged)
            {
              _slice.Draw(Preview.Renderer);
              if (_horizontal)
            {
              if (rectangle.X1 <= _rectangle.X1)
            {
              _slice = new HorizontalSlice(rectangle.Left,
                           _rectangle.Right, _y);
            }
              else
            {
              _slice = new HorizontalSlice(_rectangle.Left,
                           rectangle.Right, _y);
            }
            }
              else
            {
              if (rectangle.Y1 <= _rectangle.Y1)
            {
              _slice = new VerticalSlice(rectangle.Top,
                         _rectangle.Bottom, _x);
            }
              else
            {
              _slice = new VerticalSlice(_rectangle.Top,
                         rectangle.Bottom, _x);
            }
            }
              _slice.Draw(Preview.Renderer);
            }
        }
        public Rectangle MinDistanceRegion(Rectangle sourceRect, Drawable drawable, SelectionMask selectionMask)
        {
            Debug.Assert(sourceRect.Width == sourceRect.Height);

            var windowSize = sourceRect.Width;
            var windowDelta = windowSize/2;
            Rectangle minRegionRect = null;

            var minDistance = 0.0;

            var sourceRgn = new PixelRgn(drawable, sourceRect.AdjustedToImageEdges(drawable.Bounds), false, false);
            var sourceArray = sourceRgn.ToArrayWithoutSelection(selectionMask);

            var currentCoordinate = new IntCoordinate(0, 0);
            for (int i = windowDelta; i < drawable.Width - windowDelta; i++)
            {
                for (int j = windowDelta; j < drawable.Height - windowDelta; j++)
                {
                    if (j == sourceRect.Y1 + windowDelta && i == sourceRect.X1 + windowDelta)
                    {
                        continue;
                    }
                    currentCoordinate.X = i;
                    currentCoordinate.Y = j;
                    var currentRgnRect = currentCoordinate.PointCenteredRectangle(windowSize);
                    var dist = RegionDistance(sourceArray, currentRgnRect, drawable, selectionMask);
                    if (dist == null)
                    {
                        continue;
                    }
                    if (dist == 0)
                    {
                        return currentRgnRect;
                    }
                    if ((minDistance > dist || minRegionRect == null))
                    {
                        minDistance = (double) dist;
                        minRegionRect = currentRgnRect;
                    }
                }
            }

            return minRegionRect;
        }
예제 #30
0
        public Calculator(int points, int closest, int bpp, Rectangle rectangle,
                          int seed)
        {
            _points  = points;
            _closest = closest;

            int width  = rectangle.Width;
            int height = rectangle.Height;

            _area = rectangle.Area;

            int xmid = width / 2;
            int ymid = height / 2;

            _distances = new int[4 * _points];
            _data      = new int[4 * _points];
            _under     = new int[4 * _points];
            _over      = new int[4 * _points];

            _vp = new IntCoordinate[bpp, 4 * _points];

            var generator = new RandomCoordinateGenerator(seed, width - 1,
                                                          height - 1, _points);

            for (int b = 0; b < bpp; b++)
            {
                int i = 0;
                foreach (var c in generator)
                {
                    int px = c.X;
                    int py = c.Y;

                    int offx = (px < xmid) ? width : -width;
                    int offy = (py < ymid) ? height : -height;

                    _vp[b, i]               = new IntCoordinate(px, py);
                    _vp[b, i + _points]     = new IntCoordinate(px + offx, py);
                    _vp[b, i + 2 * _points] = new IntCoordinate(px, py + offy);
                    _vp[b, i + 3 * _points] = new IntCoordinate(px + offx,
                                                                py + offy);
                    i++;
                }
            }
        }
예제 #31
0
        public Calculator(int points, int closest, int bpp, Rectangle rectangle, 
		      int seed)
        {
            _points = points;
              _closest = closest;

              int width = rectangle.Width;
              int height = rectangle.Height;
              _area = rectangle.Area;

              int xmid = width / 2;
              int ymid = height / 2;

              _distances = new int[4 * _points];
              _data = new int[4 * _points];
              _under = new int[4 * _points];
              _over = new int[4 * _points];

              _vp = new IntCoordinate[bpp, 4 * _points];

              var generator = new RandomCoordinateGenerator(seed, width - 1,
                            height - 1, _points);

              for (int b = 0; b < bpp; b++)
            {
              int i = 0;
              foreach (var c in generator)
            {
              int px = c.X;
              int py = c.Y;

              int offx = (px < xmid) ? width : -width;
              int offy = (py < ymid) ? height : -height;

              _vp[b, i] = new IntCoordinate(px, py);
              _vp[b, i + _points] = new IntCoordinate(px + offx, py);
              _vp[b, i + 2 * _points] = new IntCoordinate(px, py + offy);
              _vp[b, i + 3 * _points] = new IntCoordinate(px + offx,
                              py + offy);
              i++;
            }
            }
        }
예제 #32
0
        public void CreateTable(IntCoordinate c, int rows, int columns)
        {
            var rectangle = new Rectangle(_rectangles.Find(c));
            int width     = rectangle.Width;
            int height    = rectangle.Height;
            int x1        = rectangle.X1;
            int y1        = rectangle.Y1;

            for (int row = 1; row < rows; row++)
            {
                int ypos = y1 + row * height / rows;
                AddSlice(rectangle.CreateHorizontalSlice(ypos));
            }

            for (int col = 1; col < columns; col++)
            {
                int xpos = x1 + col * width / columns;
                AddSlice(rectangle.CreateVerticalSlice(xpos));
            }
        }
예제 #33
0
 public Slice Find(IntCoordinate c)
 {
     return _set.Find(slice => slice.PointOn(c));
 }
예제 #34
0
 override protected void OnMove(IntCoordinate c)
 {
     _slice.Draw(Preview.Renderer);
     _slice.SetPosition(c);
     _slice.Draw(Preview.Renderer);
 }
예제 #35
0
 override public bool PointOn(IntCoordinate c) =>
 c.X >= X1 && c.X <= X2 && Math.Abs(c.Y - Y) < 5;
예제 #36
0
 public abstract bool PointOn(IntCoordinate c);
예제 #37
0
 public abstract void SetPosition(IntCoordinate c);
예제 #38
0
 public virtual Cursor GetCursor(IntCoordinate c)
 {
     return _defaultCursor;
 }
예제 #39
0
 override public MouseFunc GetActualFunc(IntCoordinate c) =>
 MoveSliceFunc.GetActualFunc(c, this);
예제 #40
0
        Pixel DoRenderPlanet(IntCoordinate c, int width, int height, RenderInfo info, 
			 Vector3 sunvec)
        {
            const double starClose = 2;

              info.InitializeRow(c.Y);

              var sv = new Vector3(sunvec.X, sunvec.Y * info.dy, sunvec.Z * info.sqomdysq);

              double azimuth = Math.Asin(((double) c.Y / (height - 1)) * 2 - 1);
              int lcos = (int) ((height / 2) * Math.Abs(Math.Cos(azimuth)));

              if (c.X >= width / 2 - lcos && c.X <= width / 2 + lcos)
            {
              double r = info.CalculateR(c.X);

              var rgb = (r >= 128) ? RenderLand(r) : RenderWater(r);

              double icet = Math.Pow(Math.Abs(Math.Sin(azimuth)), 1.0 / _icelevel)
            - 0.5;
              RenderPolarIceCaps(r, icet, rgb);

              return ApplyDarkening(width, height, c.X, sv, info.dysq, rgb);
            }
              else if (c.X < width / 2 - (lcos + starClose) ||
               c.X > width / 2 + (lcos + starClose))
            {
              return _starFactory.Generate();
            }
              else
            {
              return new Pixel(3);
            }
        }
예제 #41
0
 override protected void OnPress(IntCoordinate c)
 {
     SliceData.SelectRectangle(c);
 }
예제 #42
0
 public Slice MayRemove(SliceSet orthogonal, IntCoordinate c)
 {
     var slice = Find(c);
       return (slice == null || orthogonal.IsEndPoint(slice)) ? null : slice;
 }
예제 #43
0
 public static bool IsInside(this Rectangle rect, IntCoordinate coordinate)
 {
     return rect.IsInside(coordinate.X, coordinate.Y);
 }
예제 #44
0
 void ShapeFor(IntCoordinate c)
 {
     Draw(c, Size, 2 * Size, -2 * Size, -Size, Size + 1, -Size - 1);
 }
예제 #45
0
        public void Set()
        {
            const int width = 43;
              const int height = 29;

              var b = new BoolMatrix(width, height);
              var c = new IntCoordinate(11, 13);
              b.Set(c, true);
              Assert.IsTrue(b.Get(c));
        }
예제 #46
0
 virtual public MouseFunc GetActualFunc(IntCoordinate c) => this;
예제 #47
0
 override public Cursor GetCursor(IntCoordinate c) =>
 (SliceData.MayRemove(c) == null) ? base.GetCursor(c) : _cursor;
예제 #48
0
        override public Cursor GetCursor(IntCoordinate c)
        {
            var slice = SliceData.FindSlice(c);

            return((SliceIsSelectable(slice)) ? slice.Cursor : base.GetCursor(c));
        }
예제 #49
0
 void ShapeThree(IntCoordinate c)
 {
     Draw(c, Size, Size + 1, Size + 1, Size, -2 * Size, -2 * Size);
 }
예제 #50
0
 public virtual MouseFunc GetActualFunc(IntCoordinate c)
 {
     return this;
 }
예제 #51
0
 void ShapeOne(IntCoordinate c)
 {
     Draw(c, 2 * Size, Size, -Size - 1, Size + 1, -Size, -2 * Size);
 }
예제 #52
0
 public Rectangle Find(IntCoordinate c)
 {
     return(_set.Find(rectangle => rectangle.IsInside(c)));
 }
예제 #53
0
 void ShapeTwo(IntCoordinate c)
 {
     Draw(c, 2 * Size, 2 * Size, -Size, -Size - 1, -Size - 1, -Size);
 }
예제 #54
0
 public void Select(IntCoordinate c)
 {
     Selected = Find(c);
 }
예제 #55
0
 override public void SetPosition(IntCoordinate c)
 {
     Y = c.Y;
 }
예제 #56
0
        Pixel DoRenderClouds(IntCoordinate c, RenderInfo info)
        {
            const double rgbQuant = 255;

              info.InitializeRow(c.Y);
              double r = info.CalculateR(c.X);

              byte w = (byte)((r > 127.0) ? (rgbQuant * ((r - 127.0) / 128.0)) : 0);

              return new Pixel(w, w, (byte) rgbQuant);
        }
예제 #57
0
 public ColorCoordinate(IntCoordinate c, Pixel color)
     : base(c)
 {
     Color = color;
 }
예제 #58
0
 protected virtual void OnPress(IntCoordinate c)
 {
 }
        public Rectangle MinDistanceRegion(Rectangle sourceRect, ImgGradient gradient, Pixel[,] layerPixels, SelectionMask selectionMask)
        {
            Debug.Assert(sourceRect.Width == sourceRect.Height);

            var windowSize = sourceRect.Width;
            var windowDelta = windowSize/2;
            var layerWidth = layerPixels.GetLength(0);
            var layerHeight = layerPixels.GetLength(1);

            Rectangle minRegionRect = null;
            var minDistance = 0.0;
            var adjustedSourceRect = sourceRect.AdjustedToImageEdges(new Rectangle(new IntCoordinate(0, 0),
                                                                                   layerWidth, layerHeight));
            var currentCoordinate = new IntCoordinate(0, 0);
            var orthoGradient = new Coordinate<double>(-gradient.YMagnitude*windowDelta,
                                                       gradient.XMagnitude*windowDelta);
            for (int i = windowDelta; i < layerWidth - windowDelta; i++)
            {
                for (int j = windowDelta; j < layerHeight - windowDelta; j++)
                {
                    if (j == sourceRect.Y1 + windowDelta && i == sourceRect.X1 + windowDelta)
                    {
                        continue;
                    }
                    currentCoordinate.X = i;
                    currentCoordinate.Y = j;
                    var currentRgnRect = currentCoordinate.PointCenteredRectangle(windowSize);
                    var dist = RegionDistance(adjustedSourceRect, currentRgnRect, layerPixels, selectionMask);
                    if (dist == null)
                    {
                        continue;
                    }
                    if (dist == 0)
                    {
                        return currentRgnRect;
                    }
                    if ((minDistance > dist || minRegionRect == null))
                    {
                        minDistance = (double) dist;
                        minRegionRect = currentRgnRect;
                    }
                }
            }

            return minRegionRect;
        }
예제 #60
0
 protected virtual void OnMove(IntCoordinate c)
 {
 }