Microsoft.Maui.Graphics
Microsoft.Maui.Graphics copied to clipboard
[Bug] Scale() displays nothing on Android when using negative numbers
I've been experimenting with the different transform methods, in a MAUI app on Android. Scale seems to work fine when the arguments are positive. When I switch to using negative arguments, nothing is displayed.
I was really hoping that the standard scaling rules would be applied:
- Values between 0 and 1 decrease the width and height of the scaled object.
- Values greater than 1 increase the width and height of the scaled object.
- Values of 1 indicate that the object is not scaled.
- Negative values flip the scaled object horizontally and vertically.
- Values between 0 and -1 flip the scaled object and decrease its width and height.
- Values less than -1 flip the object and increase its width and height.
- Values of -1 flip the scaled object but do not change its horizontal or vertical size.
canvas.StrokeColor = Colors.Red;
canvas.StrokeSize = 4;
canvas.StrokeDashPattern = new float[] { 2, 2 };
canvas.FontColor = Colors.Blue;
canvas.FontSize = 18;
canvas.DrawRoundedRectangle(50, 50, 80, 20, 5);
canvas.DrawString(".NET MAUI", 50, 50, 80, 20, HorizontalAlignment.Left, VerticalAlignment.Top);
canvas.Scale(2, 2); // Try changing me to (2, -0.5f)
canvas.DrawRoundedRectangle(50, 100, 80, 20, 5);
canvas.DrawString(".NET MAUI", 50, 100, 80, 20, HorizontalAlignment.Left, VerticalAlignment.Top);
I'll need to investigate this, as in my own personal code base this works on Android, so I need to figure out what changed when I extracted this code out.
This issue might be related to #184