Skip to content

Instantly share code, notes, and snippets.

@romgrk
Created August 17, 2024 19:24
Show Gist options
  • Save romgrk/26e7b105445c4bcaefe97631853b4c4a to your computer and use it in GitHub Desktop.
Save romgrk/26e7b105445c4bcaefe97631853b4c4a to your computer and use it in GitHub Desktop.
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