repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shape_transform.rs | crates/epaint/src/shape_transform.rs | use std::sync::Arc;
use crate::{
CircleShape, Color32, ColorMode, CubicBezierShape, EllipseShape, Mesh, PathShape,
QuadraticBezierShape, RectShape, Shape, TextShape, color,
};
/// Remember to handle [`Color32::PLACEHOLDER`] specially!
pub fn adjust_colors(
shape: &mut Shape,
adjust_color: impl Fn(&mut... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/texture_handle.rs | crates/epaint/src/texture_handle.rs | use std::sync::Arc;
use crate::{
ImageData, ImageDelta, TextureId, TextureManager, emath::NumExt as _, mutex::RwLock,
textures::TextureOptions,
};
/// Used to paint images.
///
/// An _image_ is pixels stored in RAM, and represented using [`ImageData`].
/// Before you can paint it however, you need to convert... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/corner_radius_f32.rs | crates/epaint/src/corner_radius_f32.rs | use crate::CornerRadius;
/// How rounded the corners of things should be, in `f32`.
///
/// This is used for calculations, but storage is usually done with the more compact [`CornerRadius`].
#[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/texture_atlas.rs | crates/epaint/src/texture_atlas.rs | use ecolor::Color32;
use emath::{Rect, remap_clamp};
use crate::{ColorImage, ImageDelta, TextOptions};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
struct Rectu {
/// inclusive
min_x: usize,
/// inclusive
min_y: usize,
/// exclusive
max_x: usize,
/// exclusive
max_y: usize,
}
impl ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/textures.rs | crates/epaint/src/textures.rs | use crate::{ImageData, ImageDelta, TextureId};
// ----------------------------------------------------------------------------
/// Low-level manager for allocating textures.
///
/// Communicates with the painting subsystem using [`Self::take_delta`].
#[derive(Default)]
pub struct TextureManager {
/// We allocate ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/brush.rs | crates/epaint/src/brush.rs | use crate::{Rect, TextureId};
/// Controls texturing of a [`crate::RectShape`].
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Brush {
/// If the rect should be filled with a texture, which one?
///
/// The texture is mul... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/color.rs | crates/epaint/src/color.rs | use std::{fmt::Debug, sync::Arc};
use ecolor::Color32;
use emath::{Pos2, Rect};
/// How paths will be colored.
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum ColorMode {
/// The entire path is one solid color, this is the default.
Solid(Color32),
//... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/util/mod.rs | crates/epaint/src/util/mod.rs | /// Hash the given value with a predictable hasher.
#[inline]
pub fn hash(value: impl std::hash::Hash) -> u64 {
ahash::RandomState::with_seeds(1, 2, 3, 4).hash_one(value)
}
/// Hash the given value with the given hasher.
#[inline]
pub fn hash_with(value: impl std::hash::Hash, mut hasher: impl std::hash::Hasher) ->... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/cursor.rs | crates/epaint/src/text/cursor.rs | //! Different types of text cursors, i.e. ways to point into a [`super::Galley`].
/// Character cursor.
///
/// The default cursor is zero.
#[derive(Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct CCursor {
/// Character offset (NOT byte offset!... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/fonts.rs | crates/epaint/src/text/fonts.rs | use std::{
borrow::Cow,
collections::BTreeMap,
sync::{
Arc,
atomic::{AtomicU64, Ordering},
},
};
use crate::{
TextureAtlas,
text::{
Galley, LayoutJob, LayoutSection, TextOptions,
font::{Font, FontFace, GlyphInfo},
},
};
use emath::{NumExt as _, OrderedFloat};... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/font.rs | crates/epaint/src/text/font.rs | #![expect(clippy::mem_forget)]
use emath::{GuiRounding as _, OrderedFloat, Vec2, vec2};
use self_cell::self_cell;
use skrifa::{
MetadataProvider as _,
raw::{TableProvider as _, tables::kern::SubtableKind},
};
use std::collections::BTreeMap;
use vello_cpu::{color, kurbo};
use crate::{
TextOptions, TextureA... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/mod.rs | crates/epaint/src/text/mod.rs | //! Everything related to text, fonts, text layout, cursors etc.
pub mod cursor;
mod font;
mod fonts;
mod text_layout;
mod text_layout_types;
/// One `\t` character is this many spaces wide.
pub const TAB_SIZE: usize = 4;
pub use {
fonts::{
FontData, FontDefinitions, FontFamily, FontId, FontInsert, FontP... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/text_layout.rs | crates/epaint/src/text/text_layout.rs | #![expect(clippy::unwrap_used)] // TODO(emilk): remove unwraps
use std::sync::Arc;
use emath::{Align, GuiRounding as _, NumExt as _, Pos2, Rect, Vec2, pos2, vec2};
use crate::{
Color32, Mesh, Stroke, Vertex,
stroke::PathStroke,
text::{
font::{ScaledMetrics, is_cjk, is_cjk_break_allowed},
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/text/text_layout_types.rs | crates/epaint/src/text/text_layout_types.rs | use std::ops::Range;
use std::sync::Arc;
use super::{
cursor::{CCursor, LayoutCursor},
font::UvRect,
};
use crate::{Color32, FontId, Mesh, Stroke, text::FontsView};
use emath::{Align, GuiRounding as _, NumExt as _, OrderedFloat, Pos2, Rect, Vec2, pos2, vec2};
/// Describes the task of laying out text.
///
///... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/text_shape.rs | crates/epaint/src/shapes/text_shape.rs | use std::sync::Arc;
use emath::{Align2, Rot2};
use crate::*;
/// How to paint some text on screen.
///
/// This needs to be recreated if `pixels_per_point` (dpi scale) changes.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct TextShape {
/... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/shape.rs | crates/epaint/src/shapes/shape.rs | //! The different shapes that can be painted.
use std::sync::Arc;
use emath::{Align2, Pos2, Rangef, Rect, TSTransform, Vec2, pos2};
use crate::{
Color32, CornerRadius, Mesh, Stroke, StrokeKind, TextureId,
stroke::PathStroke,
text::{FontId, FontsView, Galley},
};
use super::{
CircleShape, CubicBezier... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/ellipse_shape.rs | crates/epaint/src/shapes/ellipse_shape.rs | use crate::*;
/// How to paint an ellipse.
#[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct EllipseShape {
pub center: Pos2,
/// Radius is the vector (a, b) where the width of the Ellipse is 2a and the height is 2b
pub radius:... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/bezier_shape.rs | crates/epaint/src/shapes/bezier_shape.rs | #![expect(clippy::many_single_char_names)]
use std::ops::Range;
use crate::{Color32, PathShape, PathStroke, Shape};
use emath::{Pos2, Rect, RectTransform};
// ----------------------------------------------------------------------------
/// A cubic [Bézier Curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve).
///... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/mod.rs | crates/epaint/src/shapes/mod.rs | mod bezier_shape;
mod circle_shape;
mod ellipse_shape;
mod paint_callback;
mod path_shape;
mod rect_shape;
mod shape;
mod text_shape;
pub use self::{
bezier_shape::{CubicBezierShape, QuadraticBezierShape},
circle_shape::CircleShape,
ellipse_shape::EllipseShape,
paint_callback::{PaintCallback, PaintCall... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/circle_shape.rs | crates/epaint/src/shapes/circle_shape.rs | use crate::{Color32, Pos2, Rect, Shape, Stroke, Vec2};
/// How to paint a circle.
#[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct CircleShape {
pub center: Pos2,
pub radius: f32,
pub fill: Color32,
pub stroke: Stroke,
}
i... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/rect_shape.rs | crates/epaint/src/shapes/rect_shape.rs | use std::sync::Arc;
use crate::*;
/// How to paint a rectangle.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct RectShape {
pub rect: Rect,
/// How rounded the corners of the rectangle are.
///
/// Use [`CornerRadius::ZERO`] f... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/paint_callback.rs | crates/epaint/src/shapes/paint_callback.rs | use std::{any::Any, sync::Arc};
use crate::*;
/// Information passed along with [`PaintCallback`] ([`Shape::Callback`]).
pub struct PaintCallbackInfo {
/// Viewport in points.
///
/// This specifies where on the screen to paint, and the borders of this
/// Rect is the [-1, +1] of the Normalized Device... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/src/shapes/path_shape.rs | crates/epaint/src/shapes/path_shape.rs | use crate::*;
/// A path which can be stroked and/or filled (if closed).
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct PathShape {
/// Filled paths should prefer clockwise order.
pub points: Vec<Pos2>,
/// If true, connect the fi... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/epaint/benches/benchmark.rs | crates/epaint/benches/benchmark.rs | use criterion::{Criterion, criterion_group, criterion_main};
use epaint::{
ClippedShape, Color32, Mesh, PathStroke, Pos2, Rect, Shape, Stroke, TessellationOptions,
Tessellator, TextureAtlas, Vec2, pos2, tessellator::Path,
};
use std::hint::black_box;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mi... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/lib.rs | crates/egui_extras/src/lib.rs | //! This is a crate that adds some features on top top of [`egui`](https://github.com/emilk/egui).
//!
//! This crate are for experimental features, and features that require big dependencies that does not belong in `egui`.
//!
//! ## Feature flags
#![cfg_attr(feature = "document-features", doc = document_features::doc... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/image.rs | crates/egui_extras/src/image.rs | #[cfg(feature = "svg")]
use egui::SizeHint;
// ----------------------------------------------------------------------------
/// Load a (non-svg) image.
///
/// Requires the "image" feature. You must also opt-in to the image formats you need
/// with e.g. `image = { version = "0.25", features = ["jpeg", "png"] }`.
///... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/strip.rs | crates/egui_extras/src/strip.rs | use crate::{
Size,
layout::{CellDirection, CellSize, StripLayout, StripLayoutFlags},
sizing::Sizing,
};
use egui::{Response, Ui};
/// Builder for creating a new [`Strip`].
///
/// This can be used to do dynamic layouts.
///
/// In contrast to normal egui behavior, strip cells do *not* grow with its childre... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/table.rs | crates/egui_extras/src/table.rs | //! Table view with (optional) fixed header and scrolling body.
//! Cell widths are precalculated with given size hints so we can have tables like this:
//! | fixed size | all available space/minimum | 30% of available width | fixed size |
//! Takes all available height, so if you want something below the table, put it... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/layout.rs | crates/egui_extras/src/layout.rs | use egui::{Id, Pos2, Rect, Response, Sense, Ui, UiBuilder, emath::GuiRounding as _};
#[derive(Clone, Copy)]
pub(crate) enum CellSize {
/// Absolute size in points
Absolute(f32),
/// Take all available space
Remainder,
}
/// Cells are positioned in two dimensions, cells go in one direction and form li... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/sizing.rs | crates/egui_extras/src/sizing.rs | use egui::Rangef;
/// Size hint for table column/strip cell.
#[derive(Clone, Debug, Copy)]
pub enum Size {
/// Absolute size in points, with a given range of allowed sizes to resize within.
Absolute { initial: f32, range: Rangef },
/// Relative size relative to all available space.
Relative { fraction... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders.rs | crates/egui_extras/src/loaders.rs | // TODO(jprochazk): automatic cache eviction
/// Installs a set of image loaders.
///
/// Calling this enables the use of [`egui::Image`] and [`egui::Ui::image`].
///
/// ⚠ This will do nothing and you won't see any images unless you also enable some feature flags on `egui_extras`:
///
/// - `file` feature: `file://` ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/syntax_highlighting.rs | crates/egui_extras/src/syntax_highlighting.rs | //! Syntax highlighting for code.
//!
//! Turn on the `syntect` feature for great syntax highlighting of any language.
//! Otherwise, a very simple fallback will be used, that works okish for C, C++, Rust, and Python.
use egui::TextStyle;
use egui::text::LayoutJob;
/// View some code with syntax highlighting and sele... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/datepicker/button.rs | crates/egui_extras/src/datepicker/button.rs | use super::popup::DatePickerPopup;
use chrono::NaiveDate;
use egui::{Area, Button, Frame, InnerResponse, Key, Order, RichText, Ui, Widget};
use std::ops::RangeInclusive;
#[derive(Default, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct DatePickerButtonState {
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/datepicker/mod.rs | crates/egui_extras/src/datepicker/mod.rs | #![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
mod button;
mod popup;
pub use button::DatePickerButton;
use chrono::{Datelike as _, Duration, NaiveDate, Weekday};
#[derive(Debug)]
struct Week {
number: u8,
days: Vec<NaiveDate>,
}
fn month_data(year: i32, month: u32) -> Vec<Week> {
let fir... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/datepicker/popup.rs | crates/egui_extras/src/datepicker/popup.rs | use chrono::{Datelike as _, NaiveDate, Weekday};
use egui::{Align, Button, Color32, ComboBox, Direction, Id, Layout, RichText, Ui, Vec2};
use super::{button::DatePickerButtonState, month_data};
use crate::{Column, Size, StripBuilder, TableBuilder};
#[derive(Default, Clone)]
#[cfg_attr(feature = "serde", derive(serd... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/image_loader.rs | crates/egui_extras/src/loaders/image_loader.rs | use ahash::HashMap;
use egui::{
ColorImage, decode_animated_image_uri,
load::{Bytes, BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::ImageFormat;
use std::{mem::size_of, path::Path, sync::Arc, task::Poll};
#[cfg(not(target_arch = "wasm32"))]
use std::th... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/svg_loader.rs | crates/egui_extras/src/loaders/svg_loader.rs | use std::{
mem::size_of,
sync::{
Arc,
atomic::{AtomicU64, Ordering::Relaxed},
},
};
use ahash::HashMap;
use egui::{
ColorImage,
load::{BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
struct Entry {
last_used: AtomicU64,
result... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/gif_loader.rs | crates/egui_extras/src/loaders/gif_loader.rs | use ahash::HashMap;
use egui::{
ColorImage, FrameDurations, Id, decode_animated_image_uri, has_gif_magic_header,
load::{BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::AnimationDecoder as _;
use std::{io::Cursor, mem::size_of, sync::Arc, time::Duration};... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/http_loader.rs | crates/egui_extras/src/loaders/http_loader.rs | use ahash::HashMap;
use egui::{
load::{Bytes, BytesLoadResult, BytesLoader, BytesPoll, LoadError},
mutex::Mutex,
};
use std::{sync::Arc, task::Poll};
#[derive(Clone)]
struct File {
bytes: Arc<[u8]>,
mime: Option<String>,
}
impl File {
fn from_response(uri: &str, response: ehttp::Response) -> Resul... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/webp_loader.rs | crates/egui_extras/src/loaders/webp_loader.rs | use ahash::HashMap;
use egui::{
ColorImage, FrameDurations, Id, decode_animated_image_uri, has_webp_header,
load::{BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::{AnimationDecoder as _, ColorType, ImageDecoder as _, Rgba, codecs::webp::WebPDecoder};
use... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_extras/src/loaders/file_loader.rs | crates/egui_extras/src/loaders/file_loader.rs | use ahash::HashMap;
use egui::{
load::{Bytes, BytesLoadResult, BytesLoader, BytesPoll, LoadError},
mutex::Mutex,
};
use std::{sync::Arc, task::Poll, thread};
#[derive(Clone)]
struct File {
bytes: Arc<[u8]>,
mime: Option<String>,
}
type Entry = Poll<Result<File, String>>;
#[derive(Default)]
pub struct... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/lib.rs | crates/egui_demo_app/src/lib.rs | //! Demo app for egui
mod apps;
mod backend_panel;
mod frame_history;
mod wrap_app;
pub use wrap_app::{Anchor, WrapApp};
/// Time of day as seconds since midnight. Used for clock in demo app.
pub(crate) fn seconds_since_midnight() -> f64 {
use chrono::Timelike as _;
let time = chrono::Local::now().time();
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/wrap_app.rs | crates/egui_demo_app/src/wrap_app.rs | use egui_demo_lib::{DemoWindows, is_mobile};
#[cfg(feature = "glow")]
use eframe::glow;
#[cfg(target_arch = "wasm32")]
use core::any::Any;
use crate::DemoApp;
#[derive(Default)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
struct EasyMarkApp {
editor: egui_demo_lib::easy_mark::Ea... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/backend_panel.rs | crates/egui_demo_app/src/backend_panel.rs | /// How often we repaint the demo app by default
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum RunMode {
/// This is the default for the demo.
///
/// If this is selected, egui is only updated if are input events
/// (like mouse movements) or there are some animations in the GUI.
///
/// Rea... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/accessibility_inspector.rs | crates/egui_demo_app/src/accessibility_inspector.rs | use std::mem;
use accesskit::{Action, ActionRequest, NodeId};
use accesskit_consumer::{FilterResult, Node, Tree, TreeChangeHandler};
use eframe::epaint::text::TextWrapMode;
use egui::{
Button, Color32, Event, Frame, FullOutput, Id, Key, KeyboardShortcut, Label, Modifiers, Panel,
RawInput, RichText, ScrollArea... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/frame_history.rs | crates/egui_demo_app/src/frame_history.rs | use egui::util::History;
pub struct FrameHistory {
frame_times: History<f32>,
}
impl Default for FrameHistory {
fn default() -> Self {
let max_age: f32 = 1.0;
let max_len = (max_age * 300.0).round() as usize;
Self {
frame_times: History::new(0..max_len, max_age),
}
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/web.rs | crates/egui_demo_app/src/web.rs | use eframe::wasm_bindgen::{self, prelude::*};
use crate::WrapApp;
/// Our handle to the web app from JavaScript.
#[derive(Clone)]
#[wasm_bindgen]
pub struct WebHandle {
runner: eframe::WebRunner,
}
#[wasm_bindgen]
impl WebHandle {
/// Installs a panic hook, then returns.
#[allow(clippy::allow_attributes,... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/main.rs | crates/egui_demo_app/src/main.rs | //! Demo app for egui
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
#![allow(clippy::allow_attributes, clippy::never_loop)]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimallo... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/http_app.rs | crates/egui_demo_app/src/apps/http_app.rs | use egui::Image;
use poll_promise::Promise;
struct Resource {
/// HTTP response
response: ehttp::Response,
text: Option<String>,
/// If set, the response was an image.
image: Option<Image<'static>>,
/// If set, the response was text with some supported syntax highlighting (e.g. ".rs" or ".md... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/custom3d_wgpu.rs | crates/egui_demo_app/src/apps/custom3d_wgpu.rs | #![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
use std::num::NonZeroU64;
use eframe::{
egui_wgpu::wgpu::util::DeviceExt as _,
egui_wgpu::{self, wgpu},
};
pub struct Custom3d {
angle: f32,
}
impl Custom3d {
pub fn new<'a>(cc: &'a eframe::CreationContext<'a>) -> Option<Self> {
/... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/mod.rs | crates/egui_demo_app/src/apps/mod.rs | #[cfg(all(feature = "glow", not(feature = "wgpu")))]
mod custom3d_glow;
#[cfg(feature = "wgpu")]
mod custom3d_wgpu;
mod fractal_clock;
#[cfg(feature = "http")]
mod http_app;
#[cfg(feature = "image_viewer")]
mod image_viewer;
#[cfg(feature = "image_viewer")]
pub use image_viewer::ImageViewer;
#[cfg(all(feature = "... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/fractal_clock.rs | crates/egui_demo_app/src/apps/fractal_clock.rs | use egui::{
Color32, Painter, Pos2, Rect, Shape, Stroke, Ui, Vec2,
containers::{CollapsingHeader, Frame},
emath, pos2,
widgets::Slider,
};
use std::f32::consts::TAU;
#[derive(PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(def... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/custom3d_glow.rs | crates/egui_demo_app/src/apps/custom3d_glow.rs | #![expect(clippy::undocumented_unsafe_blocks)]
use std::sync::Arc;
use eframe::egui_glow;
use egui::mutex::Mutex;
use egui_glow::glow;
pub struct Custom3d {
/// Behind an `Arc<Mutex<…>>` so we can pass it to [`egui::PaintCallback`] and paint later.
rotating_triangle: Arc<Mutex<RotatingTriangle>>,
angle: ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/src/apps/image_viewer.rs | crates/egui_demo_app/src/apps/image_viewer.rs | use egui::ImageFit;
use egui::Slider;
use egui::Vec2;
use egui::emath::Rot2;
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct ImageViewer {
current_uri: String,
uri_edit_text: String,
image_options: egui::ImageOptions,
chosen_fit: ChosenFit,
fit: ImageFit,
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui_demo_app/tests/test_demo_app.rs | crates/egui_demo_app/tests/test_demo_app.rs | use egui::Vec2;
use egui::accesskit::Role;
use egui_demo_app::{Anchor, WrapApp};
use egui_kittest::SnapshotResults;
use egui_kittest::kittest::Queryable as _;
#[test]
fn test_demo_app() {
let mut harness = egui_kittest::Harness::builder()
.with_size(Vec2::new(900.0, 600.0))
.wgpu()
.build_e... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui-wgpu/src/setup.rs | crates/egui-wgpu/src/setup.rs | use std::sync::Arc;
#[derive(Clone)]
pub enum WgpuSetup {
/// Construct a wgpu setup using some predefined settings & heuristics.
/// This is the default option. You can customize most behaviours overriding the
/// supported backends, power preferences, and device description.
///
/// By default ca... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui-wgpu/src/winit.rs | crates/egui-wgpu/src/winit.rs | #![expect(clippy::missing_errors_doc)]
#![expect(clippy::undocumented_unsafe_blocks)]
#![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
#![expect(unsafe_code)]
use crate::{RenderState, SurfaceErrorAction, WgpuConfiguration, renderer};
use crate::{
RendererOptions,
capture::{CaptureReceiver, Capture... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui-wgpu/src/lib.rs | crates/egui-wgpu/src/lib.rs | //! This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu).
//!
//! If you're targeting WebGL you also need to turn on the
//! `webgl` feature of the `wgpu` crate:
//!
//! ```toml
//! # Enable both WebGL and WebGPU backends on web.
//! wgpu = { version = ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui-wgpu/src/renderer.rs | crates/egui-wgpu/src/renderer.rs | #![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
use std::{borrow::Cow, num::NonZeroU64, ops::Range};
use ahash::HashMap;
use bytemuck::Zeroable as _;
use epaint::{PaintCallbackInfo, Primitive, Vertex, emath::NumExt as _};
use wgpu::util::DeviceExt as _;
// Only implements Send + Sync on wasm32 in orde... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui-wgpu/src/capture.rs | crates/egui-wgpu/src/capture.rs | use egui::{UserData, ViewportId};
use epaint::ColorImage;
use std::sync::{Arc, mpsc};
use wgpu::{BindGroupLayout, MultisampleState, StoreOp};
/// A texture and a buffer for reading the rendered frame back to the cpu.
///
/// The texture is required since [`wgpu::TextureUsages::COPY_SRC`] is not an allowed
/// flag for... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/lib.rs | crates/eframe/src/lib.rs | //! eframe - the [`egui`] framework crate
//!
//! If you are planning to write an app for web or native,
//! and want to use [`egui`] for everything, then `eframe` is for you!
//!
//! To get started, see the [examples](https://github.com/emilk/egui/tree/main/examples).
//! To learn how to set up `eframe` for web and na... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/epi.rs | crates/eframe/src/epi.rs | //! Platform-agnostic interface for writing apps using [`egui`] (epi = egui programming interface).
//!
//! `epi` provides interfaces for window management and serialization.
//!
//! Start by looking at the [`App`] trait, and implement [`App::update`].
#![warn(missing_docs)] // Let's keep `epi` well-documented.
#[cfg... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/stopwatch.rs | crates/eframe/src/stopwatch.rs | #![allow(clippy::allow_attributes, dead_code)] // not used on all platforms
use web_time::Instant;
pub struct Stopwatch {
total_time_ns: u128,
/// None = not running
start: Option<Instant>,
}
impl Stopwatch {
pub fn new() -> Self {
Self {
total_time_ns: 0,
start: None... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/icon_data.rs | crates/eframe/src/icon_data.rs | //! Helpers for loading [`egui::IconData`].
use egui::IconData;
/// Helpers for working with [`IconData`].
pub trait IconDataExt {
/// Convert into [`image::RgbaImage`]
///
/// # Errors
/// If `width*height != 4 * rgba.len()`, or if the image is too big.
fn to_image(&self) -> Result<image::RgbaIma... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/wgpu_integration.rs | crates/eframe/src/native/wgpu_integration.rs | //! Note that this file contains code very similar to [`super::glow_integration`].
//! When making changes to one you often also want to apply it to the other.
//!
//! This is also very complex code, and not very pretty.
//! There is a bunch of improvements we could do,
//! like removing a bunch of `unwraps`.
use std:... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/epi_integration.rs | crates/eframe/src/native/epi_integration.rs | //! Common tools used by [`super::glow_integration`] and [`super::wgpu_integration`].
use web_time::Instant;
use std::path::PathBuf;
use winit::event_loop::ActiveEventLoop;
use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _};
use egui::{DeferredViewportUiCallback, ViewportBuilder, ViewportId};
use ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/glow_integration.rs | crates/eframe/src/native/glow_integration.rs | //! Note that this file contains code very similar to [`super::wgpu_integration`].
//! When making changes to one you often also want to apply it to the other.
//!
//! This is also very complex code, and not very pretty.
//! There is a bunch of improvements we could do,
//! like removing a bunch of `unwraps`.
#![expec... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/app_icon.rs | crates/eframe/src/native/app_icon.rs | //! Set the native app icon at runtime.
//!
//! TODO(emilk): port this to [`winit`].
use std::sync::Arc;
use egui::IconData;
pub struct AppTitleIconSetter {
title: String,
icon_data: Option<Arc<IconData>>,
status: AppIconStatus,
}
impl AppTitleIconSetter {
pub fn new(title: String, mut icon_data: Op... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/mod.rs | crates/eframe/src/native/mod.rs | mod app_icon;
mod epi_integration;
mod event_loop_context;
pub mod run;
/// File storage which can be used by native backends.
#[cfg(feature = "persistence")]
pub mod file_storage;
pub(crate) mod winit_integration;
#[cfg(feature = "glow")]
mod glow_integration;
#[cfg(feature = "wgpu_no_default_features")]
mod wgpu_... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/run.rs | crates/eframe/src/native/run.rs | use std::time::Instant;
use winit::{
application::ApplicationHandler,
event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
window::WindowId,
};
use ahash::HashMap;
use super::winit_integration::{UserEvent, WinitApp};
use crate::{
Result, epi,
native::{event_loop_context, winit_integration::Even... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/file_storage.rs | crates/eframe/src/native/file_storage.rs | use std::{
collections::HashMap,
io::Write as _,
path::{Path, PathBuf},
};
/// The folder where `eframe` will store its state.
///
/// The given `app_id` is either the
/// [`egui::ViewportBuilder::app_id`] of [`crate::NativeOptions::viewport`]
/// or the title argument to [`crate::run_native`].
///
/// On ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/event_loop_context.rs | crates/eframe/src/native/event_loop_context.rs | use std::cell::Cell;
use winit::event_loop::ActiveEventLoop;
thread_local! {
static CURRENT_EVENT_LOOP: Cell<Option<*const ActiveEventLoop>> = const { Cell::new(None) };
}
struct EventLoopGuard;
impl EventLoopGuard {
fn new(event_loop: &ActiveEventLoop) -> Self {
CURRENT_EVENT_LOOP.with(|cell| {
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/native/winit_integration.rs | crates/eframe/src/native/winit_integration.rs | use std::{sync::Arc, time::Instant};
use winit::{
event_loop::ActiveEventLoop,
window::{Window, WindowId},
};
use egui::ViewportId;
#[cfg(feature = "accesskit")]
use egui_winit::accesskit_winit;
/// Create an egui context, restoring it from storage if possible.
pub fn create_egui_context(storage: Option<&dyn... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/web_painter.rs | crates/eframe/src/web/web_painter.rs | use egui::{Event, UserData};
use wasm_bindgen::JsValue;
/// Renderer for a browser canvas.
/// As of writing we're not allowing to decide on the painter at runtime,
/// therefore this trait is merely there for specifying and documenting the interface.
pub(crate) trait WebPainter {
// Create a new web painter targe... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/web_painter_glow.rs | crates/eframe/src/web/web_painter_glow.rs | use egui::{Event, UserData, ViewportId};
use egui_glow::glow;
use std::sync::Arc;
use wasm_bindgen::JsCast as _;
use wasm_bindgen::JsValue;
use web_sys::HtmlCanvasElement;
use crate::{WebGlContextOption, WebOptions};
use super::web_painter::WebPainter;
pub(crate) struct WebPainterGlow {
canvas: HtmlCanvasElement... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/backend.rs | crates/eframe/src/web/backend.rs | use std::collections::BTreeMap;
use egui::mutex::Mutex;
use crate::epi;
use super::percent_decode;
// ----------------------------------------------------------------------------
/// Data gathered between frames.
#[derive(Default)]
pub(crate) struct WebInput {
/// Required because we don't get a position on to... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/storage.rs | crates/eframe/src/web/storage.rs | fn local_storage() -> Option<web_sys::Storage> {
web_sys::window()?.local_storage().ok()?
}
/// Read data from local storage.
pub fn local_storage_get(key: &str) -> Option<String> {
local_storage().map(|storage| storage.get_item(key).ok())??
}
/// Write data to local storage.
pub fn local_storage_set(key: &st... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/web_painter_wgpu.rs | crates/eframe/src/web/web_painter_wgpu.rs | use std::sync::Arc;
use egui::{Event, UserData, ViewportId};
use egui_wgpu::{
RenderState, SurfaceErrorAction,
capture::{CaptureReceiver, CaptureSender, CaptureState, capture_channel},
};
use wasm_bindgen::JsValue;
use web_sys::HtmlCanvasElement;
use super::web_painter::WebPainter;
pub(crate) struct WebPaint... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/app_runner.rs | crates/eframe/src/web/app_runner.rs | use std::sync::Arc;
use egui::{TexturesDelta, UserData, ViewportCommand};
use crate::{App, epi, web::web_painter::WebPainter};
use super::{NeedRepaint, now_sec, text_agent::TextAgent};
pub struct AppRunner {
#[allow(clippy::allow_attributes, dead_code)]
pub(crate) web_options: crate::WebOptions,
pub(cra... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/mod.rs | crates/eframe/src/web/mod.rs | //! [`egui`] bindings for web apps (compiling to WASM).
#![expect(clippy::missing_errors_doc)] // So many `-> Result<_, JsValue>`
#![expect(clippy::unwrap_used)] // TODO(emilk): remove unwraps
mod app_runner;
mod backend;
mod events;
mod input;
mod panic_handler;
mod text_agent;
mod web_logger;
mod web_runner;
/// A... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/events.rs | crates/eframe/src/web/events.rs | use crate::web::string_from_js_value;
use super::{
AppRunner, Closure, DEBUG_RESIZE, JsCast as _, JsValue, WebRunner, button_from_mouse_event,
location_hash, modifiers_from_kb_event, modifiers_from_mouse_event, modifiers_from_wheel_event,
native_pixels_per_point, pos_from_mouse_event, prefers_color_scheme,... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/panic_handler.rs | crates/eframe/src/web/panic_handler.rs | use std::sync::Arc;
use egui::mutex::Mutex;
use wasm_bindgen::prelude::*;
/// Detects panics, logs them using `console.error`, and stores the panics message and callstack.
///
/// This lets you query `PanicHandler` for the panic message (if any) so you can show it in the HTML.
///
/// Chep to clone (ref-counted).
#[d... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/text_agent.rs | crates/eframe/src/web/text_agent.rs | //! The text agent is a hidden `<input>` element used to capture
//! IME and mobile keyboard input events.
use std::cell::Cell;
use wasm_bindgen::prelude::*;
use web_sys::{Document, Node};
use super::{AppRunner, WebRunner};
pub struct TextAgent {
input: web_sys::HtmlInputElement,
prev_ime_output: Cell<Optio... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/web_runner.rs | crates/eframe/src/web/web_runner.rs | use std::{cell::RefCell, rc::Rc};
use wasm_bindgen::prelude::*;
use crate::{App, epi};
use super::{
AppRunner, PanicHandler,
events::{self, ResizeObserverContext},
text_agent::TextAgent,
};
/// This is how `eframe` runs your web application
///
/// This is cheap to clone.
///
/// See [the crate level do... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/web_logger.rs | crates/eframe/src/web/web_logger.rs | /// Implements [`log::Log`] to log messages to `console.log`, `console.warn`, etc.
pub struct WebLogger {
filter: log::LevelFilter,
}
impl WebLogger {
/// Install a new `WebLogger`, piping all [`log`] events to the web console.
pub fn init(filter: log::LevelFilter) -> Result<(), log::SetLoggerError> {
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/input.rs | crates/eframe/src/web/input.rs | use super::{AppRunner, canvas_content_rect};
pub fn pos_from_mouse_event(
canvas: &web_sys::HtmlCanvasElement,
event: &web_sys::MouseEvent,
ctx: &egui::Context,
) -> egui::Pos2 {
let rect = canvas_content_rect(canvas);
let zoom_factor = ctx.zoom_factor();
egui::Pos2 {
x: (event.client_x... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/eframe/src/web/screen_reader.rs | crates/eframe/src/web/screen_reader.rs | /// Speak the given text out loud.
pub fn speak(text: &str) {
if text.is_empty() {
return;
}
if let Some(window) = web_sys::window() {
log::debug!("Speaking {text:?}");
if let Ok(speech_synthesis) = window.speech_synthesis() {
speech_synthesis.cancel(); // interrupt pre... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/viewport.rs | crates/egui/src/viewport.rs | //! egui supports multiple viewports, corresponding to multiple native windows.
//!
//! Not all egui backends support multiple viewports, but `eframe` native does
//! (but not on web).
//!
//! You can spawn a new viewport using [`Context::show_viewport_deferred`] and [`Context::show_viewport_immediate`].
//! These need... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/layers.rs | crates/egui/src/layers.rs | //! Handles paint layers, i.e. how things
//! are sometimes painted behind or in front of other things.
use crate::{Id, IdMap, Rect, ahash, epaint};
use epaint::{ClippedShape, Shape, emath::TSTransform};
/// Different layer categories
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feat... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/lib.rs | crates/egui/src/lib.rs | //! `egui`: an easy-to-use GUI in pure Rust!
//!
//! Try the live web demo: <https://www.egui.rs/#demo>. Read more about egui at <https://github.com/emilk/egui>.
//!
//! `egui` is in heavy development, with each new version having breaking changes.
//! You need to have rust 1.92.0 or later to use `egui`.
//!
//! To qu... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/widget_text.rs | crates/egui/src/widget_text.rs | use emath::GuiRounding as _;
use epaint::text::TextFormat;
use std::fmt::Formatter;
use std::{borrow::Cow, sync::Arc};
use crate::{
Align, Color32, FontFamily, FontSelection, Galley, Style, TextStyle, TextWrapMode, Ui, Visuals,
text::{LayoutJob, TextWrapping},
};
/// Text and optional style choices for it.
//... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/response.rs | crates/egui/src/response.rs | use std::{any::Any, sync::Arc};
use crate::{
Context, CursorIcon, Id, LayerId, PointerButton, Popup, PopupKind, Sense, Tooltip, Ui,
WidgetRect, WidgetText,
emath::{Align, Pos2, Rect, Vec2},
pass_state,
};
// ----------------------------------------------------------------------------
/// The result of... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | true |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/painter.rs | crates/egui/src/painter.rs | use std::sync::Arc;
use emath::GuiRounding as _;
use epaint::{
CircleShape, ClippedShape, CornerRadius, PathStroke, RectShape, Shape, Stroke, StrokeKind,
text::{FontsView, Galley, LayoutJob},
};
use crate::{
Color32, Context, FontId,
emath::{Align2, Pos2, Rangef, Rect, Vec2},
layers::{LayerId, Pai... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/placer.rs | crates/egui/src/placer.rs | use crate::{Layout, Painter, Pos2, Rect, Region, Vec2, grid, vec2};
#[cfg(debug_assertions)]
use crate::{Align2, Color32, Stroke};
pub(crate) struct Placer {
/// If set this will take precedence over [`crate::layout`].
grid: Option<grid::GridLayout>,
layout: Layout,
region: Region,
}
impl Placer {
... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/widget_style.rs | crates/egui/src/widget_style.rs | use emath::Vec2;
use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode};
use crate::{
Frame, Response, Style, TextStyle,
style::{WidgetVisuals, Widgets},
};
/// General text style
pub struct TextVisuals {
/// Font used
pub font_id: FontId,
/// Font color
pub color: Color32,
//... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/id.rs | crates/egui/src/id.rs | // TODO(emilk): have separate types `PositionId` and `UniqueId`. ?
use std::num::NonZeroU64;
/// egui tracks widgets frame-to-frame using [`Id`]s.
///
/// For instance, if you start dragging a slider one frame, egui stores
/// the sliders [`Id`] as the current active id so that next frame when
/// you move the mouse ... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/introspection.rs | crates/egui/src/introspection.rs | //! Showing UI:s for egui/epaint types.
use crate::{
Color32, CursorIcon, FontFamily, FontId, Label, Mesh, NumExt as _, Rect, Response, Sense,
Shape, Slider, TextStyle, TextWrapMode, Ui, Widget, epaint, memory, pos2, remap_clamp, vec2,
};
pub fn font_family_ui(ui: &mut Ui, font_family: &mut FontFamily) {
l... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/os.rs | crates/egui/src/os.rs | /// An `enum` of common operating systems.
#[expect(clippy::upper_case_acronyms)] // `Ios` looks too ugly
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum OperatingSystem {
/// Unknown OS - could be wasm
Unknown,
/// Android OS
Android,
/// Apple iPhone OS
IOS,
/// Linux or Uni... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/ui_builder.rs | crates/egui/src/ui_builder.rs | use std::{hash::Hash, sync::Arc};
use crate::ClosableTag;
#[expect(unused_imports)] // Used for doclinks
use crate::Ui;
use crate::{Id, LayerId, Layout, Rect, Sense, Style, UiStackInfo};
/// Build a [`Ui`] as the child of another [`Ui`].
///
/// By default, everything is inherited from the parent,
/// except for `max... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
emilk/egui | https://github.com/emilk/egui/blob/9e95b9ca50c224077617434707f7bd29bd70938b/crates/egui/src/callstack.rs | crates/egui/src/callstack.rs | #[derive(Clone)]
struct Frame {
/// `_main` is usually as the deepest depth.
depth: usize,
name: String,
file_and_line: String,
}
/// Capture a callstack, skipping the frames that are not interesting.
///
/// In particular: slips everything before `egui::Context::run`,
/// and skipping all frames in th... | rust | Apache-2.0 | 9e95b9ca50c224077617434707f7bd29bd70938b | 2026-01-04T15:36:36.351731Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.