2014-10-24 3 views
1

이미지가 9 개 있고 작은 이미지가 9 개 있습니다. 이미지를 9 개로 자르고 9 개의 작은 이미지에 표시하고 싶습니다. Windows Phone 8을 사용합니다. 나에게 줄 수 있니?이미지를 9 개로 자르기 방법

+1

이와 비슷한 것 http://stackoverflow.com/questions/11108661/split-an-image-into-seopli-pan-silverlight-windows-phone –

+0

@ IvanCrojachKaračić : 고맙습니다. 어떤 타입의 sourceBitmap인지 아시오 ??? – Carson

답변

1

sourceBitmap의이 감사 또 다른 예를 들어, 우리가 말할 수 WriteableBitmap

이 XAML

<ScrollViewer> 
    <StackPanel> 
     <Image x:Name="bigImage" Source="/Assets/AlignmentGrid.png"></Image>     
     <Image x:Name="cropImage1"></Image>     
    </StackPanel> 
</ScrollViewer> 

코드에서 다음 (bigImage 우리가 자르고 자하는 이미지입니다) 뒤

using System.Windows.Media.Imaging; 

// using WriteableBitmapEx 
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) 
{ 
    // create a WriteableBitmap with the bigImage as its Source 
    WriteableBitmap wb = new WriteableBitmap((BitmapSource)this.bigImage.Source); 

    // calculate and crop 
    WriteableBitmap crop1 = wb.Crop(0, 0, 100, 100); 

    // set the cropImage1 image to the image that we just crop from the bigger one 
    this.cropImage1.Source = crop1;    
} 

당신이 WriteableBitmapEx (기본적거야 코드 WriteableBitmap을 반환 자신 자르기)를 사용하지 않고 훌륭한 솔루션을 보려면

다음이 웹 페이지는 당신을위한 것입니다 :

Crop Image Implementation (실제로 프로그램을 정말 쉽게, 단지 필요 대수학의 약간의 비트)

+0

@Chubosauurus : 고맙습니다. – Carson

관련 문제