C# 将图像分割为若干部分silverlight windows phone
我想使用silverlight for windows phone 7.5将图像分割为几个较小的图像 首先,我想知道这是否有可能,最近我在windows phone API中遇到了一些令人不快的意外,如果有,请给我举一些例子,因为我完全找不到C# 将图像分割为若干部分silverlight windows phone,c#,silverlight,image,windows-phone-7,split,C#,Silverlight,Image,Windows Phone 7,Split,我想使用silverlight for windows phone 7.5将图像分割为几个较小的图像 首先,我想知道这是否有可能,最近我在windows phone API中遇到了一些令人不快的意外,如果有,请给我举一些例子,因为我完全找不到 感谢您的帮助。您可以将silverlight项目与XNA结合使用spritebatch.Draw。 它有一个用于源矩形的参数,用于从图像中绘制零件 MSDN对如何结合silverlight和XNA提供了一些帮助。 您可以将silverlight项目与XNA
感谢您的帮助。您可以将silverlight项目与XNA结合使用spritebatch.Draw。 它有一个用于源矩形的参数,用于从图像中绘制零件 MSDN对如何结合silverlight和XNA提供了一些帮助。
您可以将silverlight项目与XNA结合使用spritebatch.Draw。 它有一个用于源矩形的参数,用于从图像中绘制零件 MSDN对如何结合silverlight和XNA提供了一些帮助。
组合ScaleTransform和TranslateTransform以呈现正确的部分 缩放转换格式numXTiles,numYTiles 翻译xTileIndex/numXTiles、yTileIndex/numYTiles
将ImageControl放置在网格中以进行剪裁组合ScaleTransform和TranslateTransform以渲染正确的部分 缩放转换格式numXTiles,numYTiles 翻译xTileIndex/numXTiles、yTileIndex/numYTiles 将ImageControl放置在网格中进行剪裁与Windows Phone兼容,并且有一种裁剪方法来精确地进行剪裁。你只需要做数学运算,计算出要裁剪的宽/高和X/Y坐标
//this creates the four quadrants of sourceBitmap as new bitmaps
int halfWidth = sourceBitmap.PixelWidth / 2;
int halfHeight = sourceBitmap.PixelHeight / 2;
WriteableBitmap topLeft = sourceBitmap.Crop(0, 0, halfWidth, halfHeight);
WriteableBitmap topRight = sourceBitmap.Crop(halfWidth, 0, halfWidth, halfHeight);
WriteableBitmap bottomLeft = sourceBitmap.Crop(0, halfHeight, halfWidth, halfHeight);
WriteableBitmap bottomRight = sourceBitmap.Crop(halfWidth, halfHeight, halfWidth, halfHeight);
在上面的示例中,我没有测试过像素,但它应该演示API。与Windows Phone兼容,并且有一个裁剪方法来实现这一点。你只需要做数学运算,计算出要裁剪的宽/高和X/Y坐标
//this creates the four quadrants of sourceBitmap as new bitmaps
int halfWidth = sourceBitmap.PixelWidth / 2;
int halfHeight = sourceBitmap.PixelHeight / 2;
WriteableBitmap topLeft = sourceBitmap.Crop(0, 0, halfWidth, halfHeight);
WriteableBitmap topRight = sourceBitmap.Crop(halfWidth, 0, halfWidth, halfHeight);
WriteableBitmap bottomLeft = sourceBitmap.Crop(0, halfHeight, halfWidth, halfHeight);
WriteableBitmap bottomRight = sourceBitmap.Crop(halfWidth, halfHeight, halfWidth, halfHeight);
在我上面的例子中,我没有测试过一个像素,但它应该演示API