mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-04 08:56:59 +01:00
feat(app,android,ios): a blurred poster where a title has no wide art
A title with no fanart, banner or backdrop drew its poster cropped to the band's shape across the title page and the library's banner: a blown-up slice of the middle of it, which read as broken. Now the poster is squeezed to 64x36 and blurred once when it is fetched, the cache keeps that wash, and it is stretched across the band. The library's banner stands the sharp poster at its right over it. Android blurs the poster it already had (Android 12 and later; older versions decode it tiny), and iOS likewise. METADATA.md also records the quality badges of the commit before.
This commit is contained in:
1 parent
f4c08d03c7
commit
3ebfd1a57b
12 files changed
+182
-19
No files matched your search
@@ -107,7 +107,9 @@ impl Art<'_> {
|
||||
}
|
||||
|
||||
/// Art for a strip across the whole window, at full size: fanart, else
|
||||
/// AniList's banner, else whatever [`Art::of`] has.
|
||||
/// AniList's banner, else the poster blurred into a wash of its colours —
|
||||
/// see [`crate::engine::Engine::request_ambient`] — else whatever
|
||||
/// [`Art::of`] has.
|
||||
///
|
||||
/// Its own texture rather than the tile's: a 640 px tile picture
|
||||
/// stretched to a 1600 px hero is soft, and a 1920 px one in every tile
|
||||
@@ -128,10 +130,35 @@ impl Art<'_> {
|
||||
{
|
||||
return Some((texture, ArtShape::Landscape));
|
||||
}
|
||||
} else if let Some(url) = self.poster_url(title) {
|
||||
let key = ambient_key(&title.key);
|
||||
let engine = self.engine;
|
||||
if let Some(texture) = self
|
||||
.posters
|
||||
.texture(&key, || engine.request_ambient(key.clone(), url))
|
||||
{
|
||||
return Some((texture, ArtShape::Landscape));
|
||||
}
|
||||
}
|
||||
self.of(title)
|
||||
}
|
||||
|
||||
/// Whether `title` has a picture made for a strip across the window, rather
|
||||
/// than [`Art::wide`] standing one in.
|
||||
pub fn has_wide_art(&self, title: &Title) -> bool {
|
||||
self.metadata
|
||||
.get(&title.key)
|
||||
.and_then(|record| record.metadata.as_ref())
|
||||
.is_some_and(|metadata| metadata.wide_art().is_some())
|
||||
}
|
||||
|
||||
fn poster_url(&self, title: &Title) -> Option<String> {
|
||||
self.metadata
|
||||
.get(&title.key)
|
||||
.and_then(|record| record.metadata.as_ref())
|
||||
.and_then(|metadata| metadata.poster_url.clone())
|
||||
}
|
||||
|
||||
/// The title's name as lettering, trimmed to it, when the provider has
|
||||
/// one and it has arrived. Drawn over wide art in place of the name.
|
||||
pub fn logo(&mut self, title: &Title) -> Option<egui::TextureHandle> {
|
||||
@@ -187,6 +214,11 @@ pub fn wide_key(title_key: &str) -> String {
|
||||
format!("wide:{title_key}")
|
||||
}
|
||||
|
||||
/// The texture key of a title's poster blurred for a band.
|
||||
pub fn ambient_key(title_key: &str) -> String {
|
||||
format!("ambient:{title_key}")
|
||||
}
|
||||
|
||||
/// A title's logo in place of its name in Display type, when there is one to
|
||||
/// draw; `None` leaves the caller to set the name as it does.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user