//--------------------------------------------------------------------------------------
        public FormDivideBy3DDescription(Image pImage)
        {
            InitializeComponent();
//            fImageListDataSet = new ImageListDataSet();
            fSourceBitmap = pImage as Bitmap;
            if (fSourceBitmap != null)
            {
                pbSourceImage.Image = fSourceBitmap;
                fColorPartion       = new CColorPartion(fSourceBitmap);
                lblRedSet.Text      = fColorPartion.MainTextRed;
                lblGreenSet.Text    = fColorPartion.MainTextGreen;
                lblBlueSet.Text     = fColorPartion.MainTextBlue;
                lblSummaSet.Text    = fColorPartion.MainTextSumma;
                this.toolTip1.SetToolTip(this.lblRedSet, fColorPartion.AddTextRed);
                this.toolTip1.SetToolTip(this.lblGreenSet, fColorPartion.AddTextGreen);
                this.toolTip1.SetToolTip(this.lblBlueSet, fColorPartion.AddTextBlue);
                this.toolTip1.SetToolTip(this.lblSummaSet, fColorPartion.AddTextSumma);
                tbRed.Minimum   = 0;
                tbRed.Maximum   = fColorPartion.RedPartition.Length - 1;
                tbGreen.Minimum = 0;
                tbGreen.Maximum = fColorPartion.GreenPartition.Length - 1;
                tbBlue.Minimum  = 0;
                tbBlue.Maximum  = fColorPartion.BluePartition.Length - 1;
            }
        }
Example #2
0
        //--------------------------------------------------------------------------------------
        private void DefineColorPartion()
        {
            Bitmap lPicture = pbSourceImage.Image as Bitmap;

            if (lPicture != null)
            {
                CColorPartion lColorPartition = new CColorPartion(lPicture);

                /*
                 * List<Color> lData = new List<Color>(lPicture.Height * lPicture.Width);
                 * for (int i = 0; i < lPicture.Width; i++)
                 *  for (int j = 0; j < lPicture.Height; j++)
                 *      lData.Add(lPicture.GetPixel(i, j));
                 *
                 * var queryGroupColorRed = from ColorVal in lData
                 *                       group ColorVal by ColorVal.R into ColorGroup
                 *                       orderby ColorGroup.Key
                 *                       select new
                 *                       {
                 *                           ColorLevel = ColorGroup.Key,
                 *                           ColorWeight = ColorGroup.Count()
                 *                       };
                 * var queryGroupColorGreen = from ColorVal in lData
                 *                       group ColorVal by ColorVal.G into ColorGroup
                 *                       orderby ColorGroup.Key
                 *                       select new
                 *                       {
                 *                           ColorLevel = ColorGroup.Key,
                 *                           ColorWeight = ColorGroup.Count()
                 *                       };
                 * var queryGroupColorBlue = from ColorVal in lData
                 *                       group ColorVal by ColorVal.B into ColorGroup
                 *                       orderby ColorGroup.Key
                 *                       select new
                 *                       {
                 *                           ColorLevel = ColorGroup.Key,
                 *                           ColorWeight = ColorGroup.Count()
                 *                       };
                 * string lMainTextRed = "";
                 * string lMainTextGreen = "";
                 * string lMainTextBlue = "";
                 * string lAddTextRed = "";
                 * string lAddTextGreen = "";
                 * string lAddTextBlue = "";
                 * foreach (var lColorPart in queryGroupColorRed)
                 * {
                 *  lMainTextRed += lColorPart.ColorLevel.ToString() + ", ";
                 *  lAddTextRed += lColorPart.ColorLevel.ToString("D3") + " : " + lColorPart.ColorWeight.ToString() + Environment.NewLine;
                 * }
                 * foreach (var lColorPart in queryGroupColorGreen)
                 * {
                 *  lMainTextGreen += lColorPart.ColorLevel.ToString() + ", ";
                 *  lAddTextGreen += lColorPart.ColorLevel.ToString("D3") + " : " + lColorPart.ColorWeight.ToString() + Environment.NewLine;
                 * }
                 * foreach (var lColorPart in queryGroupColorBlue)
                 * {
                 *  lMainTextBlue += lColorPart.ColorLevel.ToString() + ", ";
                 *  lAddTextBlue += lColorPart.ColorLevel.ToString("D3") + " : " + lColorPart.ColorWeight.ToString() + Environment.NewLine;
                 * }
                 * lblRedSet.Text = lMainTextRed;
                 * lblGreenSet.Text = lMainTextGreen;
                 * lblBlueSet.Text = lMainTextBlue;
                 * this.toolTip1.SetToolTip(this.lblRedSet, lAddTextRed);
                 * this.toolTip1.SetToolTip(this.lblGreenSet, lAddTextGreen);
                 * this.toolTip1.SetToolTip(this.lblBlueSet, lAddTextBlue);
                 */
                lblRedSet.Text   = lColorPartition.MainTextRed;
                lblGreenSet.Text = lColorPartition.MainTextGreen;
                lblBlueSet.Text  = lColorPartition.MainTextBlue;
                this.toolTip1.SetToolTip(this.lblRedSet, lColorPartition.AddTextRed);
                this.toolTip1.SetToolTip(this.lblGreenSet, lColorPartition.AddTextGreen);
                this.toolTip1.SetToolTip(this.lblBlueSet, lColorPartition.AddTextBlue);
            }
        }