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

Support .scale-XYZ images on WASM #1780

Closed
1 of 4 tasks
MartinZikmund opened this issue Oct 9, 2019 · 9 comments
Closed
1 of 4 tasks

Support .scale-XYZ images on WASM #1780

MartinZikmund opened this issue Oct 9, 2019 · 9 comments
Assignees
Labels
kind/enhancement New feature or request platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...)
Milestone

Comments

@MartinZikmund
Copy link
Member

What would you like to be added:

Currently images provided with multiple scales don't render on WASM at all:

For example with:

<Image Source="/Assets/Test.png" />

The rendered HTML contains just Test.png, although such image does not actually exist.

This can be resolved using the <img> srcset attribute, which allows us to specify multiple different scales for each image based on pixel density of the display.

Why is this needed:

Scaling on all pixel densities.

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • Windows

Anything else we need to know?

@MartinZikmund MartinZikmund added kind/enhancement New feature or request triage/untriaged Indicates an issue requires triaging or verification labels Oct 9, 2019
@MartinZikmund
Copy link
Member Author

I will try this

@MartinZikmund MartinZikmund added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform and removed triage/untriaged Indicates an issue requires triaging or verification labels Oct 9, 2019
@MartinZikmund MartinZikmund self-assigned this Oct 9, 2019
@MartinZikmund
Copy link
Member Author

MartinZikmund commented Oct 9, 2019

@davidjohnoliver Is there already a built-in way to find out all available .scale- versions of an image or should I implement it from the start?

@davidjohnoliver
Copy link
Contributor

davidjohnoliver commented Oct 10, 2019

@MartinZikmund It's already implemented for the other platforms, you should be able to leverage the existing code: https://github.com/nventive/Uno/blob/5f7131f13b37a5a9809c5cac4b3208a13c549fd4/src/SourceGenerators/Uno.UI.Tasks/Assets/RetargetAssets.cs#L85

GitHub
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

@MartinZikmund
Copy link
Member Author

@davidjohnoliver I was thinking about this and need a confirmation :-) . In case of WASM, I cannot just list all the items in the Assets folder, as the images are referenced "by URL" and when deployed, WASM can't see what's deployed as content file at the server.

This probably means I will have to create a build task (at the same level as RetargetAssets_v0), which will for example generate a list of all image assets in the project (could even be a simple text file), which will then be added to the project as EmbeddedResource, so that it can be later loaded in memory and checked to see if for a given image like "MyImage.png" actually exist its scaled/themed versions - "MyImage.scale-200.png" etc. Is this train of thought correct?

@davidjohnoliver
Copy link
Contributor

@MartinZikmund Sure, it sounds like that approach should work.

@MartinZikmund
Copy link
Member Author

@davidjohnoliver I just thought about one thing - this could potentially be a breaking change if the user calls assembly.GetManifestResourceNames() - normally it would be empty, but now there will be this custom embedded resource. Would this be ok?

@carldebilly
Copy link
Member

We're already using it for a bunch of stuff, specially css and script files... it shouldn't be a problem.

@MartinZikmund
Copy link
Member Author

@carldebilly Awesome, thanks!

@francoistanguay francoistanguay added this to the 3.1 milestone Aug 28, 2020
@MartinZikmund MartinZikmund modified the milestones: 3.1, 3.2 Sep 19, 2020
@agneszitte agneszitte added the project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...) label Sep 21, 2020
@jeromelaban jeromelaban removed this from the 3.2 milestone Oct 19, 2020
ebariche pushed a commit to unoplatform/Uno.Gallery that referenced this issue Nov 3, 2020
## PR Type
What kind of change does this PR introduce?

- Feature

## Description

Add Cards samples

## PR Checklist
Please check if your PR fulfills the following requirements:

- [ ] Interface members are XML documented.
- [ ] Existing XML documentation and comments have been updated.
- [ ] Architecture documents have been updated.
- [X] Tested on iOS.
- [X] Tested on Wasm. (**See known issue below**)
- [X] Tested on Android.
- [X] Tested on UWP.
- [X] Tested in both **Light** and **Dark** themes.

**KNOWN ISSUE FOR WASM: unoplatform/uno#1780

Related work items: #190829
@carldebilly carldebilly added this to the 3.4 milestone Nov 9, 2020
@MartinZikmund MartinZikmund removed this from the 3.4 milestone Dec 8, 2020
@ajpinedam ajpinedam added this to the 3.5 milestone Jan 6, 2021
@jeromelaban
Copy link
Member

Implemented by #3694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/resources 🈷️ Categorizes an issue or PR as relevant to resources and localization (Resources, Assets,...)
Projects
None yet
Development

No branches or pull requests

7 participants