/// <summary>
    /// Register a <see cref="ID2D1EffectImpl"/>.
    /// </summary>
    /// <typeparam name="T">Type of </typeparam>
    /// <param name="effectId"></param>
    public void RegisterEffect <T>(Guid effectId) where T : ID2D1EffectImpl, new()
    {
        lock (_customEffectFactories)
        {
            if (_customEffectFactories.ContainsKey(effectId))
            {
                return;
            }

            var factory = new CustomEffectFactory(typeof(T), () => new T());
            _customEffectFactories.Add(effectId, factory);
            RegisterEffectFromString(effectId, factory.GetXML(), factory.GetBindings(), factory.Callback);
        }
    }
    /// <summary>
    /// Register a <see cref="ID2D1EffectImpl"/> factory.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="effectFactory"></param>
    /// <param name="effectId"></param>
    public void RegisterEffect <T>(Func <T> effectFactory, Guid effectId) where T : ID2D1EffectImpl
    {
        CustomEffectFactory factory;

        lock (_customEffectFactories)
        {
            if (_customEffectFactories.ContainsKey(effectId))
            {
                throw new ArgumentException("An effect is already registered with this GUID", nameof(effectFactory));
            }

            factory = new CustomEffectFactory(typeof(T), () => effectFactory());
            _customEffectFactories.Add(effectId, factory);
        }
        RegisterEffectFromString(effectId, factory.GetXML(), factory.GetBindings(), factory.Callback);
    }