我正在尝试使用 Lumia Imaging SDK 的JpegTools.BlendAsync()
方法创建平铺背景。我在循环中调用该方法以合并所有平铺图像。该方法有效,但输出图像中有不需要的线条。这些分隔线出现在单个平铺图像的边界处;合并不干净。
附上我的代码。我在逻辑上做错了什么还是这是 SDK 中的错误?
bitmapSource
是单个图块,jpegSource
是由图块填充的空布局,是bgSize
背景尺寸的大小。
async private static Task<IBuffer> CreateTile(IBuffer jpegSource, IReadableBitmap bitmapSource, Size tileSize, Size bgSize)
{
int outBgWidth = (int)bgSize.Width;
int outBgHeight = (int)bgSize.Height;
int tileWidth = (int)tileSize.Width;
int tileHeight = (int)tileSize.Height;
int currentBgWidth = 0;
int currentBgHeight = 0;
Point blendPosition = new Point(0, 0);
while (currentBgHeight < outBgHeight)
{
while (currentBgWidth < outBgWidth)
{
jpegSource = await JpegTools.BlendAsync(jpegSource, bitmapSource, blendPosition);
blendPosition.X += tileWidth;
currentBgWidth += tileWidth;
}
blendPosition.Y += tileHeight;
currentBgHeight += tileHeight;
currentBgWidth = 0;
blendPosition.X = 0;
}
return jpegSource;
}