Пример #1
0
 public float[,] Smooth(float[,] input, byte[,] orientation, BinaryMap mask, BlockMap blocks)
 {
     Point[][] lines = Lines.Construct();
     float[,] output = new float[input.GetLength(0), input.GetLength(1)];
     Parallel.ForEach(blocks.AllBlocks, delegate(Point block)
     {
         if (mask.GetBit(block))
         {
             Point[] line = lines[Angle.Quantize(Angle.Add(orientation[block.Y, block.X], AngleOffset), lines.Length)];
             foreach (Point linePoint in line)
             {
                 RectangleC target = blocks.BlockAreas[block];
                 RectangleC source = target.GetShifted(linePoint);
                 source.Clip(new RectangleC(blocks.PixelCount));
                 target = source.GetShifted(Calc.Negate(linePoint));
                 for (int y = target.Bottom; y < target.Top; ++y)
                     for (int x = target.Left; x < target.Right; ++x)
                         output[y, x] += input[y + linePoint.Y, x + linePoint.X];
             }
             RectangleC blockArea = blocks.BlockAreas[block];
             for (int y = blockArea.Bottom; y < blockArea.Top; ++y)
                 for (int x = blockArea.Left; x < blockArea.Right; ++x)
                     output[y, x] *= 1f / line.Length;
         }
     });
     Logger.Log(output);
     return output;
 }
Пример #2
0
 PointF[,] Smooth(PointF[,] orientation, BinaryMap mask)
 {
     PointF[,] smoothed = new PointF[mask.Height, mask.Width];
     Parallel.For(0, mask.Height, delegate(int y)
     {
         for (int x = 0; x < mask.Width; ++x)
         {
             if (mask.GetBit(x, y))
             {
                 RectangleC neighbors = new RectangleC(
                     new Point(Math.Max(0, x - SmoothingRadius), Math.Max(0, y - SmoothingRadius)),
                     new Point(Math.Min(mask.Width, x + SmoothingRadius + 1), Math.Min(mask.Height, y + SmoothingRadius + 1)));
                 PointF sum = new PointF();
                 for (int ny = neighbors.Bottom; ny < neighbors.Top; ++ny)
                 {
                     for (int nx = neighbors.Left; nx < neighbors.Right; ++nx)
                     {
                         if (mask.GetBit(nx, ny))
                         {
                             sum = Calc.Add(sum, orientation[ny, nx]);
                         }
                     }
                 }
                 smoothed[y, x] = sum;
             }
         }
     });
     return(smoothed);
 }
Пример #3
0
        public BinaryMap Binarize(float[,] input, float[,] baseline, BinaryMap mask, BlockMap blocks)
        {
            BinaryMap binarized = new BinaryMap(input.GetLength(1), input.GetLength(0));

            Parallel.For(0, blocks.AllBlocks.Height, delegate(int blockY)
            {
                for (int blockX = 0; blockX < blocks.AllBlocks.Width; ++blockX)
                {
                    if (mask.GetBit(blockX, blockY))
                    {
                        RectangleC rect = blocks.BlockAreas[blockY, blockX];
                        for (int y = rect.Bottom; y < rect.Top; ++y)
                        {
                            for (int x = rect.Left; x < rect.Right; ++x)
                            {
                                if (input[y, x] - baseline[y, x] > 0)
                                {
                                    binarized.SetBitOne(x, y);
                                }
                            }
                        }
                    }
                }
            });
            Logger.Log(binarized);
            return(binarized);
        }
Пример #4
0
        public BinaryMap Filter(BinaryMap input)
        {
            RectangleC rect = new RectangleC(new Point(BorderDistance, BorderDistance),
                new Size(input.Width - 2 * BorderDistance, input.Height - 2 * BorderDistance));
            BinaryMap output = new BinaryMap(input.Size);
            Parallel.For(rect.RangeY.Begin, rect.RangeY.End, delegate(int y)
            {
                for (int x = rect.Left; x < rect.Right; ++x)
                {
                    RectangleC neighborhood = new RectangleC(
                        new Point(Math.Max(x - Radius, 0), Math.Max(y - Radius, 0)),
                        new Point(Math.Min(x + Radius + 1, output.Width), Math.Min(y + Radius + 1, output.Height)));

                    int ones = 0;
                    for (int ny = neighborhood.Bottom; ny < neighborhood.Top; ++ny)
                        for (int nx = neighborhood.Left; nx < neighborhood.Right; ++nx)
                            if (input.GetBit(nx, ny))
                                ++ones;

                    double voteWeight = 1.0 / neighborhood.TotalArea;
                    if (ones * voteWeight >= Majority)
                        output.SetBitOne(x, y);
                }
            });
            Logger.Log(output);
            return output;
        }
Пример #5
0
        float[,] PerformEqualization(BlockMap blocks, byte[,] image, float[, ,] equalization, BinaryMap blockMask)
        {
            float[,] result = new float[blocks.PixelCount.Height, blocks.PixelCount.Width];
            Parallel.ForEach(blocks.AllBlocks, delegate(Point block)
            {
                if (blockMask.GetBit(block))
                {
                    RectangleC area = blocks.BlockAreas[block];
                    for (int y = area.Bottom; y < area.Top; ++y)
                    {
                        for (int x = area.Left; x < area.Right; ++x)
                        {
                            byte pixel = image[y, x];

                            float bottomLeft  = equalization[block.Y, block.X, pixel];
                            float bottomRight = equalization[block.Y, block.X + 1, pixel];
                            float topLeft     = equalization[block.Y + 1, block.X, pixel];
                            float topRight    = equalization[block.Y + 1, block.X + 1, pixel];

                            PointF fraction = area.GetFraction(new Point(x, y));
                            result[y, x]    = Calc.Interpolate(topLeft, topRight, bottomLeft, bottomRight, fraction);
                        }
                    }
                }
            });
            Logger.Log(result);
            return(result);
        }
Пример #6
0
 public void And(BinaryMap source, RectangleC area, Point at)
 {
     Combine(source, area, at, delegate(uint[] target, uint[] srcVector)
     {
         for (int i = 0; i < target.Length; ++i)
             target[i] &= srcVector[i];
     });
 }
Пример #7
0
 public Size GetSize(SkeletonBuilder skeleton)
 {
     RectangleC rect = new RectangleC(0, 0, 1, 1);
     foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
     {
         rect.Include(minutia.Position);
         foreach (SkeletonBuilder.Ridge ridge in minutia.Ridges)
             if (ridge.Start.Position.Y <= ridge.End.Position.Y)
                 foreach (Point point in ridge.Points)
                     rect.Include(point);
     }
     return rect.Size;
 }
        static void Main(string[] args)
        {
            RectangleC r;

            r = new RectangleC();

            Console.WriteLine("Entre a largura e altura do retângulo: ");
            r.Width  = double.Parse(Console.ReadLine());
            r.Height = double.Parse(Console.ReadLine());

            Console.WriteLine("AREA = " + r.Area().ToString("F2"));
            Console.WriteLine("PERÍMETRO = " + r.Perimeter().ToString("F2"));
            Console.WriteLine("DIAGONAL = " + r.Diagonal().ToString("F2"));
        }
Пример #9
0
 public short[, ,] Analyze(BlockMap blocks, byte[,] image)
 {
     short[, ,] histogram = new short[blocks.BlockCount.Height, blocks.BlockCount.Width, 256];
     Parallel.ForEach(blocks.AllBlocks, delegate(Point block)     //并行进行直方图统计
     {
         RectangleC area = blocks.BlockAreas[block];
         for (int y = area.Bottom; y < area.Top; ++y)
         {
             for (int x = area.Left; x < area.Right; ++x)
             {
                 ++histogram[block.Y, block.X, image[y, x]];
             }
         }
     });
     return(histogram);
 }
Пример #10
0
        public BlockMap(Size pixelSize, int maxBlockSize)
        {
            PixelCount = pixelSize;
            BlockCount = new Size(
                Calc.DivRoundUp(PixelCount.Width, maxBlockSize),
                Calc.DivRoundUp(PixelCount.Height, maxBlockSize));
            CornerCount = BlockToCornerCount(BlockCount);

            AllBlocks = new RectangleC(BlockCount);
            AllCorners = new RectangleC(CornerCount);

            Corners = InitCorners();
            BlockAreas = new RectangleGrid(Corners);
            BlockCenters = InitBlockCenters();
            CornerAreas = InitCornerAreas();
        }
Пример #11
0
 private void drawAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Random rnd= new Random();
     ShapeC ellipse = new EllipseC(rnd.Next(50), rnd.Next(50), rnd.Next(150), rnd.Next(150));
     ShapeC rectangle = new RectangleC(rnd.Next(50), rnd.Next(50), rnd.Next(350), rnd.Next(150));
     ShapeC triangle = new TriangleC(rnd.Next(50), rnd.Next(50), rnd.Next(150), rnd.Next(150), rnd.Next(200), rnd.Next(200));
     ShapeC line = new LineC(rnd.Next(50), rnd.Next(50), rnd.Next(150), rnd.Next(350));
     ListOfShapes.Add(ellipse);
     ListOfShapes.Add(rectangle);
     ListOfShapes.Add(triangle);
     ListOfShapes.Add(line);
     foreach (ShapeC Shape in ListOfShapes)
     {
         Shape.Draw();
     }
 }
Пример #12
0
 public void LogRectangleC(RectangleC rec, BinaryWriter binWrite, TextWriter tw, string name)
 {
     binWrite.Write(rec.X);
     tw.WriteLine("{1} X: {0} ", rec.X, name);
     binWrite.Write(rec.Y);
     tw.WriteLine("{1} Y: {0}", rec.Y, name);
     binWrite.Write(rec.Width);
     tw.WriteLine("{1} Width: {0}", rec.Width, name);
     binWrite.Write(rec.Height);
     tw.WriteLine("{1} Height: {0}", rec.Height, name);
     //binWrite.Write(rec.Bottom);
     //tw.WriteLine("Bottom: " + rec.Bottom);
     //binWrite.Write(rec.Left);
     //tw.WriteLine("Left: " + rec.Left);
     //binWrite.Write(rec.Top);
     //tw.WriteLine("Top: " + rec.Top);
     //binWrite.Write(rec.Right);
     //tw.WriteLine("Right: " + rec.Right);
     //binWrite.Write(rec.TotalArea);
     //tw.WriteLine("TotalArea: " + rec.TotalArea);
     //binWrite.Write(rec.Center.X);
     //tw.WriteLine("Center x: " + rec.Center.X);
     //binWrite.Write(rec.Center.Y);
     //tw.WriteLine("center y: " + rec.Center.Y);
     //binWrite.Write(rec.Point.X);
     //tw.WriteLine("point x: " + rec.Point.X);
     //binWrite.Write(rec.Point.Y);
     //tw.WriteLine("point y: " + rec.Point.Y);
     //binWrite.Write(rec.Size.Height);
     //tw.WriteLine("size height: " + rec.Size.Height);
     //binWrite.Write(rec.Size.Width);
     //tw.WriteLine("size width: " + rec.Size.Width);
     //binWrite.Write(rec.RangeX.End);
     //tw.WriteLine("rangex end: " + rec.RangeX.End);
     //binWrite.Write(rec.RangeX.Begin);
     //tw.WriteLine("rangex begin: " + rec.RangeX.Begin);
     //binWrite.Write(rec.RangeX.Length);
     //tw.WriteLine("rangex length: " + rec.RangeX.Length);
     //binWrite.Write(rec.RangeY.End);
     //tw.WriteLine("rangey end: " + rec.RangeY.End);
     //binWrite.Write(rec.RangeY.Begin);
     //tw.WriteLine("rangey begin: " + rec.RangeY.Begin);
     //binWrite.Write(rec.RangeY.Length);
     //tw.WriteLine("rangey length: " + rec.RangeY.Length);
 }
Пример #13
0
        public Size GetSize(SkeletonBuilder skeleton)
        {
            RectangleC rect = new RectangleC(0, 0, 1, 1);

            foreach (SkeletonBuilder.Minutia minutia in skeleton.Minutiae)
            {
                rect.Include(minutia.Position);
                foreach (SkeletonBuilder.Ridge ridge in minutia.Ridges)
                {
                    if (ridge.Start.Position.Y <= ridge.End.Position.Y)
                    {
                        foreach (Point point in ridge.Points)
                        {
                            rect.Include(point);
                        }
                    }
                }
            }
            return(rect.Size);
        }
Пример #14
0
 PointF[,] SumBlocks(PointF[,] orientation, BlockMap blocks, BinaryMap mask)
 {
     PointF[,] sums = new PointF[blocks.BlockCount.Height, blocks.BlockCount.Width];
     Parallel.ForEach(blocks.AllBlocks, delegate(Point block)
     {
         if (mask.GetBit(block))
         {
             PointF sum      = new PointF();
             RectangleC area = blocks.BlockAreas[block];
             for (int y = area.Bottom; y < area.Top; ++y)
             {
                 for (int x = area.Left; x < area.Right; ++x)
                 {
                     sum = Calc.Add(sum, orientation[y, x]);
                 }
             }
             sums[block.Y, block.X] = sum;
         }
     });
     return(sums);
 }
Пример #15
0
        public BinaryMap Filter(BinaryMap input)
        {
            RectangleC rect = new RectangleC(new Point(BorderDistance, BorderDistance),
                                             new Size(input.Width - 2 * BorderDistance, input.Height - 2 * BorderDistance));
            BinaryMap output = new BinaryMap(input.Size);

            Parallel.For(rect.RangeY.Begin, rect.RangeY.End, delegate(int y)
            {
                for (int x = rect.Left; x < rect.Right; ++x)
                {
                    RectangleC neighborhood = new RectangleC(
                        new Point(Math.Max(x - Radius, 0), Math.Max(y - Radius, 0)),
                        new Point(Math.Min(x + Radius + 1, output.Width), Math.Min(y + Radius + 1, output.Height)));

                    int ones = 0;
                    for (int ny = neighborhood.Bottom; ny < neighborhood.Top; ++ny)
                    {
                        for (int nx = neighborhood.Left; nx < neighborhood.Right; ++nx)
                        {
                            if (input.GetBit(nx, ny))
                            {
                                ++ones;
                            }
                        }
                    }

                    double voteWeight = 1.0 / neighborhood.TotalArea;
                    if (ones * voteWeight >= Majority)
                    {
                        output.SetBitOne(x, y);
                    }
                }
            });
            Logger.Log(output);
            return(output);
        }
Пример #16
0
 PointF[,] Smooth(PointF[,] orientation, BinaryMap mask)
 {
     PointF[,] smoothed = new PointF[mask.Height, mask.Width];
     Parallel.For(0, mask.Height, delegate(int y)
     {
         for (int x = 0; x < mask.Width; ++x)
             if (mask.GetBit(x, y))
             {
                 RectangleC neighbors = new RectangleC(
                     new Point(Math.Max(0, x - SmoothingRadius), Math.Max(0, y - SmoothingRadius)),
                     new Point(Math.Min(mask.Width, x + SmoothingRadius + 1), Math.Min(mask.Height, y + SmoothingRadius + 1)));
                 PointF sum = new PointF();
                 for (int ny = neighbors.Bottom; ny < neighbors.Top; ++ny)
                     for (int nx = neighbors.Left; nx < neighbors.Right; ++nx)
                         if (mask.GetBit(nx, ny))
                             sum = Calc.Add(sum, orientation[ny, nx]);
                 smoothed[y, x] = sum;
             }
     });
     return smoothed;
 }
Пример #17
0
 public void LogRectangleC(RectangleC rec, BinaryWriter binWrite, TextWriter tw, string name)
 {
     binWrite.Write(rec.X);
     tw.WriteLine("{1} X: {0} ", rec.X, name);
     binWrite.Write(rec.Y);
     tw.WriteLine("{1} Y: {0}", rec.Y, name);
     binWrite.Write(rec.Width);
     tw.WriteLine("{1} Width: {0}", rec.Width, name);
     binWrite.Write(rec.Height);
     tw.WriteLine("{1} Height: {0}", rec.Height, name);
     //binWrite.Write(rec.Bottom);
     //tw.WriteLine("Bottom: " + rec.Bottom);
     //binWrite.Write(rec.Left);
     //tw.WriteLine("Left: " + rec.Left);
     //binWrite.Write(rec.Top);
     //tw.WriteLine("Top: " + rec.Top);
     //binWrite.Write(rec.Right);
     //tw.WriteLine("Right: " + rec.Right);
     //binWrite.Write(rec.TotalArea);
     //tw.WriteLine("TotalArea: " + rec.TotalArea);
     //binWrite.Write(rec.Center.X);
     //tw.WriteLine("Center x: " + rec.Center.X);
     //binWrite.Write(rec.Center.Y);
     //tw.WriteLine("center y: " + rec.Center.Y);
     //binWrite.Write(rec.Point.X);
     //tw.WriteLine("point x: " + rec.Point.X);
     //binWrite.Write(rec.Point.Y);
     //tw.WriteLine("point y: " + rec.Point.Y);
     //binWrite.Write(rec.Size.Height);
     //tw.WriteLine("size height: " + rec.Size.Height);
     //binWrite.Write(rec.Size.Width);
     //tw.WriteLine("size width: " + rec.Size.Width);
     //binWrite.Write(rec.RangeX.End);
     //tw.WriteLine("rangex end: " + rec.RangeX.End);
     //binWrite.Write(rec.RangeX.Begin);
     //tw.WriteLine("rangex begin: " + rec.RangeX.Begin);
     //binWrite.Write(rec.RangeX.Length);
     //tw.WriteLine("rangex length: " + rec.RangeX.Length);
     //binWrite.Write(rec.RangeY.End);
     //tw.WriteLine("rangey end: " + rec.RangeY.End);
     //binWrite.Write(rec.RangeY.Begin);
     //tw.WriteLine("rangey begin: " + rec.RangeY.Begin);
     //binWrite.Write(rec.RangeY.Length);
     //tw.WriteLine("rangey length: " + rec.RangeY.Length);
 }
Пример #18
0
        public BinaryMap Filter(BinaryMap input)
        {
            ////Testing Start
            //Count++;
            //var inFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "inputBinary" + Count + ".bin");
            //var outFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "outputBinary" + Count + ".bin");
            //var file = new FileStream(inFileDir, FileMode.CreateNew);
            //var binWrite = new BinaryWriter(file);
            //binWrite.Write(input.WordWidth);
            //Console.WriteLine(input.WordWidth);
            //binWrite.Write(input.Width);
            //Console.WriteLine(input.Width);
            //binWrite.Write(input.Height);
            //Console.WriteLine(input.Height);
            //foreach (var i in input.Map)
            //{
            //    binWrite.Write(i);
            //    Console.WriteLine(i);
            //}
            //binWrite.Close();
            //file.Close();
            ////Testing Finish

            RectangleC rect = new RectangleC(new Point(BorderDistance, BorderDistance),
                new Size(input.Width - 2 * BorderDistance, input.Height - 2 * BorderDistance));
            BinaryMap output = new BinaryMap(input.Size);
            Parallel.For(rect.RangeY.Begin, rect.RangeY.End, delegate (int y)
            {
                for (int x = rect.Left; x < rect.Right; ++x)
                {
                    RectangleC neighborhood = new RectangleC(
                        new Point(Math.Max(x - Radius, 0), Math.Max(y - Radius, 0)),
                        new Point(Math.Min(x + Radius + 1, output.Width), Math.Min(y + Radius + 1, output.Height)));

                    int ones = 0;
                    for (int ny = neighborhood.Bottom; ny < neighborhood.Top; ++ny)
                        for (int nx = neighborhood.Left; nx < neighborhood.Right; ++nx)
                            if (input.GetBit(nx, ny))
                                ++ones;

                    double voteWeight = 1.0 / neighborhood.TotalArea;
                    if (ones * voteWeight >= Majority)
                        output.SetBitOne(x, y);
                }
            });
            Logger.Log(output);

            ////Testing
            //file = new FileStream(outFileDir, FileMode.CreateNew);
            //binWrite = new BinaryWriter(file);
            //binWrite.Write(output.WordWidth);
            //binWrite.Write(output.Width);
            //binWrite.Write(output.Height);
            //foreach (var i in output.Map)
            //{
            //    binWrite.Write(i);
            //}
            //binWrite.Close();
            //file.Close();
            ////Testing End

            return output;
        }
Пример #19
0
        public BinaryMap Filter(BinaryMap input)
        {
            ////Testing Start
            //Count++;
            //var inFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "inputBinary" + Count + ".bin");
            //var outFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "outputBinary" + Count + ".bin");
            //var file = new FileStream(inFileDir, FileMode.CreateNew);
            //var binWrite = new BinaryWriter(file);
            //binWrite.Write(input.WordWidth);
            //Console.WriteLine(input.WordWidth);
            //binWrite.Write(input.Width);
            //Console.WriteLine(input.Width);
            //binWrite.Write(input.Height);
            //Console.WriteLine(input.Height);
            //foreach (var i in input.Map)
            //{
            //    binWrite.Write(i);
            //    Console.WriteLine(i);
            //}
            //binWrite.Close();
            //file.Close();
            ////Testing Finish

            RectangleC rect = new RectangleC(new Point(BorderDistance, BorderDistance),
                                             new Size(input.Width - 2 * BorderDistance, input.Height - 2 * BorderDistance));
            BinaryMap output = new BinaryMap(input.Size);

            Parallel.For(rect.RangeY.Begin, rect.RangeY.End, delegate(int y)
            {
                for (int x = rect.Left; x < rect.Right; ++x)
                {
                    RectangleC neighborhood = new RectangleC(
                        new Point(Math.Max(x - Radius, 0), Math.Max(y - Radius, 0)),
                        new Point(Math.Min(x + Radius + 1, output.Width), Math.Min(y + Radius + 1, output.Height)));

                    int ones = 0;
                    for (int ny = neighborhood.Bottom; ny < neighborhood.Top; ++ny)
                    {
                        for (int nx = neighborhood.Left; nx < neighborhood.Right; ++nx)
                        {
                            if (input.GetBit(nx, ny))
                            {
                                ++ones;
                            }
                        }
                    }

                    double voteWeight = 1.0 / neighborhood.TotalArea;
                    if (ones * voteWeight >= Majority)
                    {
                        output.SetBitOne(x, y);
                    }
                }
            });
            Logger.Log(output);

            ////Testing
            //file = new FileStream(outFileDir, FileMode.CreateNew);
            //binWrite = new BinaryWriter(file);
            //binWrite.Write(output.WordWidth);
            //binWrite.Write(output.Width);
            //binWrite.Write(output.Height);
            //foreach (var i in output.Map)
            //{
            //    binWrite.Write(i);
            //}
            //binWrite.Close();
            //file.Close();
            ////Testing End

            return(output);
        }
Пример #20
0
 void Combine(BinaryMap source, RectangleC area, Point at, CombineFunction function)
 {
     int shift = (int)((uint)area.X & WordMask) - (int)((uint)at.X & WordMask);
     int vectorSize = (area.Width >> WordShift) + 2;
     Parallel.For(0, area.Height,
         () => new CombineLocals { Vector = new uint[vectorSize], SrcVector = new uint[vectorSize] },
         delegate(int y, ParallelLoopState state, CombineLocals locals)
         {
             LoadLine(locals.Vector, new Point(at.X, at.Y + y), area.Width);
             source.LoadLine(locals.SrcVector, new Point(area.X, area.Y + y), area.Width);
             if (shift >= 0)
                 ShiftLeft(locals.SrcVector, shift);
             else
                 ShiftRight(locals.SrcVector, -shift);
             function(locals.Vector, locals.SrcVector);
             SaveLine(locals.Vector, new Point(at.X, at.Y + y), area.Width);
             return locals;
         }, locals => { });
 }
Пример #21
0
 public void Fill(RectangleC rect)
 {
     if (rect.Width > 0)
     {
         int initialWord = (int)((uint)rect.Left >> WordShift);
         int finalWord = (rect.Right - 1) >> WordShift;
         int initialShift = (int)((uint)rect.Left & WordMask);
         int finalShift = 32 - (int)((uint)rect.Right & WordMask);
         for (int xw = initialWord; xw <= finalWord; ++xw)
         {
             uint mask = ~0u;
             if (xw == initialWord && initialShift != 0)
                 mask = mask << initialShift;
             if (xw == finalWord && finalShift != WordSize)
                 mask = (mask << finalShift) >> finalShift;
             for (int y = rect.Bottom; y < rect.Top; ++y)
                 Map[y, xw] |= mask;
         }
     }
 }
Пример #22
0
 public void Copy(BinaryMap source, RectangleC area, Point at)
 {
     int shift = (int)((uint)area.X & WordMask) - (int)((uint)at.X & WordMask);
     Parallel.For(0, area.Height,
         () => new uint[(area.Width >> WordShift) + 2],
         delegate(int y, ParallelLoopState state, uint[] vector)
         {
             source.LoadLine(vector, new Point(area.X, area.Y + y), area.Width);
             if (shift >= 0)
                 ShiftLeft(vector, shift);
             else
                 ShiftRight(vector, -shift);
             SaveLine(vector, new Point(at.X, at.Y + y), area.Width);
             return vector;
         }, vector => { });
 }
Пример #23
0
 private void rectangleToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     ShapeC rectangle = new RectangleC(100, 100, 50, 50);
     rectangle.Draw();
 }