Svg.SvgRenderer.DrawImage C# (CSharp) Method

DrawImage() public method

public DrawImage ( Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit ) : void
image Image
destRect System.Drawing.RectangleF
srcRect System.Drawing.RectangleF
graphicsUnit GraphicsUnit
return void
        public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit)
        {
            _innerGraphics.DrawImage(image, destRect, srcRect, graphicsUnit);
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
        /// </summary>
        protected override void Render(SvgRenderer renderer)
        {
            if (!Visible || !Displayable)
            {
                return;
            }

            if (Width.Value > 0.0f && Height.Value > 0.0f && this.Href != null)
            {
                using (Image b = GetImage(this.Href))
                {
                    if (b != null)
                    {
                        this.PushTransforms(renderer);
                        this.SetClip(renderer);

                        RectangleF srcRect  = new RectangleF(0, 0, b.Width, b.Height);
                        var        destRect = new RectangleF(this.Location.ToDeviceValue(),
                                                             new SizeF(Width.ToDeviceValue(), Height.ToDeviceValue()));

                        renderer.DrawImage(b, destRect, srcRect, GraphicsUnit.Pixel);

                        this.ResetClip(renderer);
                        this.PopTransforms(renderer);
                    }
                }
                // TODO: cache images... will need a shared context for this
                // TODO: support preserveAspectRatio, etc
            }
        }
All Usage Examples Of Svg.SvgRenderer::DrawImage