Example #1
0
        private void tabBannerPicCreater()
        {
            //show Bitmap
            ImageFix     ifix        = new ImageFix();
            AllSelData   asd         = new AllSelData();
            byte         r           = asd.getBannerColorArray(tabBannerBaseColor.SelectedIndex)[0];
            byte         g           = asd.getBannerColorArray(tabBannerBaseColor.SelectedIndex)[1];
            byte         b           = asd.getBannerColorArray(tabBannerBaseColor.SelectedIndex)[2];
            BitmapSource finalBitmap = ifix.ChangeColor(ifix.BitmapImage2BitmapSource(new BitmapImage(new Uri("pack://application:,,,/Images/Banner/background.png")), false), new byte[] { 255, 255, 255, 255 }, new byte[] { b, g, r, 255 });
            int          showIndex   = 0;

            if (tabBannerMaxIndex <= 0 && tabBannerEditIndex == 0)
            {
                showIndex = tabBannerMaxIndex;
            }
            else if (tabBannerMaxIndex >= 0 && tabBannerEditIndex != 0 && tabBannerMaxIndex < globalBannerMaxIndex - 2)
            {
                showIndex = tabBannerMaxIndex + 1;
            }
            else
            {
                showIndex = tabBannerMaxIndex;
            }
            for (int i = 0; i <= showIndex; i++)
            {
                byte r1 = asd.getBannerColorArray(globalBannerColor[i])[0];
                byte g1 = asd.getBannerColorArray(globalBannerColor[i])[1];
                byte b1 = asd.getBannerColorArray(globalBannerColor[i])[2];
                //BitmapSource K1Bitmap;
                //if (globalBannerType[i] == 3 || globalBannerType[i] == 4)
                //{
                //    //K1Bitmap = ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { 0, 0, 0, 255 }, new byte[] { b1, g1, r1, 255 }, true);
                //    K1Bitmap =
                //    ifix.ChangeColor(
                //        ifix.ChangeColor(
                //            ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { 0, 0, 0, 255 }, new byte[] { b1, g1, r1, 255 }, true)
                //        , new byte[] { 2, 3, 6, 255 }, new byte[] { (byte)(b1 + 2), (byte)(g1 + 3), (byte)(r1 + 6), 255 }, true)
                //    , new byte[] { 6, 5, 8, 255 }, new byte[] { (byte)(b1 + 6), (byte)(g1 + 5), (byte)(r1 + 8), 255 }, true);
                //}
                //else
                //{
                //    K1Bitmap = ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { 0, 0, 0, 255 }, new byte[] { b1, g1, r1, 255 });
                //}
                BitmapSource K1Bitmap;
                if (globalBannerType[i] == 3)
                {
                    K1Bitmap = ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { b1, g1, r1, 255 }, true);
                }
                else if (globalBannerType[i] == 4)
                {
                    K1Bitmap = ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { b1, g1, r1, 255 }, false);
                }
                else
                {
                    K1Bitmap = ifix.ChangeColor(tabBannerTypeSel(globalBannerType[i]), new byte[] { 0, 0, 0, 255 }, new byte[] { b1, g1, r1, 255 });
                }
                finalBitmap = ifix.Merger(finalBitmap, K1Bitmap);
            }
            finalBitmap         = ifix.ChangeSize(finalBitmap, 13);
            tabBannerPic.Source = finalBitmap;
        }