当前位置: 首页>>代码示例>>C#>>正文


C# ResizeSettings.getCustomCropSourceRect方法代码示例

本文整理汇总了C#中ResizeSettings.getCustomCropSourceRect方法的典型用法代码示例。如果您正苦于以下问题:C# ResizeSettings.getCustomCropSourceRect方法的具体用法?C# ResizeSettings.getCustomCropSourceRect怎么用?C# ResizeSettings.getCustomCropSourceRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ResizeSettings的用法示例。


在下文中一共展示了ResizeSettings.getCustomCropSourceRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WpfDestinationImageSettings


//.........这里部分代码省略.........
                    }
                    /*else
                    {

                    }*/

                    break;

                //case FitMode.Pad:
                //    wpfImageSettings.DestinationImageHeight = Convert.ToInt32(imageState.layout["image"][3].Y - imageState.layout["image"][0].Y);
                //    wpfImageSettings.DestinationImageWidth = Convert.ToInt32(imageState.layout["image"][1].X - imageState.layout["image"][3].X);
                //    break;

                case FitMode.Stretch:
                    //wpfImageSettings.DestinationImageWidth = Convert.ToInt32(widthToApply);
                    //wpfImageSettings.DestinationImageHeight = Convert.ToInt32(heightToApply);
                    break;

                default:
                    wpfImageSettings.DestinationImageWidth = imageState.originalSize.Width;
                    wpfImageSettings.DestinationImageHeight = imageState.originalSize.Height;
                    break;
            }

            #endregion

            #region -- Manage the allignments --

            switch (settings.Mode)
            {
                case FitMode.None:
                case FitMode.Crop:
                case FitMode.Pad:
                    RectangleF croppedSize = settings.getCustomCropSourceRect(imageState.originalSize);

                    if ((croppedSize.X != 0) || (croppedSize.Y != 0))
                    {
                        wpfImageSettings.OffsetX = -Convert.ToInt32(croppedSize.X);
                        wpfImageSettings.OffsetY = -Convert.ToInt32(croppedSize.Y);

                        wpfImageSettings.DestinationImageCanvasWidth = croppedSize.Right - croppedSize.Left;
                        wpfImageSettings.DestinationImageCanvasHeight = croppedSize.Bottom - croppedSize.Top;
                    }
                    else
                    {
                        wpfImageSettings.OffsetX = imageState.layout["image"][0].X;
                        wpfImageSettings.OffsetY = imageState.layout["image"][0].Y;
                    }

                    //wpfImageSettings.DestinationImageCanvasWidth = imageDest.Width;
                    //wpfImageSettings.DestinationImageCanvasHeight = imageDest.Height;

                    //// In crop or pad I've to calculate the Offsets
                    //switch (settings.Anchor)
                    //{
                    //    case ContentAlignment.BottomCenter:
                    //        wpfImageSettings.OffsetX = (int)Math.Floor((double)(imageState.finalSize.Width - wpfImageSettings.DestinationImageWidth) / 2);
                    //        wpfImageSettings.OffsetY = imageState.finalSize.Height - wpfImageSettings.DestinationImageHeight;
                    //        break;
                    //    case ContentAlignment.BottomLeft:
                    //        wpfImageSettings.OffsetX = 0;
                    //        wpfImageSettings.OffsetY = imageState.finalSize.Height - wpfImageSettings.DestinationImageHeight;
                    //        break;
                    //    case ContentAlignment.BottomRight:
                    //        wpfImageSettings.OffsetX = imageState.finalSize.Width - wpfImageSettings.DestinationImageWidth;
                    //        wpfImageSettings.OffsetY = imageState.finalSize.Height - wpfImageSettings.DestinationImageHeight;
开发者ID:stukalin,项目名称:ImageResizer,代码行数:67,代码来源:WpfBuilderExtensions.cs


注:本文中的ResizeSettings.getCustomCropSourceRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。