Exemplo n.º 1
0
        private void SweepRast_MouseClick(object sender, MouseEventArgs e)
        {
            ras        = new Raster();
            ras.Width  = rWidth;
            ras.Height = rHeight;
            ras.DrawTiles();

            if (step >= 1)
            {
                ras.ActiveCell(9, 2, false);
            }

            if (step >= 2)
            {
                ras.ActiveCell(9, 2, true);
            }

            Point[] tileSeq
                = new Point[] {
                new Point(2, 0),
                new Point(3, 0),
                new Point(1, 0),
                new Point(0, 0),
                new Point(1, 1),
                new Point(0, 1),
                new Point(2, 1),
                new Point(3, 1),
                new Point(2, 2),
                new Point(1, 2),
                new Point(0, 2),
                new Point(3, 2),
                new Point(2, 3),
                new Point(1, 3),
                new Point(0, 3),
                new Point(3, 3),
                };

            if (step >= 3)
            {
                int maxId = Math.Min(tileSeq.Length, step - 3);
                for (int i = 0; i < maxId; ++i)
                {
                    ActiveCellInTileAndTriangle(tileSeq[i].X, tileSeq[i].Y, true);
                    ras.DrawTile(tileSeq[i].X, tileSeq[i].Y, true, Raster.Mask.Pending);
                }
            }

            Bitmap bmp = ras.Bitmap.Clone() as Bitmap;

            Utility.DrawTriangle(bmp, pt0, pt1, pt2, ras.CellSize);

            ++step;
            this.BackgroundImage = bmp;
        }
Exemplo n.º 2
0
        private void SweepRast_MouseClick(object sender, MouseEventArgs e)
        {
            ras = new Raster();
            ras.Width = rWidth;
            ras.Height = rHeight;
            ras.DrawTiles();

            if (step >= 1)
            {
                ras.ActiveCell(9, 2, false);
            }

            if (step >= 2)
            {
                ras.ActiveCell(9, 2, true);
            }

            Point[] tileSeq
                = new Point[]{
                    new Point(2,0),
                    new Point(3,0),
                    new Point(1,0),
                    new Point(0,0),
                    new Point(1,1),
                    new Point(0,1),
                    new Point(2,1),
                    new Point(3,1),
                    new Point(2,2),
                    new Point(1,2),
                    new Point(0,2),
                    new Point(3,2),
                    new Point(2,3),
                    new Point(1,3),
                    new Point(0,3),
                    new Point(3,3),
                };

            if (step >= 3)
            {
                int maxId = Math.Min( tileSeq.Length, step-3 );
                for (int i = 0; i < maxId; ++i)
                {
                    ActiveCellInTileAndTriangle(tileSeq[i].X, tileSeq[i].Y, true);
                    ras.DrawTile(tileSeq[i].X, tileSeq[i].Y, true, Raster.Mask.Pending);
                }
            }

            Bitmap bmp = ras.Bitmap.Clone() as Bitmap;
            Utility.DrawTriangle(bmp, pt0, pt1, pt2, ras.CellSize);

            ++step;
            this.BackgroundImage = bmp;
        }
Exemplo n.º 3
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            ras        = new Raster();
            ras.Width  = rWidth;
            ras.Height = rHeight;

            int lineCount = 0;

            for (int j = 0; j < rHeight; ++j)

            {
                bool lineActive = false;

                for (int i = 0; i < rWidth; ++i)
                {
                    if (Utility.PositiveCellOfLine(i, j, pt0, pt1) &&
                        Utility.PositiveCellOfLine(i, j, pt1, pt2) &&
                        Utility.PositiveCellOfLine(i, j, pt2, pt0)
                        )
                    {
                        lineActive = true;
                        ras.ActiveCell(i, j, false);
                    }
                }

                if (lineActive)
                {
                    ++lineCount;
                }
                if (lineCount >= step - 1)
                {
                    break;
                }
            }

            Bitmap bmp = new Bitmap(ras.Bitmap);

            Utility.DrawTriangle(bmp, pt0, pt1, pt2, ras.CellSize);
            if (step >= 1)
            {
                DrawHorizontalSplitter(bmp, pt0, pt1, pt2);
            }

            ++step;

            this.BackgroundImage       = bmp;
            this.BackgroundImageLayout = ImageLayout.Center;
        }
Exemplo n.º 4
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            ras = new Raster();
            ras.Width = rWidth;
            ras.Height = rHeight;

            for (int i = 0; i < rWidth; ++i)
            {
                for (int j = 0; j < rHeight; ++j)
                {
                    if ( PositiveOfLine(i, j, pt0, pt1) && PositiveOfLine(i, j, pt1, pt2) && PositiveOfLine(i, j, pt2, pt0) )
                    {
                        if( )
                        ras.ActiveCell(i, j);
                    }
                }
            }

            DrawTriangle(pt0, pt1, pt2);
        }
Exemplo n.º 5
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            ras        = new Raster();
            ras.Width  = rWidth;
            ras.Height = rHeight;

            for (int i = 0; i < rWidth; ++i)
            {
                for (int j = 0; j < rHeight; ++j)
                {
                    if (PositiveOfLine(i, j, pt0, pt1) && PositiveOfLine(i, j, pt1, pt2) && PositiveOfLine(i, j, pt2, pt0))
                    {
                        if ()
                        {
                            ras.ActiveCell(i, j);
                        }
                    }
                }
            }

            DrawTriangle(pt0, pt1, pt2);
        }
Exemplo n.º 6
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            ras = new Raster();
            ras.Width = rWidth;
            ras.Height = rHeight;

            int lineCount = 0;

            for (int j = 0; j < rHeight; ++j)

            {
                bool lineActive = false;

                for (int i = 0; i < rWidth; ++i)
                {
                    if ( Utility.PositiveCellOfLine(i, j, pt0, pt1)
                        && Utility.PositiveCellOfLine(i, j, pt1, pt2)
                        && Utility.PositiveCellOfLine(i, j, pt2, pt0)
                        )
                    {
                        lineActive = true;
                        ras.ActiveCell(i, j, false);
                    }
                }

                if (lineActive) { ++lineCount; }
                if (lineCount >= step - 1)
                {
                    break;
                }
            }

            Bitmap bmp = new Bitmap(ras.Bitmap);

            Utility.DrawTriangle( bmp, pt0, pt1, pt2, ras.CellSize);
            if (step >= 1)
            {
                DrawHorizontalSplitter(bmp, pt0, pt1, pt2);
            }

            ++step;

            this.BackgroundImage = bmp;
            this.BackgroundImageLayout = ImageLayout.Center;
        }