Пример #1
0
    /// <summary>
    /// Creates an <see cref="ID2D1Bitmap"/> instance.
    /// </summary>
    /// <param name="d2D1DeviceContext">The input <see cref="ID2D1DeviceContext"/> instance to use to create the bitmap source.</param>
    /// <param name="wicBitmap">The input <see cref="IWICBitmap"/> to use to create the bitmap source.</param>
    /// <param name="d2D1Effect">The input <see cref="ID2D1Effect"/> to set the source for.</param>
    /// <returns>A new <see cref="ID2D1Bitmap"/> instance.</returns>
    public static unsafe ComPtr <ID2D1Bitmap> CreateD2D1BitmapAndSetAsSource(ID2D1DeviceContext *d2D1DeviceContext, IWICBitmap *wicBitmap, ID2D1Effect *d2D1Effect)
    {
        using ComPtr <ID2D1Bitmap> d2D1BitmapSource = default;

        // Create a source D2D1 bitmap from the WIC bitmap
        d2D1DeviceContext->CreateBitmapFromWicBitmap(
            wicBitmapSource: (IWICBitmapSource *)wicBitmap,
            bitmap: d2D1BitmapSource.GetAddressOf()).Assert();

        d2D1Effect->SetInput(0, (ID2D1Image *)d2D1BitmapSource.Get());

        return(d2D1BitmapSource.Move());
    }
Пример #2
0
 public int CreateWicBitmapRenderTarget(IWICBitmap *target, [NativeTypeName("const D2D1_RENDER_TARGET_PROPERTIES *")] D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, ID2D1RenderTarget **renderTarget)
 {
     return(((delegate * unmanaged <ID2D1Factory5 *, IWICBitmap *, D2D1_RENDER_TARGET_PROPERTIES *, ID2D1RenderTarget **, int>)(lpVtbl[13]))((ID2D1Factory5 *)Unsafe.AsPointer(ref this), target, renderTargetProperties, renderTarget));
 }
 public int CreateFromWICBitmap([NativeTypeName("IWICBitmap *")] IWICBitmap *data, [NativeTypeName("BOOL")] int forceReadOnly, [NativeTypeName("const IID &")] Guid *riid, [NativeTypeName("LPVOID *")] void **ppv)
 {
     return(((delegate * unmanaged <ISoftwareBitmapNativeFactory *, IWICBitmap *, int, Guid *, void **, int>)(lpVtbl[6]))((ISoftwareBitmapNativeFactory *)Unsafe.AsPointer(ref this), data, forceReadOnly, riid, ppv));
 }