Skip to main content

SurfaceRenderTarget

Struct SurfaceRenderTarget 

Source
pub struct SurfaceRenderTarget { /* private fields */ }
Expand description

Vello render target that writes to a surface in memory: a layer.

A scene is rendered into the pixels of the surface in whatever rendering mode draws it; a layer that stays on the GPU is part of the GPU modes (design document, stages 7 and 8).

Implementations§

Source§

impl SurfaceRenderTarget

Source

pub fn new(create_info: SurfaceRenderTargetCreateInfo) -> Self

Creates a surface render target. A surface is at least one pixel in each direction.

§Panics

Panics when the surface is larger than a scene can be.

Source

pub fn properties(&self) -> RenderTargetProperties

The properties of this render target.

Source

pub fn has_render_context_affinity(&self) -> bool

Whether the render target lives on a GPU context and can only be used with it. Never the case for pixels in memory.

Source§

impl SurfaceRenderTarget

Source

pub fn has_content(&self) -> bool

Whether a scene was rendered into the surface.

Source

pub fn create_drawing_context_with( &self, disposables: Vec<Box<dyn FnOnce()>>, ) -> DrawingContextImpl

Creates a drawing context that draws into the surface. disposables run in order when the context is disposed, after the scene was rendered into the pixels.

Trait Implementations§

Source§

impl IBitmapImpl for SurfaceRenderTarget

Source§

fn dpi(&self) -> Vector

The dots per inch (DPI) of the image.
Source§

fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.
Source§

fn version(&self) -> i32

Version of the pixel data: incremented whenever the content changes.
Source§

fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a stream, encoded as selected by options.
Source§

fn dispose(&self)

Releases the bitmap’s resources.
Source§

fn as_any(&self) -> &dyn Any

Lets the backend recover its concrete type.
Source§

fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>

The bitmap viewed as IReadableBitmapImpl, when its pixels can be read.
Source§

impl IDrawableBitmapImpl for SurfaceRenderTarget

Source§

fn image(&self) -> Option<ImageData>

The current pixels of the bitmap as an image of premultiplied RGBA pixels, or None once the bitmap is disposed. The image is kept until the pixels change: drawing a bitmap again copies nothing.
Source§

impl IDrawingContextLayerImpl for SurfaceRenderTarget

Source§

fn blit(&self, context: &mut dyn IDrawingContextImpl)

Does optimized blit with source OVER overlay mode.
Source§

fn can_blit(&self) -> bool

Whether the layer can be blitted with blit.
Source§

fn is_corrupted(&self) -> bool

Whether the layer’s contents have been lost.
Source§

fn create_shared_snapshot(&self) -> Arc<SharedBitmapImpl> ⓘ

The contents of the layer as a bitmap that can leave the render thread. A layer itself stays on the thread that created it.
Source§

fn create_drawing_context(&self) -> Box<dyn IDrawingContextImpl>

Creates a drawing context that draws into the layer.
Source§

fn as_layer_with_render_context_affinity( &self, ) -> Option<&dyn IDrawingContextLayerWithRenderContextAffinityImpl>

The layer as one that may be bound to the render context it was created with, if it is one.

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> AutoreleaseSafe for T
where T: ?Sized,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.