Skip to main content

LineLayoutExt

Trait LineLayoutExt 

Source
pub trait LineLayoutExt {
    // Required methods
    fn paint(
        &self,
        origin: Point<Pixels>,
        line_height: Pixels,
        align: TextAlign,
        align_width: Option<Pixels>,
        decoration_runs: &[DecorationRun],
        window: &mut Window<'_>,
        cx: &mut App,
    ) -> Result<()>;
    fn paint_background(
        &self,
        origin: Point<Pixels>,
        line_height: Pixels,
        align: TextAlign,
        align_width: Option<Pixels>,
        decoration_runs: &[DecorationRun],
        window: &mut Window<'_>,
        cx: &mut App,
    ) -> Result<()>;
}
Expand description

Extension methods for painting a bare LineLayout.

These live in gpui rather than gpui_platform because they need Window and App.

Required Methods§

Source

fn paint( &self, origin: Point<Pixels>, line_height: Pixels, align: TextAlign, align_width: Option<Pixels>, decoration_runs: &[DecorationRun], window: &mut Window<'_>, cx: &mut App, ) -> Result<()>

Paint this layout to the window, using the given decoration runs to color glyphs and draw underlines and strikethroughs.

This is a lower-level alternative to ShapedLine::paint for callers that hold a bare layout and track decorations themselves.

Source

fn paint_background( &self, origin: Point<Pixels>, line_height: Pixels, align: TextAlign, align_width: Option<Pixels>, decoration_runs: &[DecorationRun], window: &mut Window<'_>, cx: &mut App, ) -> Result<()>

Paint the background of this layout to the window, using the given decoration runs to determine background colors.

This is a lower-level alternative to ShapedLine::paint_background for callers that hold a bare layout and track decorations themselves.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§