Пример #1
0
        /// <summary>
        /// 这个可能放弃使用
        /// </summary>
        /// <param name="basePic"></param>
        /// <param name="diffPic"></param>
        /// <param name="merger_scheme"></param>
        /// <param name="offset_x"></param>
        /// <param name="offset_y"></param>
        /// <returns></returns>
        public static ImageOpen Merger(ImageOpen basePic, ImageOpen diffPic, int merger_scheme, int offset_x, int offset_y)
        {
            ImageOpen outPic;

            switch (merger_scheme)
            {
            case 1:
                outPic = PicMergerCore.Alpha(basePic, diffPic, offset_x, offset_y);
                break;

            case 2:
                outPic = PicMergerCore.Color(basePic, diffPic, offset_x, offset_y);
                break;

            case 3:
                outPic = PicMergerCore.Override(basePic, diffPic, offset_x, offset_y);
                break;

            default:
                outPic = null;
                break;
            }

            return(outPic);
        }
Пример #2
0
        /// <summary>
        /// 输入两张图片,得到的是合成后的图片。
        /// 返回图片由clone生成,不影响源图。
        /// </summary>
        /// <param name="basePic"></param>
        /// <param name="diffPic"></param>
        /// <param name="merger_scheme"></param>
        /// <returns></returns>
        public static ImageOpen Merger(ImageOpen basePic, ImageOpen diffPic, int merger_scheme, bool needPA = false)
        {
            ImageOpen outPic;
            var       offset_x = diffPic.OffsetXY[0] - basePic.OffsetXY[0];
            var       offset_y = diffPic.OffsetXY[1] - basePic.OffsetXY[1];

            //PA处理
            if (needPA)
            {
                if (!basePic.PremultipliedAlphaSign)
                {
                    PremultipliedAlpha(basePic.m_pic);
                    basePic.PremultipliedAlphaSign = true;
                }
                if (!diffPic.PremultipliedAlphaSign)
                {
                    PremultipliedAlpha(diffPic.m_pic);
                    diffPic.PremultipliedAlphaSign = true;
                }
            }


            switch (merger_scheme)
            {
            case 1:
                outPic = PicMergerCore.Alpha(basePic, diffPic, offset_x, offset_y);
                break;

            case 2:
                outPic = PicMergerCore.Color(basePic, diffPic, offset_x, offset_y);
                break;

            case 3:
                outPic = PicMergerCore.Override(basePic, diffPic, offset_x, offset_y);
                break;

            case 4:
                outPic = PicMergerCore.EgdeDetect(basePic, diffPic);
                break;

            default:
                outPic = null;
                break;
            }
            outPic.MergedCount = basePic.MergedCount + 1;
            return(outPic);
        }