Esempio n. 1
0
    /// <summary>
    /// Draws a given effect onto a context.
    /// </summary>
    /// <param name="d2D1DeviceContext">The input <see cref="ID2D1DeviceContext"/> instance to use to draw the effect.</param>
    /// <param name="d2D1Effect">The input <see cref="ID2D1Effect"/> to draw.</param>
    public static unsafe void DrawEffect(ID2D1DeviceContext *d2D1DeviceContext, ID2D1Effect *d2D1Effect)
    {
        d2D1DeviceContext->BeginDraw();

        // Draw the image with the effect
        d2D1DeviceContext->DrawImage(
            effect: d2D1Effect,
            targetOffset: null,
            imageRectangle: null,
            interpolationMode: D2D1_INTERPOLATION_MODE.D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
            compositeMode: D2D1_COMPOSITE_MODE.D2D1_COMPOSITE_MODE_SOURCE_COPY);

        d2D1DeviceContext->EndDraw().Assert();
    }
        public void SetInputEffect([NativeTypeName("UINT32")] uint index, [NativeTypeName("ID2D1Effect *")] ID2D1Effect *inputEffect, [NativeTypeName("BOOL")] int invalidate = 1)
        {
            ID2D1Image *output = null;

            if (inputEffect != null)
            {
                inputEffect->GetOutput(&output);
            }

            SetInput(index, output, invalidate);
            if (output != null)
            {
                output->Release();
            }
        }
    public void SetInputEffect([NativeTypeName("UINT32")] uint index, ID2D1Effect *inputEffect, [Optional, DefaultParameterValue(1)] BOOL invalidate)
    {
        ID2D1Image *output = null;

        if (inputEffect != null)
        {
            inputEffect->GetOutput(&output);
        }

        SetInput(index, output, invalidate);
        if (output != null)
        {
            _ = output->Release();
        }
    }
Esempio n. 4
0
 public HRESULT CreateTransformNodeFromEffect(ID2D1Effect *effect, ID2D1TransformNode **transformNode)
 {
     return(((delegate * unmanaged <ID2D1EffectContext2 *, ID2D1Effect *, ID2D1TransformNode **, int>)(lpVtbl[6]))((ID2D1EffectContext2 *)Unsafe.AsPointer(ref this), effect, transformNode));
 }
 public int CreateTransformNodeFromEffect([NativeTypeName("ID2D1Effect *")] ID2D1Effect *effect, [NativeTypeName("ID2D1TransformNode **")] ID2D1TransformNode **transformNode)
 {
     return(((delegate * unmanaged <ID2D1EffectContext2 *, ID2D1Effect *, ID2D1TransformNode **, int>)(lpVtbl[6]))((ID2D1EffectContext2 *)Unsafe.AsPointer(ref this), effect, transformNode));
 }
 internal D2D1EffectDispatchDataLoader(ID2D1Effect *d2D1Effect)
 {
     this.d2D1Effect = d2D1Effect;
 }
Esempio n. 7
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());
    }
Esempio n. 8
0
 public D2D1_EFFECT_INPUT_DESCRIPTION([NativeTypeName("ID2D1Effect *")] ID2D1Effect *effect, [NativeTypeName("UINT32")] uint inputIndex, [NativeTypeName("D2D1_RECT_F")] D2D_RECT_F inputRectangle)
 {
     this = EffectInputDescription(effect, inputIndex, inputRectangle);
 }