-
Notifications
You must be signed in to change notification settings - Fork 473
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
Size of an image cannot be set using DrawingView.GetImageBytes(). No matter what value you give in the Size param, the behavior is the same. The image stream does not size the image to the given size, and it is ALWAYS "shrink-to-fit" the actual dimensions of the drawn lines (whatever that size is), rather than the specified size.
Expected Behavior
EXPECTED:
Here is the 200x200 control with a small dark blue shape drawn in the middle. The image stream (or saved file) should appear like this:

Actual:
Here is the result of the stream (or saved file) after GetImageBytes() is processed:

Steps To Reproduce
- Add a DrawingView onto a Xaml page
- Set
HeightRequest="200" WidthRequest="200" - Add a DrawingLineCompleted method
- In the method, capture the lines that were drawn, and specify the same 200x200 size
var dvStream = await DrawingView.GetImageStream(drawView.Lines, new Size(200,200), Colors.LightBlue); - Add code to stream that image back to another control on page, or save to an image file on disk
- Run the app and draw a small shape on the canvas (something only 10-20px wide)
- Look at the resulting image
Link to public reproduction project repository
https://github.com/dapug/DrawingDemo
Environment
- .NET MAUI CommunityToolkit: 5.2.0 and 5.3.0
- OS: Win 10 Build 19045.3324
- .NET MAUI:
runtimes-windows 7.0.5/7.0.100 VS 17.7.33711.374
android 33.0.46/7.0.100 VS 17.7.33711.374
maui-windows 7.0.86/7.0.100 VS 17.7.33711.374
maui-maccatalyst 7.0.86/7.0.100 VS 17.7.33711.374
maccatalyst 16.4.7060/7.0.100 VS 17.7.33711.374
maui-ios 7.0.86/7.0.100 VS 17.7.33711.374
ios 16.4.7060/7.0.100 VS 17.7.33711.374
maui-android 7.0.86/7.0.100 VS 17.7.33711.374Anything else?
There is a detailed discussion about this here: #729
Supposedly, a fix was made in toolkit v5.0.0, however, I am finding that NOT to be the case, no change. Issue still persists.
See commit: 48e7831