我在 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;
}