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

[BUG] DrawingView GetImageStream cuts off lines on edge of image #773

Closed
1 task done
Captnwalker1 opened this issue Nov 17, 2022 · 1 comment · Fixed by #788
Closed
1 task done

[BUG] DrawingView GetImageStream cuts off lines on edge of image #773

Captnwalker1 opened this issue Nov 17, 2022 · 1 comment · Fixed by #788
Assignees
Labels
bug Something isn't working

Comments

@Captnwalker1
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

image

DrawingView does not take into account lineWidth when rendering the lines onto a canvas to output image.

Example image was done with lineWidth = 5.

Looks like Min and max of points is being taken to calculate size of canvas, need to add half the width of the linewidth to the min and max.

Expected Behavior

That rendered image would not be cut off at edges and would have smooth lines.

Problem areas highlighted in red.

image

Steps To Reproduce

  1. Call GetImageStream on DrawingView
  2. Render into Image element

Link to public reproduction project repository

https://github.com/Captnwalker1/MauiSignaturePadExample

Environment

- .NET MAUI CommunityToolkit:3.0.0.
- OS: Wub 10 10.0.19044 Build 19044
- .NET MAUI:6.0.486

Anything else?

No response

@Captnwalker1 Captnwalker1 added bug Something isn't working unverified labels Nov 17, 2022
@VladislavAntonyuk VladislavAntonyuk self-assigned this Nov 18, 2022
@Captnwalker1
Copy link
Author

A quick workaround I came up with is to add a clear border line to lines collection before rendering the image:

private DrawingLine MakeBorderLine(List<PointF> points,float lineWidth)
{
    var line = new DrawingLine();
    line.LineColor = Color.FromArgb("00000000");
    line.Points.Add(new PointF(points.Min(x => x.X) + lineWidth,points.Min(y => y.Y) - lineWidth));
    line.Points.Add(new PointF(points.Min(x => x.X) - lineWidth, points.Max(y => y.Y) + lineWidth));
    line.Points.Add(new PointF(points.Max(x => x.X) + lineWidth, points.Min(y => y.Y) - lineWidth));
    line.Points.Add(new PointF(points.Max(x => x.X) + lineWidth, points.Max(y => y.Y) + lineWidth));
    return line;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants