public WpfDrawingContext(bool isFragment, WpfDrawingSettings settings) { 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); if (settings == null) { settings = new WpfDrawingSettings(); } _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; } } }
public WpfDrawingContext(bool isFragment, WpfDrawingSettings settings) { if (settings == null) { settings = new WpfDrawingSettings(); } _quickBounds = Rect.Empty; _isFragment = isFragment; _settings = settings; _drawStack = new Stack <DrawingGroup>(); _paintContexts = new Dictionary <string, WpfSvgPaintContext>(StringComparer.Ordinal); _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; } } }