1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Misc doc improvements

This commit is contained in:
Emil Ernerfeldt
2022-04-13 22:05:19 +02:00
parent 2ae93c40ab
commit a7b6334784
14 changed files with 48 additions and 16 deletions

View File

@@ -260,17 +260,21 @@ fn fast_round(r: f32) -> u8 {
/// A change to an image.
///
/// Either a whole new image,
/// or an update to a rectangular region of it.
/// Either a whole new image, or an update to a rectangular region of it.
#[derive(Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[must_use = "The painter must take care of this"]
pub struct ImageDelta {
/// What to set the texture to.
///
/// If [`Self::pos`] is `None`, this describes the whole texture.
///
/// If [`Self::pos`] is `Some`, this describes a patch of the whole image starting at [`Self::pos`].
pub image: ImageData,
/// If `None`, set the whole texture to [`Self::image`].
/// If `Some(pos)`, update a sub-region of an already allocated texture.
///
/// If `Some(pos)`, update a sub-region of an already allocated texture with the patch in [`Self::image`].
pub pos: Option<[usize; 2]>,
}

View File

@@ -315,12 +315,13 @@ impl Default for FontDefinitions {
/// The collection of fonts used by `epaint`.
///
/// Required in order to paint text.
/// Create one and reuse. Cheap to clone.
/// Required in order to paint text. Create one and reuse. Cheap to clone.
///
/// Each [`Fonts`] comes with a font atlas textures that needs to be used when painting.
///
/// If you are using `egui`, use `egui::Context::set_fonts` and `egui::Context::fonts`.
///
/// You need to call [`Self::begin_frame`] and [`Self::font_image_delta`] once every frame.
///
/// Wrapper for `Arc<Mutex<FontsAndCache>>`.
pub struct Fonts(Arc<Mutex<FontsAndCache>>);
impl Fonts {