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
impl DisplayListBuilder
sourcepub fn with_capacity(frame_id: FrameId, capacity: usize) -> Self
pub fn with_capacity(frame_id: FrameId, capacity: usize) -> Self
New with pre-allocation.
sourcepub fn start_reuse_range(&mut self) -> ReuseStart
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.
sourcepub fn finish_reuse_range(&mut self, start: ReuseStart) -> ReuseRange
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.
sourcepub fn push_reuse_range(&mut self, range: &ReuseRange)
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.
sourcepub fn push_reference_frame(
&mut self,
key: ReferenceFrameId,
transform: FrameValue<PxTransform>,
transform_style: TransformStyle,
is_2d_scale_translation: bool,
)
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.
sourcepub fn pop_reference_frame(&mut self)
pub fn pop_reference_frame(&mut self)
Finish the flat spatial context started by a call to push_reference_frame
.
sourcepub fn push_stacking_context(
&mut self,
blend_mode: MixBlendMode,
transform_style: TransformStyle,
filters: &[FilterOp],
)
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.
sourcepub fn pop_stacking_context(&mut self)
pub fn pop_stacking_context(&mut self)
Finish the filters context started by a call to push_stacking_context
.
sourcepub fn push_clip_rect(&mut self, clip_rect: PxRect, clip_out: bool)
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
.
sourcepub fn push_clip_rounded_rect(
&mut self,
clip_rect: PxRect,
corners: PxCornerRadius,
clip_out: bool,
)
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.
sourcepub fn pop_clip(&mut self)
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.
sourcepub fn push_mask(&mut self, image_id: ImageTextureId, rect: PxRect)
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
.
sourcepub fn pop_mask(&mut self)
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.
sourcepub fn push_border(
&mut self,
bounds: PxRect,
widths: PxSideOffsets,
top: BorderSide,
right: BorderSide,
bottom: BorderSide,
left: BorderSide,
radius: PxCornerRadius,
)
pub fn push_border( &mut self, bounds: PxRect, widths: PxSideOffsets, top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, radius: PxCornerRadius, )
Push a normal border.
sourcepub fn push_nine_patch_border(
&mut self,
bounds: PxRect,
source: NinePatchSource,
widths: PxSideOffsets,
fill: bool,
repeat_horizontal: RepeatMode,
repeat_vertical: RepeatMode,
)
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.
sourcepub fn push_text(
&mut self,
clip_rect: PxRect,
font_id: FontId,
glyphs: &[GlyphInstance],
color: FrameValue<Rgba>,
options: GlyphOptions,
)
pub fn push_text( &mut self, clip_rect: PxRect, font_id: FontId, glyphs: &[GlyphInstance], color: FrameValue<Rgba>, options: GlyphOptions, )
Push a text run.
sourcepub 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,
)
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.
sourcepub fn push_color(&mut self, clip_rect: PxRect, color: FrameValue<Rgba>)
pub fn push_color(&mut self, clip_rect: PxRect, color: FrameValue<Rgba>)
Push a color rectangle.
sourcepub fn push_backdrop_filter(&mut self, clip_rect: PxRect, filters: &[FilterOp])
pub fn push_backdrop_filter(&mut self, clip_rect: PxRect, filters: &[FilterOp])
Push a filter that applies to all rendered pixels behind clip_rect
.
sourcepub 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,
)
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.
sourcepub 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,
)
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.
sourcepub 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,
)
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.
sourcepub fn push_line(
&mut self,
clip_rect: PxRect,
color: Rgba,
style: LineStyle,
orientation: LineOrientation,
)
pub fn push_line( &mut self, clip_rect: PxRect, color: Rgba, style: LineStyle, orientation: LineOrientation, )
Push a styled vertical or horizontal line.
sourcepub fn push_extension(
&mut self,
extension_id: ApiExtensionId,
payload: ApiExtensionPayload,
)
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.
sourcepub fn pop_extension(&mut self, extension_id: ApiExtensionId)
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.
sourcepub fn set_backface_visibility(&mut self, visible: bool)
pub fn set_backface_visibility(&mut self, visible: bool)
Sets the backface visibility of all display items after this call.
sourcepub fn parallel_split(&self) -> Self
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
.
sourcepub fn parallel_fold(&mut self, split: Self)
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.
sourcepub fn finalize(self) -> DisplayList
pub fn finalize(self) -> DisplayList
Returns the display list.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DisplayListBuilder
impl RefUnwindSafe for DisplayListBuilder
impl Send for DisplayListBuilder
impl Sync for DisplayListBuilder
impl Unpin for DisplayListBuilder
impl UnwindSafe for DisplayListBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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