Exemplo n.º 1
0
 private static int Comparator(Sqer x, Sqer y)
 {
     if (x.r.Width < y.r.Width)
     {
         return(1);
     }
     else
     {
         return(-1);
     }
 }
Exemplo n.º 2
0
        public IntSqer()
        {
            InitializeComponent();
            r     = new Random();
            count = 0;
            bity  = new List <Bitmap>();
            int i; int seci = 0;

            bit        = new Bitmap(2 * 255, 2 * 255);
            background = new Background(bit);
            Sqery      = new List <Sqer>();
            sq1        = new Sqer(bit, bit.Width / 2, background);
            //     sq2 = new Sqer(bit, bit.Width / 4, background);
            Sqery.Add(sq1);
            //   Sqery.Add(sq2);
            //#region b&w
            //for (i = 0; i < 255; i++)
            //{
            //    Bitmap bit = new Bitmap(2 * 255, 2 * 255);

            //    Rectangle r1 = new Rectangle(0, 0, bit.Width, bit.Height);
            //    SolidBrush b1 = new SolidBrush(Color.FromArgb(i, i, i));
            //    using (Graphics g = Graphics.FromImage(bit))
            //    {
            //        g.FillRectangle(b1, r1);
            //    }

            //    //Rectangle rb = new Rectangle(bit.Width / 2 - 2*i, bit.Height / 2 - 2*i, 4 * i, 4 * i);
            //    //SolidBrush bb = new SolidBrush(Color.FromArgb((255 - i)/2, (255 - i) / 2, (255 - i) / 2));
            //    //using (Graphics g = Graphics.FromImage(bit))
            //    //{
            //    //    g.FillRectangle(bb, rb);
            //    //}

            //    //Rectangle rb = new Rectangle(bit.Width / 4 -  i, bit.Height / 4 -  i, (bit.Width-(bit.Width / 4 - i))/2, 4 * i);
            //    //SolidBrush bb = new SolidBrush(Color.FromArgb((255 - i) / 2, (255 - i) / 2, (255 - i) / 2));
            //    //using (Graphics g = Graphics.FromImage(bit))
            //    //{
            //    //    g.FillRectangle(bb, rb);
            //    //}

            //    Rectangle rb = new Rectangle(bit.Width / 4 - i, bit.Height / 4 - i, (bit.Width - 2 * (bit.Width / 4 - i)), (bit.Width - 2 * (bit.Width / 4 - i)));
            //    SolidBrush bb = new SolidBrush(Color.FromArgb((255 - i) / 2, (255 - i) / 2, (255 - i) / 2));
            //    using (Graphics g = Graphics.FromImage(bit))
            //    {
            //        g.FillRectangle(bb, rb);
            //    }

            //    Rectangle r2 = new Rectangle(bit.Width / 2 - i, bit.Height / 2 - i, 2 * i, 2 * i);
            //    SolidBrush b2 = new SolidBrush(Color.FromArgb(255 - i, 255 - i, 255 - i));
            //    using (Graphics g = Graphics.FromImage(bit))
            //    {
            //        g.FillRectangle(b2, r2);
            //    }

            //    if (bit.Width / 2 - 2 * i <= 0)
            //    {
            //        Rectangle rb2 = new Rectangle(bit.Width / 2 - seci, bit.Height / 2 - seci, 2 * seci, 2 * seci);
            //        SolidBrush bb2 = new SolidBrush(Color.FromArgb(255 - seci, 255 - seci, 255 - seci));
            //        using (Graphics g = Graphics.FromImage(bit))
            //        {
            //            g.FillRectangle(bb2, rb2);
            //        }
            //        seci++;
            //    }

            //    bity.Add(bit);
            //}
            //pictureBox1.Image = bity[0];
            //#endregion b&w
        }
Exemplo n.º 3
0
 public void Switch(Sqer s)
 {
     c = Color.FromArgb(s.c.R, s.c.G, s.c.B);
 }