public static IComObject <T> D2D1CreateFactory <T>(D2D1_FACTORY_TYPE type = D2D1_FACTORY_TYPE.D2D1_FACTORY_TYPE_MULTI_THREADED, D2D1_FACTORY_OPTIONS?options = null) { var op = new D2D1_FACTORY_OPTIONS(); #if DEBUG //op.debugLevel = D2D1_DEBUG_LEVEL.D2D1_DEBUG_LEVEL_INFORMATION; #endif if (options.HasValue) { op.debugLevel = options.Value.debugLevel; } D2D1CreateFactory(type, typeof(T).GUID, ref op, out object factory).ThrowOnError(); #if DEBUG // this will: // 1) display a message in output // 2) raise a breakpoint if (IntPtr.Size == 8) { var ptr = GetModuleHandle("d2d1.dll"); // d2d1 (00007ffd`d8b00000) // d2d1!g_dimageBreakLevel (00007ffd`d90756ac) => 5756AC // d2d1!g_dimageTraceLevel (00007ffd`d90756b0) => 5756B0 Marshal.WriteInt32(ptr + 0x5756AC, -1); Marshal.WriteInt32(ptr + 0x5756B0, -1); } #endif return(new ComObject <T>((T)factory)); }
public static ComObject <T> D2D1CreateFactory <T>(D2D1_FACTORY_TYPE type = D2D1_FACTORY_TYPE.D2D1_FACTORY_TYPE_MULTI_THREADED, D2D1_FACTORY_OPTIONS?options = null) { var op = new D2D1_FACTORY_OPTIONS(); if (options.HasValue) { op.debugLevel = options.Value.debugLevel; } D2D1CreateFactory(type, typeof(T).GUID, ref op, out object factory).ThrowOnError(); return(new ComObject <T>((T)factory)); }
public static extern HRESULT D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, ref D2D1_FACTORY_OPTIONS pFactoryOptions, [MarshalAs(UnmanagedType.IUnknown)] out object ppIFactory);