-
Notifications
You must be signed in to change notification settings - Fork 401
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
DrawingView.GetImageStream Size has no affect #1397
Comments
it is not the size of the image. you specify Maximum image size. The image will be resized proportionally. |
OK, can you please explain how it is possible then, to specify the actual size the resulting image should be? The way it is implemented right now makes it pretty much useless, as the resulting image dimensions will never be defined or able to be set (and very much needs to be). The goal is not to capture only the minimum area containing the actual drawn lines, but the total area that the user was given to draw the lines in the first place. |
I agree with @dapug. Resizing the image to get only the minimum area containing the drawn line looks like a very specific case. |
It does look like we have an inconsistency in our XML documentation that would lead to this confusion: DrawingView.shared.cs
DrawingViewService.macios.csMaui/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs Line 16 in 02896d3
I can personally see a benefit for both use cases. I will reopen this and we can discuss it later during the standup |
The keyword here is Desired. So to make it clear size 200x200 is the maximum size of the image. but because drawing image may differ (e.g. 100x300), we proportionally change your size to this. So the final size is approximately 66x200. |
I have no problem with that functionality, BUT... The API provides NO way to access the 66x200 resulting dimensions, and therefore one cannot, ever, reconstitute the 200x200 (or 100x300, etc) original image and place the lines appropriately in it as it was when drawn. So the result does indeed do as you said, but ultimately is useless in real life application because one cannot ever retain the original backdrop/canvas size, nor can we even know what the dimension result was so that we can reconstruct an image back to original ourselves. The user of the API needs the option to: |
I agree, we should be able to get the image of the full drawingview area. |
@dapug @nourben and @ricavir11 I have opened #2193 which include a PoC for supporting it on iOS. Do you think this would work for your needs? |
@bijington : yes, this would be a good solution |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
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
HeightRequest="200" WidthRequest="200"
var dvStream = await DrawingView.GetImageStream(drawView.Lines, new Size(200,200), Colors.LightBlue);
Link to public reproduction project repository
https://github.com/dapug/DrawingDemo
Environment
Anything 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
The text was updated successfully, but these errors were encountered: