将多张图片合并成一张图片,可用于生成IM即时通讯群组拼接头像。
依赖: System.Drawing.Common
以下四张网络图片作为源文件。
(1)2张图片的合并
1.1 Merge2R1形态:
/// <summary>
/// 2张图片,上下各1个长方形
/// ———————————————————
/// | |
/// | R1 |
/// | |
/// ———————————————————
/// | |
/// | R2 |
/// | |
/// ———————————————————
/// </summary>
MergeProvider.Merge2Images(img1, img2, Merge2LayoutEnum.Merge2R1, 250);
1.2 Merge2R2形态:
/// <summary>
/// 2张图片,左右各1个长方形
/// ———————————————————
/// | | |
/// | | |
/// | | |
/// | R1 | R2 |
/// | | |
/// | | |
/// | | |
/// ———————————————————
/// </summary>
MergeProvider.Merge2Images(img1, img2, Merge2LayoutEnum.Merge2R2, 250);
(2)3张图片合并
2.1 Merge1R2S1形态:
/// <summary>
/// 3张图片, 上面一个长方形,下面2个正方形并排
/// ———————————————————
/// | |
/// | R1 |
/// | |
/// ———————————————————
/// | | |
/// | S1 | S2 |
/// | | |
/// ———————————————————
/// </summary>
MergeProvider.Merge3Images(img1, img2, img3, Merge3LayoutEnum.Merge1R2S1, 250);
2.2 Merge1R2S2形态:
/// <summary>
/// 3张图片,上面2个正方形并排,下面一个长方形
/// ———————————————————
/// | | |
/// | S1 | S2 |
/// | | |
/// ———————————————————
/// | |
/// | R1 |
/// | |
/// ———————————————————
/// </summary>
MergeProvider.Merge3Images(img1, img2, img3, Merge3LayoutEnum.Merge1R2S2, 250);
2.3 Merge1R2S3形态:
/// <summary>
/// 3张图片,上面2个正方形并排,下面一个长方形
/// ———————————————————
/// | | |
/// | | S1 |
/// | | |
/// | R1 |—————————
/// | | |
/// | | S2 |
/// | | |
/// ———————————————————
/// </summary>
MergeProvider.Merge3Images(img1, img2, img3, Merge3LayoutEnum.Merge1R2S3, 250);
2.3 Merge1R2S4形态:
/// <summary>
/// 3张图片,上面2个正方形并排,下面一个长方形
/// ———————————————————
/// | | |
/// | S2 | |
/// | | |
/// |—————————| R1 |
/// | | |
/// | S2 | |
/// | | |
/// ———————————————————
/// </summary>
MergeProvider.Merge3Images(img1, img2, img3, Merge3LayoutEnum.Merge1R2S4, 250);
(3)4张图片合并
3.1 Merge4S形态:
/// <summary>
/// 4张图片,上面一个长方形,下面2个正方形并排
/// ———————————————————
/// | | |
/// | S1 | S2 |
/// | | |
/// ———————————————————
/// | | |
/// | S3 | S4 |
/// | | |
/// ———————————————————
/// </summary>
MergeProvider.Merge4Images(img1, img2, img3, img4, Merge4LayoutEnum.Merge4S, 250);