1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Add user texture support to egui_glium and egui_web backends

This commit is contained in:
Emil Ernerfeldt
2020-09-11 08:56:47 +02:00
parent 02ef0cd9d5
commit d49aec4079
5 changed files with 321 additions and 114 deletions

View File

@@ -5,6 +5,8 @@
//! Egui can be used as a library, but you can also use it as a framework to write apps in.
//! This module defined the `App` trait that can be implemented and used with the `egui_web` and `egui_glium` crates.
// TODO: move egui/src/app.rs to own crate, e.g. egui_framework ?
use crate::Ui;
/// Implement this trait to write apps that can be compiled both natively using the [`egui_glium`](https://crates.io/crates/egui_glium) crate,
@@ -54,6 +56,13 @@ pub trait Backend {
/// Signal the backend that we'd like to exit the app now.
/// This does nothing for web apps.
fn quit(&mut self) {}
/// Allocate a user texture (EXPERIMENTAL!)
fn new_texture_srgba_premultiplied(
&mut self,
size: (usize, usize),
pixels: &[crate::Srgba],
) -> crate::TextureId;
}
/// A place where you can store custom data in a way that persists when you restart the app.