Bombsquad.DynamicMedia.Imaging.BitmapTransforms.CropBitmapTransformerFactory.GetYValue C# (CSharp) Метод

GetYValue() приватный Метод

private GetYValue ( System.Windows.Media.Imaging.BitmapSource bitmapSource, string value ) : int
bitmapSource System.Windows.Media.Imaging.BitmapSource
value string
Результат int
        private int GetYValue(BitmapSource bitmapSource, string value)
        {
            switch (value.ToLower())
            {
                case "top":
                    return 0;

                case "bottom":
                    return bitmapSource.PixelHeight;

                case "center":
                    return bitmapSource.PixelHeight / 2;

                default:
                    var val = int.Parse(value);
                    val = Math.Max(0, val);
                    val = Math.Min(bitmapSource.PixelHeight, val);
                    return val;
            }
        }