Skip to content

Commit

Permalink
add .size() to Image
Browse files Browse the repository at this point in the history
  • Loading branch information
jprochazk committed Sep 12, 2023
1 parent 39b6877 commit 8d6c60f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/egui/src/widgets/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ impl<'a> Image<'a> {
self.size.get(available_size, image_size)
}

pub fn size(&self) -> Option<Vec2> {
match &self.source {
ImageSource::Texture(texture) => Some(texture.size),
ImageSource::Uri(_) | ImageSource::Bytes(_, _) => None,
}
}

pub fn source(&self) -> &ImageSource<'a> {
&self.source
}
Expand Down

0 comments on commit 8d6c60f

Please sign in to comment.