2

Windows 8 アプリでの画像トリミングについて Microsoft からこのソリューションに遭遇しましたが、必要なのは、ユーザーに特定の比率 (例: 1:1、4:3) にトリミングすることです。提案/またはより良い解決策は利用可能?

事前にどうもありがとうございました。

これが解決策です(この解決策により、ユーザーはx、yで自由にトリミングできます) http://code.msdn.microsoft.com/windowsapps/CSWin8AppCropBitmap-52fa1ad7/sourcecode?fileId=70609&pathId=1727496808

http://code.msdn.microsoft.com/windowsapps/CSWin8AppCropBitmap-52fa1ad7

/// <summary> 
    /// If a pointer which is captured by the corner moves,the select region will be updated. 
    /// </summary> 
    void Corner_PointerMoved(object sender, PointerRoutedEventArgs e) 
    { 

        Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(this); 
        uint ptrId = pt.PointerId; 

        if (pointerPositionHistory.ContainsKey(ptrId) && pointerPositionHistory[ptrId].HasValue) 
        { 
            Point currentPosition = pt.Position; 
            Point previousPosition = pointerPositionHistory[ptrId].Value; 

            double xUpdate = currentPosition.X - previousPosition.X; 
            double yUpdate = currentPosition.Y - previousPosition.Y; 

            this.selectedRegion.UpdateCorner((sender as ContentControl).Tag as string, xUpdate, yUpdate); 

            pointerPositionHistory[ptrId] = currentPosition; 
        } 

        e.Handled = true; 
    } 
4

0 に答える 0