Struct zng_app::view_process::ViewRenderer
source · pub struct ViewRenderer(/* private fields */);
Expand description
Weak handle to a window or view.
This is only a weak reference, every method returns ViewProcessOffline
if the
window is closed or view is disposed.
Implementations§
source§impl ViewRenderer
impl ViewRenderer
sourcepub fn generation(&self) -> Result<ViewProcessGen, ViewProcessOffline>
pub fn generation(&self) -> Result<ViewProcessGen, ViewProcessOffline>
Returns the view-process generation on which the renderer was created.
sourcepub fn use_image(
&self,
image: &ViewImage,
) -> Result<ImageTextureId, ViewProcessOffline>
pub fn use_image( &self, image: &ViewImage, ) -> Result<ImageTextureId, ViewProcessOffline>
Use an image resource in the window renderer.
Returns the image texture ID.
sourcepub fn update_image_use(
&mut self,
tex_id: ImageTextureId,
image: &ViewImage,
) -> Result<(), ViewProcessOffline>
pub fn update_image_use( &mut self, tex_id: ImageTextureId, image: &ViewImage, ) -> Result<(), ViewProcessOffline>
Replace the image resource in the window renderer.
sourcepub fn delete_image_use(
&mut self,
tex_id: ImageTextureId,
) -> Result<(), ViewProcessOffline>
pub fn delete_image_use( &mut self, tex_id: ImageTextureId, ) -> Result<(), ViewProcessOffline>
Delete the image resource in the window renderer.
sourcepub fn add_font_face(
&self,
bytes: Vec<u8>,
index: u32,
) -> Result<FontFaceId, ViewProcessOffline>
pub fn add_font_face( &self, bytes: Vec<u8>, index: u32, ) -> Result<FontFaceId, ViewProcessOffline>
Add a raw font resource to the window renderer.
Returns the new font face ID, unique for this renderer.
sourcepub fn delete_font_face(
&self,
font_face_id: FontFaceId,
) -> Result<(), ViewProcessOffline>
pub fn delete_font_face( &self, font_face_id: FontFaceId, ) -> Result<(), ViewProcessOffline>
Delete the font resource in the window renderer.
sourcepub fn add_font(
&self,
font_face_id: FontFaceId,
glyph_size: Px,
options: FontOptions,
variations: Vec<(FontVariationName, f32)>,
) -> Result<FontId, ViewProcessOffline>
pub fn add_font( &self, font_face_id: FontFaceId, glyph_size: Px, options: FontOptions, variations: Vec<(FontVariationName, f32)>, ) -> Result<FontId, ViewProcessOffline>
Add a sized font to the window renderer.
Returns the new font ID, unique for this renderer.
sourcepub fn delete_font(&self, font_id: FontId) -> Result<(), ViewProcessOffline>
pub fn delete_font(&self, font_id: FontId) -> Result<(), ViewProcessOffline>
Delete the sized font.
sourcepub fn frame_image(
&self,
mask: Option<ImageMaskMode>,
) -> Result<ViewImage, ViewProcessOffline>
pub fn frame_image( &self, mask: Option<ImageMaskMode>, ) -> Result<ViewImage, ViewProcessOffline>
Create a new image resource from the current rendered frame.
sourcepub fn frame_image_rect(
&self,
rect: PxRect,
mask: Option<ImageMaskMode>,
) -> Result<ViewImage, ViewProcessOffline>
pub fn frame_image_rect( &self, rect: PxRect, mask: Option<ImageMaskMode>, ) -> Result<ViewImage, ViewProcessOffline>
Create a new image resource from a selection of the current rendered frame.
sourcepub fn render(&self, frame: FrameRequest) -> Result<(), ViewProcessOffline>
pub fn render(&self, frame: FrameRequest) -> Result<(), ViewProcessOffline>
Render a new frame.
sourcepub fn render_update(
&self,
frame: FrameUpdateRequest,
) -> Result<(), ViewProcessOffline>
pub fn render_update( &self, frame: FrameUpdateRequest, ) -> Result<(), ViewProcessOffline>
Update the current frame and re-render it.
sourcepub fn render_extension_raw(
&self,
extension_id: ApiExtensionId,
request: ApiExtensionPayload,
) -> Result<ApiExtensionPayload, ViewProcessOffline>
pub fn render_extension_raw( &self, extension_id: ApiExtensionId, request: ApiExtensionPayload, ) -> Result<ApiExtensionPayload, ViewProcessOffline>
Call a render extension with custom encoded payload.
sourcepub fn render_extension<I, O>(
&self,
extension_id: ApiExtensionId,
request: &I,
) -> Result<Result<O, ApiExtensionRecvError>, ViewProcessOffline>where
I: Serialize,
O: DeserializeOwned,
pub fn render_extension<I, O>(
&self,
extension_id: ApiExtensionId,
request: &I,
) -> Result<Result<O, ApiExtensionRecvError>, ViewProcessOffline>where
I: Serialize,
O: DeserializeOwned,
Call a render extension with serialized payload.
Trait Implementations§
source§impl Clone for ViewRenderer
impl Clone for ViewRenderer
source§fn clone(&self) -> ViewRenderer
fn clone(&self) -> ViewRenderer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ViewRenderer
impl Debug for ViewRenderer
source§impl PartialEq for ViewRenderer
impl PartialEq for ViewRenderer
impl Eq for ViewRenderer
Auto Trait Implementations§
impl Freeze for ViewRenderer
impl RefUnwindSafe for ViewRenderer
impl Send for ViewRenderer
impl Sync for ViewRenderer
impl Unpin for ViewRenderer
impl UnwindSafe for ViewRenderer
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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