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

Add documentation on loading bitmaps on MAUI #2743

Open
juliusdeblaaij opened this issue Sep 13, 2024 · 4 comments
Open

Add documentation on loading bitmaps on MAUI #2743

juliusdeblaaij opened this issue Sep 13, 2024 · 4 comments

Comments

@juliusdeblaaij
Copy link

The problem
When trying to load a bitmap image on MAUI for a symbol style, I keep getting errors that my image cannot be found.
I follow the Beta documentation as i found here:

### BitmapRegion for Bitmap Types

I tried various versions of this method:
myStyle.ImageSource = "embedded://Mapsui.Resources.Images.Pin.svg"
but neither images in the Resources/Images or Resources/Raw folder can be found.

The proposed solution
Please document a example of loading a local image from Resources/Images or Resources/Raw on MAUI.

Alternative solutions
Explain how an embedded:// URL can be used to load a Resources/Image or Resources/Raw.

Additional context
I tried various versions, with or without the assembly name, with our withour Resources etc.

@juliusdeblaaij
Copy link
Author

Here is a bit of trace from debugging the application when it tries to use an ambedded image (png) as an image source:

 Exception: System.Exception: Could not find the embedded resource in the current assemblies. ImageSource: 'embedded://mauireactortest.resources.images.warp_marker.png/'. Other embedded resources in matching assemblies: 

What I find noteworthy as that there are no other embedded resources found either 9even though I have multiple images under Resources/Images)

@inforithmics
Copy link
Contributor

inforithmics commented Sep 14, 2024

You can view the pathes of the embedded images with a tool like dotpeek.

https://www.jetbrains.com/de-de/decompiler/
And the Images should be marked as embbededResource, to be loaded.

@juliusdeblaaij
Copy link
Author

Thank you!
After adding a line like this for each image inside my Csproj:
<EmbeddedResource Include="Resources\Images\left_area_marker.png" /> inside an <ItemGroup>, the image shows correctly.
Is there interest for me to add a description of this to the docs?
I was thinking on this page:
https://github.com/Mapsui/Mapsui/blob/main/docs/general/markdown/imagesource.md
To help out other beginners :)

Kind regards,

Julius

@inforithmics
Copy link
Contributor

Yes would be nice If you could do a pull request or write something for improving the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants