Automatically generate screenshots for all examples (#2379)
@@ -9,4 +9,6 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example how to show a confirm dialog before exiting an application.
|
||||
|
||||
```sh
|
||||
cargo run -p confirm_exit
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/confirm_exit/screenshot.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
@@ -3,7 +3,10 @@
|
||||
use eframe::egui;
|
||||
|
||||
fn main() {
|
||||
let options = eframe::NativeOptions::default();
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
"Confirm exit",
|
||||
options,
|
||||
|
||||
@@ -9,6 +9,8 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe", features = ["glow"] }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_glow = { path = "../../crates/egui_glow" }
|
||||
glow = "0.11"
|
||||
|
||||
@@ -13,3 +13,5 @@ If you are content of having egui sit on top of a 3D background, take a look at:
|
||||
```sh
|
||||
cargo run -p custom_3d_glow
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/custom_3d_glow/screenshot.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
@@ -11,7 +11,9 @@ publish = false
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe", features = ["glow"] }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_glow = { path = "../../crates/egui_glow" }
|
||||
glow = "0.11"
|
||||
three-d = { version = "0.13", default-features = false }
|
||||
|
||||
@@ -18,3 +18,5 @@ cargo run -p custom_3d_three-d
|
||||
```
|
||||
wasm-pack build examples/custom_3d_three-d --target web
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/custom_3d_three-d/screenshot.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
@@ -9,4 +9,6 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example of how to use custom fonts.
|
||||
|
||||
```sh
|
||||
cargo run -p custom_font
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/custom_font/screenshot.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
@@ -3,7 +3,10 @@
|
||||
use eframe::egui;
|
||||
|
||||
fn main() {
|
||||
let options = eframe::NativeOptions::default();
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
"egui example: custom font",
|
||||
options,
|
||||
|
||||
@@ -9,4 +9,6 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Example how to define custom test styles.
|
||||
|
||||
```sh
|
||||
cargo run -p custom_font_style
|
||||
```
|
||||

|
||||
|
||||

|
||||
|
||||
|
Before Width: | Height: | Size: 75 KiB |
BIN
examples/custom_font_style/screenshot.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
@@ -9,4 +9,6 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example how to show a custom window frame instead of the default OS window chrome decorations.
|
||||
|
||||
```sh
|
||||
cargo run -p custom_window_frame
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/custom_window_frame/screenshot.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
@@ -11,6 +11,7 @@ fn main() {
|
||||
// To have rounded corners we need transparency:
|
||||
transparent: true,
|
||||
min_window_size: Some(egui::vec2(320.0, 100.0)),
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
|
||||
@@ -9,7 +9,9 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_extras = { path = "../../crates/egui_extras", features = ["image"] }
|
||||
ehttp = "0.2"
|
||||
image = { version = "0.24", default-features = false, features = ["jpeg"] }
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example how to download and show an image with eframe/egui.
|
||||
|
||||
```sh
|
||||
cargo run -p download_image
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/download_image/screenshot.png
Normal file
|
After Width: | Height: | Size: 353 KiB |
@@ -9,5 +9,7 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
rfd = "0.10"
|
||||
|
||||
@@ -3,3 +3,5 @@ How to show a file dialog using [`rfd`](https://github.com/PolyMeilex/rfd).
|
||||
```sh
|
||||
cargo run -p file_dialog
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/file_dialog/screenshot.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
@@ -5,6 +5,7 @@ use eframe::egui;
|
||||
fn main() {
|
||||
let options = eframe::NativeOptions {
|
||||
drag_and_drop_support: true,
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
|
||||
@@ -9,5 +9,7 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example showing some UI controls like `Label`, `TextEdit`, `Slider`, `Button`.
|
||||
|
||||
```sh
|
||||
cargo run -p hello_world
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/hello_world/screenshot.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
@@ -6,7 +6,10 @@ fn main() {
|
||||
// Log to stdout (if you run with `RUST_LOG=debug`).
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let options = eframe::NativeOptions::default();
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
"My egui App",
|
||||
options,
|
||||
|
||||
@@ -9,5 +9,7 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
```sh
|
||||
cargo run -p hello_world
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/keyboard_events/screenshot.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
@@ -9,6 +9,8 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe", features = ["puffin"] }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
puffin = "0.14"
|
||||
puffin_http = "0.11"
|
||||
|
||||
@@ -7,3 +7,5 @@ cargo run -p puffin_profiler &
|
||||
cargo install puffin_viewer
|
||||
puffin_viewer --url 127.0.0.1:8585
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/puffin_profiler/screenshot.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
@@ -9,6 +9,8 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_extras = { path = "../../crates/egui_extras", features = ["image"] }
|
||||
image = { version = "0.24", default-features = false, features = ["png"] }
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example how to show an image with eframe/egui.
|
||||
|
||||
```sh
|
||||
cargo run -p retained_image
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/retained_image/screenshot.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
@@ -5,7 +5,7 @@ use egui_extras::RetainedImage;
|
||||
|
||||
fn main() {
|
||||
let options = eframe::NativeOptions {
|
||||
initial_window_size: Some(egui::vec2(500.0, 900.0)),
|
||||
initial_window_size: Some(egui::vec2(300.0, 900.0)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_extras = { path = "../../crates/egui_extras", features = ["image"] }
|
||||
itertools = "0.10.3"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Example how to take screenshots and display them with eframe/egui.
|
||||
|
||||
```sh
|
||||
cargo run -p screenshot
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/screenshot/screenshot.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
@@ -74,23 +74,25 @@ impl eframe::App for MyApp {
|
||||
|
||||
self.take_screenshot = false;
|
||||
if let Some(gl) = frame.gl() {
|
||||
let mut buf = vec![0u8; screen_size_px[0] as usize * screen_size_px[1] as usize * 4];
|
||||
let [w, h] = screen_size_px;
|
||||
let mut buf = vec![0u8; w as usize * h as usize * 4];
|
||||
let pixels = glow::PixelPackData::Slice(&mut buf[..]);
|
||||
unsafe {
|
||||
gl.read_pixels(
|
||||
0,
|
||||
0,
|
||||
screen_size_px[0] as i32,
|
||||
screen_size_px[1] as i32,
|
||||
w as i32,
|
||||
h as i32,
|
||||
glow::RGBA,
|
||||
glow::UNSIGNED_BYTE,
|
||||
pixels,
|
||||
);
|
||||
}
|
||||
|
||||
// Flip vertically:
|
||||
let mut rows: Vec<Vec<u8>> = buf
|
||||
.into_iter()
|
||||
.chunks(screen_size_px[0] as usize * 4)
|
||||
.chunks(w as usize * 4)
|
||||
.into_iter()
|
||||
.map(|chunk| chunk.collect())
|
||||
.collect();
|
||||
|
||||
@@ -9,4 +9,6 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
|
||||
@@ -6,3 +6,5 @@ See also <https://github.com/emilk/egui/issues/1918>.
|
||||
```sh
|
||||
cargo run -p serial_windows
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/serial_windows/screenshot.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
@@ -9,6 +9,7 @@ fn main() {
|
||||
|
||||
let options = eframe::NativeOptions {
|
||||
run_and_return: true,
|
||||
initial_window_size: Some(egui::vec2(320.0, 240.0)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -9,5 +9,7 @@ publish = false
|
||||
|
||||
|
||||
[dependencies]
|
||||
eframe = { path = "../../crates/eframe" }
|
||||
eframe = { path = "../../crates/eframe", features = [
|
||||
"__screenshot", # __screenshot is so we can dump a ascreenshot using EFRAME_SCREENSHOT_TO
|
||||
] }
|
||||
egui_extras = { path = "../../crates/egui_extras", features = ["svg"] }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Example how to show an SVG image.
|
||||
|
||||
|
||||
```sh
|
||||
cargo run -p svg
|
||||
```
|
||||
|
||||

|
||||
|
||||
BIN
examples/svg/screenshot.png
Normal file
|
After Width: | Height: | Size: 59 KiB |