示例#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();
        }