예제 #1
0
        //predicate for sorting the widths in descending order
        //public static int CompareWidthDesc(Block arg1, Block arg2)
        //{
        //    return arg2.Width.CompareTo(arg1.Width);
        //}
        public static int CompareWidthThenCol(Block arg1, Block arg2)
        {
            int compI = 0;

            compI = arg1.Width - arg2.Width;

            if (compI != 0)
                return compI;

            else
                compI = arg1._color.ToArgb() - arg2._color.ToArgb();

            return compI;
        }
예제 #2
0
 public static int CompareWidth(Block arg1, Block arg2)
 {
     return arg1.Width.CompareTo(arg2.Width);
 }
예제 #3
0
 public static bool LongEnough(Block arg)
 {
     return arg.Width > 100;
 }
예제 #4
0
 //predicates
 public static bool BrightEnough(Block arg)
 {
     return arg._color.GetBrightness() > 0.5;
 }
예제 #5
0
        private void btnPopulate_Click(object sender, EventArgs e)
        {
            blocksList.Clear();

            int blockArea = 0;

            while (blockArea < Block.Canvas.ScaledWidth * Block.Canvas.ScaledHeight * 0.8)
            {
                Block tBlock = new Block();

                if (!blocksList.Equals(tBlock))
                {
                    blocksList.Add(tBlock);
                    blockArea += tBlock.Width * Block.Height;
                }
            }

            UpdateTrackBar();
            ShowBlocks();
        }