Exemplo n.º 1
0
        /// <inheritdoc />
        public IRenderTargetBitmapImpl CreateRenderTargetBitmap(
            int width,
            int height,
            double dpiX,
            double dpiY)
        {
            if (width < 1)
            {
                throw new ArgumentException("Width can't be less than 1", nameof(width));
            }

            if (height < 1)
            {
                throw new ArgumentException("Height can't be less than 1", nameof(height));
            }

            var dpi = new Vector(dpiX, dpiY);

            var createInfo = new SurfaceRenderTarget.CreateInfo
            {
                Width  = width,
                Height = height,
                Dpi    = dpi,
                DisableTextLcdRendering = false
            };

            return(new SurfaceRenderTarget(createInfo));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create new render target compatible with this drawing context.
        /// </summary>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        /// <param name="dpi">Drawing dpi.</param>
        /// <param name="format">Pixel format.</param>
        /// <returns></returns>
        private SurfaceRenderTarget CreateRenderTarget(int width, int height, Vector dpi, PixelFormat?format = null)
        {
            var createInfo = new SurfaceRenderTarget.CreateInfo
            {
                Width  = width,
                Height = height,
                Dpi    = dpi,
                Format = format,
                DisableTextLcdRendering = !_canTextUseLcdRendering
            };

            return(new SurfaceRenderTarget(createInfo));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create new render target compatible with this drawing context.
        /// </summary>
        /// <param name="size">The size of the render target in DIPs.</param>
        /// <param name="format">Pixel format.</param>
        /// <returns></returns>
        private SurfaceRenderTarget CreateRenderTarget(Size size, PixelFormat?format = null)
        {
            var pixelSize  = PixelSize.FromSizeWithDpi(size, _dpi);
            var createInfo = new SurfaceRenderTarget.CreateInfo
            {
                Width  = pixelSize.Width,
                Height = pixelSize.Height,
                Dpi    = _dpi,
                Format = format,
                DisableTextLcdRendering = !_canTextUseLcdRendering,
                GrContext = _grContext
            };

            return(new SurfaceRenderTarget(createInfo));
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi)
        {
            if (size.Width < 1)
            {
                throw new ArgumentException("Width can't be less than 1", nameof(size));
            }

            if (size.Height < 1)
            {
                throw new ArgumentException("Height can't be less than 1", nameof(size));
            }

            var createInfo = new SurfaceRenderTarget.CreateInfo
            {
                Width  = size.Width,
                Height = size.Height,
                Dpi    = dpi,
                DisableTextLcdRendering = false
            };

            return(new SurfaceRenderTarget(createInfo));
        }