Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects #75

Open
kennetherland opened this issue Nov 14, 2021 · 2 comments
Open

Effects #75

kennetherland opened this issue Nov 14, 2021 · 2 comments

Comments

@kennetherland
Copy link

kennetherland commented Nov 14, 2021

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);
}
@jingwood
Copy link
Owner

jingwood commented Nov 28, 2021

@kennetherland Thanks so much! It would be great if you could consider making a PR for this.

#60

@nikeee
Copy link
Contributor

nikeee commented Oct 30, 2024

I'm facing a problem where I need an effect to use D2D1_BLEND_MODE_MULTIPLY. @kennetherland I know it's been 3 years, but do you still have the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants