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

DrawPath and FillPath throw exception #98

Open
MarkhusGenferei opened this issue Dec 11, 2022 · 2 comments · May be fixed by #102
Open

DrawPath and FillPath throw exception #98

MarkhusGenferei opened this issue Dec 11, 2022 · 2 comments · May be fixed by #102

Comments

@MarkhusGenferei
Copy link
Contributor

Hi, This library is really great !

I am exploring geometries. In a form subclassing D2DForm, the code sample below throws a System.AccessViolationException : 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

What am I doing wrong ?
Thank you

protected override void OnRender(D2DGraphics g)
{
  g.Clear(D2DColor.FromGDIColor(this.BackColor));
  
  using (var rect = this.Device.CreateRectangleGeometry(new D2DRect(10, 10, 20, 20)))
  {
     g.DrawPath(rect, D2DColor.BlueViolet, 1, D2DDashStyle.Dash);
  }
  
  using (var circle = this.Device.CreateEllipseGeometry(new D2DPoint(100, 100), new D2DSize(50, 50)))
  {
     using (var pen = this.Device.CreatePen(D2DColor.BlueViolet, D2DDashStyle.Dash))
     {
	  if (pen != null)
	  {
		  g.DrawPath(circle, pen, 2);
		  g.FillPath(circle, D2DColor.DarkBlue);
	  }
     }
  }
}
@jingwood
Copy link
Owner

jingwood commented Dec 12, 2022

Confirmed that is a bug from CreateRectangleGeometry, please wait for it get fix. Thanks for report!

@MarkhusGenferei
Copy link
Contributor Author

Thank you ! It looks this also apply to ellipse geometries.

MarkhusGenferei added a commit to MarkhusGenferei/d2dlib that referenced this issue Jan 2, 2023
@jingwood jingwood linked a pull request Jan 2, 2023 that will close this issue
jingwood added a commit that referenced this issue Jan 2, 2023
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

Successfully merging a pull request may close this issue.

2 participants