dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.03k stars 1.73k forks source link

Inconsistent Geometry with IDrawable on Windows #5691

Open matt-goldman opened 2 years ago

matt-goldman commented 2 years ago

Description

There seems to be a problem with geometry on Windows. Take the following for example:

canvas.StrokeSize = 4;

canvas.StrokeColor = Colors.Red;
var path = new PathF();
path.MoveTo(0, 100);
path.LineTo(200, 100);
path.Close();

canvas.DrawPath(path);

var bluePath = new PathF();
canvas.StrokeColor = Colors.Blue;
bluePath.MoveTo(100, 105);
bluePath.LineTo(200, 105);
bluePath.Close();

canvas.DrawPath(bluePath); 

canvas.StrokeColor = Colors.Black;
canvas.DrawArc(0, 0, 200, 200, 0, 180, false, false);

Expected result:

image

Figure: Result from above code on Android

Actual result:

image

Figure: Result from above code on Windows

Steps to Reproduce

  1. Create a new .NET MAUI app
  2. Add a class that implements IDrawable
  3. Add and draw paths as described above
  4. Bind the class as the Drawable property of a GraphicsView
  5. Run on Windows

Version with bug

Preview 14 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10.0.19041

Did you find any workaround?

No response

Relevant log output

No response

matt-goldman commented 2 years ago

Additional info: Really strange behaviour here. If I add a second LineTo, it seems to end where expected:

var bluePath = new PathF();
canvas.StrokeColor = Colors.Blue;
bluePath.MoveTo(100, 105);
bluePath.LineTo(200, 105);
bluePath.LineTo(200, 105);
bluePath.Close();

canvas.DrawPath(bluePath);

result:

image
jsuarezruiz commented 2 years ago

@matt-goldman Are you using a GraphicsView and use an IDrawable to draw the content?. Could you attach a small sample where reproduce the issue?

ghost commented 2 years ago

Hi @matt-goldman. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

matt-goldman commented 2 years ago

@jsuarezruiz I've create a repo here that demonstrates the bug: https://github.com/matt-goldman/GraphicsViewBugs.App

I chucked in a couple of other things that I noticed too, happy to open separate issues if you like.

jsuarezruiz commented 2 years ago

@jsuarezruiz I've create a repo here that demonstrates the bug: https://github.com/matt-goldman/GraphicsViewBugs.App

I chucked in a couple of other things that I noticed too, happy to open separate issues if you like.

Thanks Matt!. It seems that the URL does not work for me, is it perhaps a private repository?

ghost commented 2 years ago

Hi @matt-goldman. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

matt-goldman commented 2 years ago

Thanks Matt!. It seems that the URL does not work for me, is it perhaps a private repository?

Oops sorry yes was private. Its public now.

matt-goldman commented 2 years ago

Are you using a GraphicsView and use an IDrawable to draw the content?.

Sorry just realised I didn't answer this. Yes to both.

PureWeen commented 2 years ago

@jsuarezruiz does look ok for you?

jsuarezruiz commented 2 years ago

@jsuarezruiz does look ok for you?

Can reproduce the issues. Really good example, thanks. Are issues in Maui Graphics. In fact there are 2-3 different issues here, so will send PRs in the Maui Graphics repo.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.6.0 Preview 3.0. Repro on Windows 11 with below Project: 5691.zip