Created
August 17, 2024 19:24
-
-
Save romgrk/26e7b105445c4bcaefe97631853b4c4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl eframe::App for MyApp { | |
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { | |
if self.captures.is_none() { | |
self.captures = Some(take_screenshot()); | |
} | |
egui::CentralPanel::default().show(ctx, |ui| { | |
egui::ScrollArea::both().show(ui, |ui| { | |
if let Some(captures) = &self.captures { | |
captures.iter().for_each(|capture| { | |
let color_image = ColorImage::from_rgba_unmultiplied( | |
[ | |
capture.data.width() as usize, | |
capture.data.height() as usize, | |
], capture.data.as_raw() | |
); | |
let texture = ui.ctx().load_texture( | |
capture.title.clone(), | |
color_image, | |
Default::default(), | |
); | |
// what next? | |
}); | |
} | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment