Skip to content

[Android][DrawImage]Under Android, canvas. DrawImage is not displayed completely #13639

Open

Description

Description

Under Android, canvas. DrawImage is not displayed completely, and iOS is normal

1677748118396_F9271A76-B0F5-4df9-A610-690C0D5B1C92

The size of the image is equal to the canvas area multiplied by the device density.
`
float density_ = (float)DeviceDisplay.Current.MainDisplayInfo.Density;
if (density_ > 1)
{
graphics_view_.WidthRequest = image.Width / density_;
graphics_view_.HeightRequest = image.Height / density_;
graphics_view_.Invalidate();
}

IImage image = PlatformImage.FromStream(mem_stream);
canvas.DrawImage(image, 0, 0, dirtyRect.Width, dirtyRect.Height);
`

Steps to Reproduce

As shown in https://github.com/gudder/repository/tree/main/MauiAppAndroidDrawImage

Link to public reproduction project repository

https://github.com/gudder/repository/tree/main/MauiAppAndroidDrawImage

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12(API 31)

Did you find any workaround?

No response

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingarea-imageImage loading, sources, cachingplatform/android 🤖s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions