From: Alfred Agrell floating@muncher.se
--- dlls/d2d1/effect.c | 35 ++++++++++++++++++++++++++++++++++ dlls/d2d1/tests/d2d1.c | 42 +++++++++++++++++++++++++++++++++++++++++ include/d2d1effects.idl | 6 ++++++ 3 files changed, 83 insertions(+)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index a49715b5ce5..51b003c02d7 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -1693,6 +1693,40 @@ static HRESULT __stdcall directional_blur_factory(IUnknown **effect) return d2d_effect_create_impl(effect, &properties, sizeof(properties)); }
+static const WCHAR hue_rotation_description[] = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string' value='Hue Rotation'/> \ + <Property name='Author' type='string' value='The Wine Project'/> \ + <Property name='Category' type='string' value='Stub'/> \ + <Property name='Description' type='string' value='Hue Rotation'/> \ + <Inputs> \ + <Input name='Source'/> \ + </Inputs> \ + <Property name='Angle' type='float' /> \ + </Effect>"; + +struct hue_rotation_properties +{ + float angle; +}; + +EFFECT_PROPERTY_RW(hue_rotation, angle, FLOAT) + +static const D2D1_PROPERTY_BINDING hue_rotation_bindings[] = +{ + { L"Angle", BINDING_RW(hue_rotation, angle) }, +}; + +static HRESULT __stdcall hue_rotation_factory(IUnknown **effect) +{ + static const struct hue_rotation_properties properties = + { + .angle = 0.0f, + }; + return d2d_effect_create_impl(effect, &properties, sizeof(properties)); +} + void d2d_effects_init_builtins(struct d2d_factory *factory) { static const struct builtin_description @@ -1721,6 +1755,7 @@ void d2d_effects_init_builtins(struct d2d_factory *factory) { &CLSID_D2D1Blend, X2(blend) }, { &CLSID_D2D1Brightness, X2(brightness) }, { &CLSID_D2D1DirectionalBlur, X2(directional_blur) }, + { &CLSID_D2D1HueRotation, X2(hue_rotation) }, #undef X2 #undef X }; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 10bf725320a..16196d93fcf 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -14128,6 +14128,47 @@ static void test_effect_directional_blur(BOOL d3d11) release_test_context(&ctx); }
+static void test_effect_hue_rotation(BOOL d3d11) +{ + static const struct effect_property properties[] = + { + { L"Angle", D2D1_HUEROTATION_PROP_ANGLE, D2D1_PROPERTY_TYPE_FLOAT }, + }; + float f; + struct d2d1_test_context ctx; + ID2D1DeviceContext *context; + unsigned int count, i; + ID2D1Effect *effect; + WCHAR name[64]; + HRESULT hr; + + if (!init_test_context(&ctx, d3d11)) + return; + + context = ctx.context; + + hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1HueRotation, &effect); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + check_system_properties(effect); + + count = ID2D1Effect_GetPropertyCount(effect); + ok(count == 1, "Got unexpected property count %u.\n", count); + + for (i = 0; i < ARRAY_SIZE(properties); ++i) + { + hr = ID2D1Effect_GetPropertyName(effect, properties[i].index, name, 64); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(name, properties[i].name), "Unexpected name %s.\n", wine_dbgstr_w(name)); + } + + f = effect_get_float_prop(effect, D2D1_HUEROTATION_PROP_ANGLE); + ok(f == 0.0f, "got %f.\n", f); + + ID2D1Effect_Release(effect); + release_test_context(&ctx); +} + static void test_registered_effects(BOOL d3d11) { UINT32 ret, count, count2, count3; @@ -17513,6 +17554,7 @@ START_TEST(d2d1) queue_test(test_effect_blend); queue_test(test_effect_brightness); queue_test(test_effect_directional_blur); + queue_test(test_effect_hue_rotation); queue_test(test_transform_graph); queue_test(test_offset_transform); queue_test(test_blend_transform); diff --git a/include/d2d1effects.idl b/include/d2d1effects.idl index ad843a9344d..93876229138 100644 --- a/include/d2d1effects.idl +++ b/include/d2d1effects.idl @@ -264,3 +264,9 @@ typedef enum D2D1_DIRECTIONALBLUR_OPTIMIZATION D2D1_DIRECTIONALBLUR_OPTIMIZATION_QUALITY = 2, D2D1_DIRECTIONALBLUR_OPTIMIZATION_FORCE_DWORD = 0xffffffff } D2D1_DIRECTIONALBLUR_OPTIMIZATION; + +typedef enum D2D1_HUEROTATION_PROP +{ + D2D1_HUEROTATION_PROP_ANGLE = 0, + D2D1_HUEROTATION_PROP_FORCE_DWORD = 0xffffffff +} D2D1_HUEROTATION_PROP;