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

System.ComponentModel.Win32Exception when set D2D1_STRAIGHTEN_PROP.D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE in Direct2DEffects.CLSID_D2D1Straighten #60

Closed
Charltsing opened this issue Jul 6, 2024 · 3 comments

Comments

@Charltsing
Copy link

Charltsing commented Jul 6, 2024

System.ComponentModel.Win32Exception
HResult=0x80004005
Message=参数错误。
Source=DirectNStandard
StackTrace:
在 DirectN.HRESULT.ThrowOnErrorExcept(IEnumerable`1 exceptedValues, Boolean throwOnError)

在 DirectN.HRESULT.ThrowOnError(Boolean throwOnError)

在 DirectN.ID2D1PropertiesExtensions.SetValue(ID2D1Properties properties, Int32 index, Object value)

在 DirectN.ID2D1PropertiesExtensions.SetValue(IComObject`1 properties, Int32 index, Object value)

捕获

DirectN 1.16.1

How should I set D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE parameters ?

@smourier
Copy link
Owner

smourier commented Jul 7, 2024

Hi,

There's a small bug in extensions methods for boolean value, you can set it more directly like this:

false:

fx.SetValue((int)D2D1_STRAIGHTEN_PROP.D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE,
    D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_BOOL,
    BitConverter.GetBytes(0));

true:

fx.SetValue((int)D2D1_STRAIGHTEN_PROP.D2D1_STRAIGHTEN_PROP_MAINTAIN_SIZE,
    D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_BOOL,
    BitConverter.GetBytes(1));

@Charltsing
Copy link
Author

Charltsing commented Jul 7, 2024

Thanks for your reply.
I am waiting for the bug be fixed in future versions.

@smourier
Copy link
Owner

It should be fixed by latest commit 46512bb

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

No branches or pull requests

2 participants