简体   繁体   English

如何将Image分成5 * 5个Windows Phone?

[英]How to divide Image into 5*5 pieces Windows phone?

I am developing an application where i have to divide an image into separate images, i have tried with WriteableBitmap , here is my code. 我正在开发一个应用程序,其中我必须将图像分成单独的图像,我已经尝试过WriteableBitmap,这是我的代码。 Is there any better way to achieve the same? 有没有更好的方法可以达到相同目的?

XAML 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>

Code Behind: 背后的代码:

How can i divide the image into 5*5 pieces of equal size 我如何将图像分成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);

You may try to check the DeepZoom 您可以尝试检查DeepZoom

The Deep Zoom (Seadragon) functionality has been available on Silverlight since version 2. It's a techonology that provides the ability to interactively view high-resolution images. 从版本2开始, Deep Zoom(Seadragon)功能已在Silverlight上提供。该技术提供了交互式查看高分辨率图像的功能。 The images need to be prepared using available tools like Deep Zoom Composer and others . 需要使用可用的工具(如Deep Zoom Composer等)来准备图像。 The functionality is provided via the usage of the MultiScaleImage control which is availabe on WP7. 该功能是通过使用WP7上提供的MultiScaleImage控件提供的。 This control is not there by default in your Toolbox in Visual Studio, however you can just right-click on the Toolbox, select "Choose item..." menu and pick the control from the list 默认情况下,Visual Studio中的“工具箱”中没有此控件,但是您可以右键单击“工具箱”,选择“选择项目...”菜单,然后从列表中选择该控件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM