managed-commons / SvgNet

Fork of the SVG library for .NET that makes a GdiGraphics that "draws" on a SVG model
BSD 3-Clause "New" or "Revised" License
84 stars 37 forks source link

Convert SvgGraphics to SvgElement #77

Closed TheNho closed 6 months ago

TheNho commented 6 months ago

Is there any way to convert SvgGraphics to SvgElement or vice versa? I just wan to add SvgImageElement into SvgGraphics to show image in the background of SVG image.

monoman commented 6 months ago

If I understand correctly your question, you should create a Graphics from a bitmap, "draw" on it, them get the bitmap and "copy" it in the final SvgGraphics. Take note that bitmaps are coarse (and slow) approximations on our implementation of SVG drawing, as we basically transform each pixel in the raster format into a small rectangle into the vector format of svg. See the bitmap test source for how to copy the bitmap to the svg.