Exemplo n.º 1
0
        List <int> BrightPixList = new List <int>();//记录各个亮度的像素各自有多少

        void RefreshShow()
        {
            TotleNoisePixs = 0;
            TotlePixs      = 0;
            stackBitmapList.Children.Clear();
            BrightPixList.Clear();

            for (int i = 0; i < 256; i++)
            {
                BrightPixList.Add(0);
            }                                                      //初始化

            for (int i = 1; i <= bl.Count; i++)
            {
                WriteableBitmap bi = bl[i - 1];
                Image           li = new Image();
                li.Source = bi;

                li.Width  = stackBitmapList.Width / bl.Count;
                li.Height = stackBitmapList.Height;
                double w = li.Height * bi.PixelWidth / bi.PixelHeight;
                if (li.Width > w)
                {
                    li.Width = w;
                }
                this.stackBitmapList.Children.Add(li);
                li.PointerPressed += (li_MouseLeftButtonDown);
                double ab = ptp.getAverageBright(bi);
                float  f  = Convert.ToSingle(lynxUpDown1.LongValue) / 100;
                TotleNoisePixs = TotleNoisePixs + ptp.getNoiseNum(bi, f);
                TotlePixs      = TotlePixs + bi.PixelHeight * bi.PixelWidth;
                List <int> tl = ptp.getBrightPixNum(bi);
                BrightPixList = dg.AddBrightPixNum(BrightPixList, tl);
            }
        }