Struct zng_view_api::display_list::DisplayListBuilder

source ·
pub struct DisplayListBuilder { /* private fields */ }
Expand description

Represents a builder for display items that will be rendered in the view process.

Implementations§

source§

impl DisplayListBuilder

source

pub fn new(frame_id: FrameId) -> Self

New default.

source

pub fn with_capacity(frame_id: FrameId, capacity: usize) -> Self

New with pre-allocation.

source

pub fn frame_id(&self) -> FrameId

Frame that will be rendered by this display list.

source

pub fn start_reuse_range(&mut self) -> ReuseStart

Mark the start of a reuse range, the range can be completed with finish_reuse_range.

Reuse ranges can be nested.

source

pub fn finish_reuse_range(&mut self, start: ReuseStart) -> ReuseRange

Mark the end of a reuse range.

§Panics

Panics if start was not generated by a call to start_reuse_range on the same builder.

Panics if clips, masks, reference frames or stacking contexts where pushed inside the reuse range and not popped before the call to finish.

source

pub fn push_reuse_range(&mut self, range: &ReuseRange)

Push a range of items to be copied from the previous display list on the same pipeline.

Panics if range does not have a compatible pipeline id.

source

pub fn push_reference_frame( &mut self, key: ReferenceFrameId, transform: FrameValue<PxTransform>, transform_style: TransformStyle, is_2d_scale_translation: bool, )

Start a new spatial context, must be paired with a call to pop_reference_frame.

If transform_style is Preserve3D if extends the 3D context of the parent. If the parent is not Preserve3D a stacking context with Preserve3D must be the next display item.

source

pub fn pop_reference_frame(&mut self)

Finish the flat spatial context started by a call to push_reference_frame.

source

pub fn push_stacking_context( &mut self, blend_mode: MixBlendMode, transform_style: TransformStyle, filters: &[FilterOp], )

Start a new filters context or extend 3D space, must be paired with a call to pop_stacking_context.

Note that transform_style is coerced to Flat if any filter is also set.

source

pub fn pop_stacking_context(&mut self)

Finish the filters context started by a call to push_stacking_context.

source

pub fn push_clip_rect(&mut self, clip_rect: PxRect, clip_out: bool)

Push a rectangular clip that will affect all pushed items until a paired call to pop_clip.

source

pub fn push_clip_rounded_rect( &mut self, clip_rect: PxRect, corners: PxCornerRadius, clip_out: bool, )

Push a rectangular clip with rounded corners that will affect all pushed items until a paired call to pop_clip.

If clip_out is true only pixels outside the rounded rect are visible.

source

pub fn pop_clip(&mut self)

Pop a clip previously pushed by a call to push_clip_rect. Items pushed after this call are not clipped.

source

pub fn push_mask(&mut self, image_id: ImageTextureId, rect: PxRect)

Push an image mask that will affect all pushed items until a paired call to pop_mask.

source

pub fn pop_mask(&mut self)

Pop an image mask previously pushed by a call to push_mask. Items pushed after this call are not masked.

source

pub fn push_border( &mut self, bounds: PxRect, widths: PxSideOffsets, top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, radius: PxCornerRadius, )

Push a normal border.

source

pub fn push_nine_patch_border( &mut self, bounds: PxRect, source: NinePatchSource, widths: PxSideOffsets, fill: bool, repeat_horizontal: RepeatMode, repeat_vertical: RepeatMode, )

Push a nine-patch border.

source

pub fn push_text( &mut self, clip_rect: PxRect, font_id: FontId, glyphs: &[GlyphInstance], color: FrameValue<Rgba>, options: GlyphOptions, )

Push a text run.

source

pub fn push_image( &mut self, clip_rect: PxRect, image_id: ImageTextureId, image_size: PxSize, tile_size: PxSize, tile_spacing: PxSize, rendering: ImageRendering, alpha_type: AlphaType, )

Push an image.

source

pub fn push_color(&mut self, clip_rect: PxRect, color: FrameValue<Rgba>)

Push a color rectangle.

source

pub fn push_backdrop_filter(&mut self, clip_rect: PxRect, filters: &[FilterOp])

Push a filter that applies to all rendered pixels behind clip_rect.

source

pub fn push_linear_gradient( &mut self, clip_rect: PxRect, start_point: Point2D<f32, Px>, end_point: Point2D<f32, Px>, extend_mode: ExtendMode, stops: &[GradientStop], tile_origin: PxPoint, tile_size: PxSize, tile_spacing: PxSize, )

Push a linear gradient rectangle.

source

pub fn push_radial_gradient( &mut self, clip_rect: PxRect, center: Point2D<f32, Px>, radius: Size2D<f32, Px>, start_offset: f32, end_offset: f32, extend_mode: ExtendMode, stops: &[GradientStop], tile_origin: PxPoint, tile_size: PxSize, tile_spacing: PxSize, )

Push a radial gradient rectangle.

source

pub fn push_conic_gradient( &mut self, clip_rect: PxRect, center: Point2D<f32, Px>, angle: AngleRadian, start_offset: f32, end_offset: f32, extend_mode: ExtendMode, stops: &[GradientStop], tile_origin: PxPoint, tile_size: PxSize, tile_spacing: PxSize, )

Push a conic gradient rectangle.

source

pub fn push_line( &mut self, clip_rect: PxRect, color: Rgba, style: LineStyle, orientation: LineOrientation, )

Push a styled vertical or horizontal line.

source

pub fn push_extension( &mut self, extension_id: ApiExtensionId, payload: ApiExtensionPayload, )

Push a custom extension payload.

This can be used by custom renderer implementations to support custom items defined in the context of normal display items.

There are two types of display items, normal items like push_color and context items like push_clip_rect-pop_clip, if the extension is a normal item only the push_extension method must be called, if the extension is a context item the pop_extension must also be called.

source

pub fn pop_extension(&mut self, extension_id: ApiExtensionId)

Pop an extension previously pushed.

Only required if the extension implementation requires it, item extensions do not need to pop.

source

pub fn set_backface_visibility(&mut self, visible: bool)

Sets the backface visibility of all display items after this call.

source

pub fn len(&self) -> usize

Number of display items.

source

pub fn is_empty(&self) -> bool

Returns true if the list has no display items.

source

pub fn parallel_split(&self) -> Self

Create a display list builder that can be send to be build in parallel and then folded back onto this list using parallel_fold.

source

pub fn parallel_fold(&mut self, split: Self)

Append the split onto self.

§Panics

Panics if split was not generated by a call to parallel_split on self or a parent display list.

Panics if split has not closed all reference frames, clips or stacking contexts that it opened.

source

pub fn finalize(self) -> DisplayList

Returns the display list.

Trait Implementations§

source§

impl Debug for DisplayListBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more