public WpfDrawingRenderer(WpfDrawingSettings settings, bool isEmbedded) { _isEmbedded = isEmbedded; _svgRenderer = new WpfRenderingHelper(this); _settings = settings; _interactiveMode = isEmbedded ? SvgInteractiveModes.None : settings.InteractiveMode; }
public WpfDrawingContext(bool isFragment, WpfDrawingSettings settings) { _elementOrder = -1; if (settings == null) { settings = new WpfDrawingSettings(); } var dpiScale = settings.DpiScale; if (dpiScale == null) { var sysParam = typeof(SystemParameters); var dpiXProperty = sysParam.GetProperty("DpiX", BindingFlags.NonPublic | BindingFlags.Static); var dpiYProperty = sysParam.GetProperty("Dpi", BindingFlags.NonPublic | BindingFlags.Static); _dpiX = (int)dpiXProperty.GetValue(null, null); _dpiY = (int)dpiYProperty.GetValue(null, null); } else { _dpiX = dpiScale.PixelsPerInchX; _dpiY = dpiScale.PixelsPerInchY; } _quickBounds = Rect.Empty; _isFragment = isFragment; _settings = settings; _drawStack = new Stack <DrawingGroup>(); _paintContexts = new Dictionary <string, WpfSvgPaintContext>(StringComparer.Ordinal); _baseUrls = new HashSet <string>(StringComparer.OrdinalIgnoreCase); _registeredIds = settings[RegisteredIdKey] as HashSet <string>; if (_registeredIds == null) { _registeredIds = new HashSet <string>(StringComparer.OrdinalIgnoreCase); settings[RegisteredIdKey] = _registeredIds; } var visitors = settings.Visitors; if (visitors != null) { WpfLinkVisitor linkVisitor = visitors.LinkVisitor; if (linkVisitor != null) { _linkVisitor = linkVisitor; } WpfFontFamilyVisitor fontFamilyVisitor = visitors.FontFamilyVisitor; if (fontFamilyVisitor != null) { _fontFamilyVisitor = fontFamilyVisitor; } WpfEmbeddedImageVisitor imageVisitor = visitors.ImageVisitor; if (imageVisitor != null) { _imageVisitor = imageVisitor; } WpfIDVisitor idVisitor = visitors.IDVisitor; if (idVisitor != null) { _idVisitor = idVisitor; } WpfClassVisitor classVisitor = visitors.ClassVisitor; if (classVisitor != null) { _classVisitor = classVisitor; } } _interactiveMode = isFragment ? SvgInteractiveModes.None : settings.InteractiveMode; }