Skip to content

Commit

Permalink
Update image.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 27, 2024
1 parent a0f4faf commit 511343a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/egui/src/widgets/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ impl<'a> Image<'a> {
}
}

#[inline]
pub fn uri(&self) -> Option<&str> {
let mut uri: Option<&str> = match &self.source {
ImageSource::Bytes { uri, .. } | ImageSource::Uri(uri) => Some(uri),
ImageSource::Texture(_) => None,
};

if is_gif_uri(uri.unwrap_or_default()) {
if let Ok((gif_uri, _index)) = decode_gif_uri(uri.unwrap_or_default()) {
uri = Some(gif_uri);
}
}
uri
}

#[inline]
pub fn image_options(&self) -> &ImageOptions {
&self.image_options
Expand Down

0 comments on commit 511343a

Please sign in to comment.