pub struct OffscreenRenderingContext {
parent_context: Rc<WindowRenderingContext>,
size: Cell<PhysicalSize<u32>>,
framebuffer: RefCell<Framebuffer>,
}
Fields§
§parent_context: Rc<WindowRenderingContext>
§size: Cell<PhysicalSize<u32>>
§framebuffer: RefCell<Framebuffer>
Implementations§
Source§impl OffscreenRenderingContext
impl OffscreenRenderingContext
pub fn parent_context(&self) -> &WindowRenderingContext
pub fn render_to_parent_callback( &self, ) -> Option<Box<dyn Fn(&Context, Rect<i32, UnknownUnit>) + Send + Sync>>
Trait Implementations§
Source§impl RenderingContext for OffscreenRenderingContext
impl RenderingContext for OffscreenRenderingContext
Source§fn size(&self) -> PhysicalSize<u32>
fn size(&self) -> PhysicalSize<u32>
Get the current size of this
RenderingContext
.Source§fn resize(&self, new_size: PhysicalSize<u32>)
fn resize(&self, new_size: PhysicalSize<u32>)
Resizes the rendering surface to the given size.
Source§fn prepare_for_rendering(&self)
fn prepare_for_rendering(&self)
Prepare this
RenderingContext
to be rendered upon by Servo. For instance,
by binding a framebuffer to the current OpenGL context.Source§fn present(&self)
fn present(&self)
Presents the rendered frame to the screen. In a double-buffered context, this would
swap buffers.
Source§fn make_current(&self) -> Result<(), Error>
fn make_current(&self) -> Result<(), Error>
Makes the context the current OpenGL context for this thread.
After calling this function, it is valid to use OpenGL rendering
commands.
Source§fn gleam_gl_api(&self) -> Rc<dyn Gl>
fn gleam_gl_api(&self) -> Rc<dyn Gl>
Returns the
gleam
version of the OpenGL or GLES API.Source§fn glow_gl_api(&self) -> Arc<Context>
fn glow_gl_api(&self) -> Arc<Context>
Returns the OpenGL or GLES API.
Source§fn create_texture(
&self,
surface: Surface<Device<Device, Device>, Device>,
) -> Option<(SurfaceTexture<Device<Device, Device>, Device>, u32, Size2D<i32, UnknownUnit>)>
fn create_texture( &self, surface: Surface<Device<Device, Device>, Device>, ) -> Option<(SurfaceTexture<Device<Device, Device>, Device>, u32, Size2D<i32, UnknownUnit>)>
Creates a texture from a given surface and returns the surface texture,
the OpenGL texture object, and the size of the surface. Default to
None
.Source§fn destroy_texture(
&self,
surface_texture: SurfaceTexture<Device<Device, Device>, Device>,
) -> Option<Surface<Device<Device, Device>, Device>>
fn destroy_texture( &self, surface_texture: SurfaceTexture<Device<Device, Device>, Device>, ) -> Option<Surface<Device<Device, Device>, Device>>
Destroys the texture and returns the surface. Default to
None
.Source§fn connection(&self) -> Option<Connection<Device<Device, Device>, Device>>
fn connection(&self) -> Option<Connection<Device<Device, Device>, Device>>
The connection to the display server for WebGL. Default to
None
.Source§fn read_to_image(
&self,
source_rectangle: Box2D<i32, DevicePixel>,
) -> Option<ImageBuffer<Rgba<u8>, Vec<u8>>>
fn read_to_image( &self, source_rectangle: Box2D<i32, DevicePixel>, ) -> Option<ImageBuffer<Rgba<u8>, Vec<u8>>>
Read the contents of this [
Renderingcontext
] into an in-memory image. If the
image cannot be read (for instance, if no rendering has taken place yet), then
None
is returned. Read moreSource§fn size2d(&self) -> Size2D<u32, DevicePixel>
fn size2d(&self) -> Size2D<u32, DevicePixel>
Get the current size of this
RenderingContext
as Size2D
.Auto Trait Implementations§
impl !Freeze for OffscreenRenderingContext
impl !RefUnwindSafe for OffscreenRenderingContext
impl !Send for OffscreenRenderingContext
impl !Sync for OffscreenRenderingContext
impl Unpin for OffscreenRenderingContext
impl !UnwindSafe for OffscreenRenderingContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert