d2dlib
d2dlib copied to clipboard
Effects
Got it working if you are interested:
#include "stdafx.h"
#include "Effect.h"
#include "d2d1effects.h"
#include "d2d1_1.h";
HANDLE CreateEffect(HANDLE ctx, REFCLSID effect)
{
RetrieveContext(ctx);
ID2D1HwndRenderTarget* renderTarget = (ID2D1HwndRenderTarget*) context->renderTarget;
ID2D1Effect* compositeEffect;
ID2D1DeviceContext* deviceContext;
HRESULT hr;
hr = renderTarget->QueryInterface(&deviceContext);
hr = deviceContext->CreateEffect(effect, &compositeEffect);
return (HANDLE)compositeEffect;
}
void SetInput(HANDLE d2dEffect, INT index, HANDLE d2dbitmap, BOOL invalidate)
{
ID2D1Effect* effect = reinterpret_cast<ID2D1Effect*>(d2dEffect);
ID2D1Bitmap* bitmap = reinterpret_cast<ID2D1Bitmap*>(d2dbitmap);
effect->SetInput(index, bitmap, invalidate);
}
@kennetherland Thanks so much! It would be great if you could consider making a PR for this.
#60