Пример #1
0
        private static double ScaleFactor(double value, Orientation orientation)
        {
            //This is a guard against possible unset scale value (which shouldn't happen)
            if (HostUtils.IsZero(value))
            {
                value = 1.0;
            }

            return(value * HostUtils.PixelsPerInch(orientation) / systemWindowsPixelsPerInch);
        }
Пример #2
0
        internal static RenderTargetBitmap GetRenderTargetBitmapForVisual(int width, int height, Visual visualToRender)
        {
            if (width < 1 || height < 1)
            {
                return(null);
            }
            RenderTargetBitmap bmp = new RenderTargetBitmap(
                width,
                height,
                HostUtils.PixelsPerInch(Orientation.Horizontal),
                HostUtils.PixelsPerInch(Orientation.Vertical),
                PixelFormats.Pbgra32);

            bmp.Render(visualToRender);
            return(bmp);
        }