[英]How to divide Image into 5*5 pieces Windows phone?
我正在开发一个应用程序,其中我必须将图像分成单独的图像,我已经尝试过WriteableBitmap,这是我的代码。 有没有更好的方法可以达到相同目的?
XAML
<Grid Name="gridCollague" HorizontalAlignment="Left" Height="473" Margin="10,0,0,0" VerticalAlignment="Top" Width="446">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
</Grid>
背后的代码:
我如何将图像分成5 * 5大小相等的片段
int halfWidth = wb.PixelWidth / 5;
int halfHeight = wb.PixelHeight / 5;
WriteableBitmap img1 = wb.Crop(0, 0, halfWidth, halfHeight);
WriteableBitmap img2 = wb.Crop(halfWidth, 0, halfWidth, halfHeight);
WriteableBitmap img3 = wb.Crop(0, halfHeight, halfWidth, halfHeight);
WriteableBitmap img4 = wb.Crop(halfWidth, halfHeight, halfWidth, halfHeight);
您可以尝试检查DeepZoom
从版本2开始, Deep Zoom(Seadragon)功能已在Silverlight上提供。该技术提供了交互式查看高分辨率图像的功能。 需要使用可用的工具(如Deep Zoom Composer等)来准备图像。 该功能是通过使用WP7上提供的MultiScaleImage控件提供的。 默认情况下,Visual Studio中的“工具箱”中没有此控件,但是您可以右键单击“工具箱”,选择“选择项目...”菜单,然后从列表中选择该控件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.