Struct Onscreen

Source
pub struct Onscreen(/* private fields */);

Implementations§

Source§

impl Onscreen

Source

pub fn new(context: &Context, width: i32, height: i32) -> Onscreen

Instantiates an “unallocated” Onscreen framebuffer that may be configured before later being allocated, either implicitly when it is first used or explicitly via Framebuffer::allocate.

§context

A Context

§width

The desired framebuffer width

§height

The desired framebuffer height

§Returns

A newly instantiated Onscreen framebuffer

Source

pub fn add_dirty_callback<P: Fn(&Onscreen, &OnscreenDirtyInfo) + 'static>( &self, callback: P, ) -> Option<OnscreenDirtyClosure>

Installs a callback function that will be called whenever the window system has lost the contents of a region of the onscreen buffer and the application should redraw it to repair the buffer. For example this may happen in a window system without a compositor if a window that was previously covering up the onscreen window has been moved causing a region of the onscreen to be exposed.

The callback will be passed a OnscreenDirtyInfo struct which decribes a rectangle containing the newly dirtied region. Note that this may be called multiple times to describe a non-rectangular region composed of multiple smaller rectangles.

The dirty events are separate from FrameEvent::Sync events so the application should also listen for this event before rendering the dirty region to ensure that the framebuffer is actually ready for rendering.

§callback

A callback function to call for dirty events

§user_data

A private pointer to be passed to callback

§Returns

a OnscreenDirtyClosure pointer that can be used to remove the callback and associated user_data later.

Source

pub fn add_frame_callback<P: Fn(&Onscreen, &FrameEvent, &FrameInfo) + 'static>( &self, callback: P, ) -> Option<FrameClosure>

Installs a callback function that will be called for significant events relating to the given self framebuffer.

The callback will be used to notify when the system compositor is ready for this application to render a new frame. In this case FrameEvent::Sync will be passed as the event argument to the given callback in addition to the FrameInfo corresponding to the frame beeing acknowledged by the compositor.

The callback will also be called to notify when the frame has ended. In this case FrameEvent::Complete will be passed as the event argument to the given callback in addition to the FrameInfo corresponding to the newly presented frame. The meaning of “ended” here simply means that no more timing information will be collected within the corresponding FrameInfo and so this is a good opportunity to analyse the given info. It does not necessarily mean that the GPU has finished rendering the corresponding frame.

We highly recommend throttling your application according to FrameEvent::Sync events so that your application can avoid wasting resources, drawing more frames than your system compositor can display.

§callback

A callback function to call for frame events

§user_data

A private pointer to be passed to callback

§Returns

a FrameClosure pointer that can be used to remove the callback and associated user_data later.

Source

pub fn add_resize_callback<P: Fn(&Onscreen, i32, i32) + 'static>( &self, callback: P, ) -> Option<OnscreenResizeClosure>

Registers a callback with self that will be called whenever the self framebuffer changes size.

The callback can be removed using Onscreen::remove_resize_callback passing the returned closure pointer.

<note>Since Cogl automatically updates the viewport of an self framebuffer that is resized, a resize callback can also be used to track when the viewport has been changed automatically by Cogl in case your application needs more specialized control over the viewport.</note>

<note>A resize callback will only ever be called while dispatching Cogl events from the system mainloop; so for example during cogl_poll_renderer_dispatch. This is so that callbacks shouldn’t occur while an application might have arbitrary locks held for example.</note>

§callback

A CoglOnscreenResizeCallback to call when the self changes size.

§user_data

Private data to be passed to callback.

§destroy
§Returns

a OnscreenResizeClosure pointer that can be used to remove the callback and associated user_data later.

Source

pub fn get_buffer_age(&self) -> i32

Gets the current age of the buffer contents.

This function allows applications to query the age of the current back buffer contents for a Onscreen as the number of frames elapsed since the contents were most recently defined.

These age values exposes enough information to applications about how Cogl internally manages back buffers to allow applications to re-use the contents of old frames and minimize how much must be redrawn for the next frame.

The back buffer contents can either be reported as invalid (has an age of 0) or it may be reported to be the same contents as from n frames prior to the current frame.

The queried value remains valid until the next buffer swap.

<note>One caveat is that under X11 the buffer age does not reflect changes to buffer contents caused by the window systems. X11 applications must track Expose events to determine what buffer regions need to additionally be repaired each frame.</note>

The recommended way to take advantage of this buffer age api is to build up a circular buffer of length 3 for tracking damage regions over the last 3 frames and when starting a new frame look at the age of the buffer and combine the damage regions for the current frame with the damage regions of previous age frames so you know everything that must be redrawn to update the old contents for the new frame.

<note>If the system doesn’t not support being able to track the age of back buffers then this function will always return 0 which implies that the contents are undefined.</note>

<note>The FeatureID::OglFeatureIdBufferAge feature can optionally be explicitly checked to determine if Cogl is currently tracking the age of Onscreen back buffer contents. If this feature is missing then this function will always return 0.</note>

§Returns

The age of the buffer contents or 0 when the buffer contents are undefined.

Source

pub fn get_frame_counter(&self) -> i64

Gets the value of the framebuffers frame counter. This is a counter that increases by one each time Onscreen::swap_buffers or Onscreen::swap_region is called.

§Returns

the current frame counter value

Source

pub fn get_resizable(&self) -> bool

Lets you query whether self has been marked as resizable via the Onscreen::set_resizable api.

By default, if possible, a self will be created by Cogl as non resizable, but it is not guaranteed that this is always possible for all window systems.

<note>If cogl_onscreen_set_resizable(self, true) has been previously called then this function will return true, but it’s possible that the current windowing system being used does not support window resizing (consider fullscreen windows on a phone or a TV). This function is not aware of whether resizing is truly meaningful with your window system, only whether the self has been marked as resizable.</note>

§Returns

Returns whether self has been marked as resizable or not.

Source

pub fn hide(&self)

This requests to make self invisible to the user.

Actually the precise semantics of this function depend on the window system currently in use, and if you don’t have a multi-windowining system this function may in-fact do nothing.

This function does not implicitly allocate the given self framebuffer before hiding it.

<note>Since Cogl doesn’t explicitly track the visibility status of onscreen framebuffers it wont try to avoid redundant window system requests e.g. to show an already visible window. This also means that it’s acceptable to alternatively use native APIs to show and hide windows without confusing Cogl.</note>

Source

pub fn remove_dirty_callback(&self, closure: &mut OnscreenDirtyClosure)

Removes a callback and associated user data that were previously registered using Onscreen::add_dirty_callback.

If a destroy callback was passed to Onscreen::add_dirty_callback to destroy the user data then this will also get called.

§closure

A OnscreenDirtyClosure returned from Onscreen::add_dirty_callback

Source

pub fn remove_frame_callback(&self, closure: &mut FrameClosure)

Removes a callback and associated user data that were previously registered using Onscreen::add_frame_callback.

If a destroy callback was passed to Onscreen::add_frame_callback to destroy the user data then this will get called.

§closure

A FrameClosure returned from Onscreen::add_frame_callback

Source

pub fn remove_resize_callback(&self, closure: &mut OnscreenResizeClosure)

Removes a resize callback and user_data pair that were previously associated with self via Onscreen::add_resize_callback.

§closure

An identifier returned from Onscreen::add_resize_callback

Source

pub fn set_resizable(&self, resizable: bool)

Lets you request Cogl to mark an self framebuffer as resizable or not.

By default, if possible, a self will be created by Cogl as non resizable, but it is not guaranteed that this is always possible for all window systems.

<note>Cogl does not know whether marking the self framebuffer is truly meaningful for your current window system (consider applications being run fullscreen on a phone or TV) so this function may not have any useful effect. If you are running on a multi windowing system such as X11 or Win32 or OSX then Cogl will request to the window system that users be allowed to resize the self, although it’s still possible that some other window management policy will block this possibility.</note>

<note>Whenever an self framebuffer is resized the viewport will be automatically updated to match the new size of the framebuffer with an origin of (0,0). If your application needs more specialized control of the viewport it will need to register a resize handler using Onscreen::add_resize_callback so that it can track when the viewport has been changed automatically.</note>

Source

pub fn set_swap_throttled(&self, throttled: bool)

Requests that the given self framebuffer should have swap buffer requests (made using Onscreen::swap_buffers) throttled either by a displays vblank period or perhaps some other mechanism in a composited environment.

§throttled

Whether swap throttling is wanted or not.

Source

pub fn show(&self)

This requests to make self visible to the user.

Actually the precise semantics of this function depend on the window system currently in use, and if you don’t have a multi-windowining system this function may in-fact do nothing.

This function will implicitly allocate the given self framebuffer before showing it if it hasn’t already been allocated.

When using the Wayland winsys calling this will set the surface to a toplevel type which will make it appear. If the application wants to set a different type for the surface, it can avoid calling Onscreen::show and set its own type directly with the Wayland client API via cogl_wayland_onscreen_get_surface.

<note>Since Cogl doesn’t explicitly track the visibility status of onscreen framebuffers it wont try to avoid redundant window system requests e.g. to show an already visible window. This also means that it’s acceptable to alternatively use native APIs to show and hide windows without confusing Cogl.</note>

Source

pub fn swap_buffers(&self)

Swaps the current back buffer being rendered too, to the front for display.

This function also implicitly discards the contents of the color, depth and stencil buffers as if Framebuffer::discard_buffers were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.

<note>It is highly recommended that applications use Onscreen::swap_buffers_with_damage instead whenever possible and also use the Onscreen::get_buffer_age api so they can perform incremental updates to older buffers instead of having to render a full buffer for every frame.</note>

Source

pub fn swap_buffers_with_damage(&self, rectangles: &[i32], n_rectangles: i32)

Swaps the current back buffer being rendered too, to the front for display and provides information to any system compositor about what regions of the buffer have changed (damage) with respect to the last swapped buffer.

This function has the same semantics as cogl_framebuffer_swap_buffers except that it additionally allows applications to pass a list of damaged rectangles which may be passed on to a compositor so that it can minimize how much of the screen is redrawn in response to this applications newly swapped front buffer.

For example if your application is only animating a small object in the corner of the screen and everything else is remaining static then it can help the compositor to know that only the bottom right corner of your newly swapped buffer has really changed with respect to your previously swapped front buffer.

If n_rectangles is 0 then the whole buffer will implicitly be reported as damaged as if Onscreen::swap_buffers had been called.

This function also implicitly discards the contents of the color, depth and stencil buffers as if Framebuffer::discard_buffers were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame. If you want to perform incremental updates to older back buffers then please refer to the Onscreen::get_buffer_age api.

Whenever possible it is recommended that applications use this function instead of Onscreen::swap_buffers to improve performance when running under a compositor.

<note>It is highly recommended to use this API in conjunction with the Onscreen::get_buffer_age api so that your application can perform incremental rendering based on old back buffers.</note>

§rectangles

An array of integer 4-tuples representing damaged rectangles as (x, y, width, height) tuples.

§n_rectangles

The number of 4-tuples to be read from rectangles

Source

pub fn swap_region(&self, rectangles: &[i32], n_rectangles: i32)

Swaps a region of the back buffer being rendered too, to the front for display. rectangles represents the region as array of n_rectangles each defined by 4 sequential (x, y, width, height) integers.

This function also implicitly discards the contents of the color, depth and stencil buffers as if Framebuffer::discard_buffers were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.

§rectangles

An array of integer 4-tuples representing rectangles as (x, y, width, height) tuples.

§n_rectangles

The number of 4-tuples to be read from rectangles

Trait Implementations§

Source§

impl Clone for Onscreen

Source§

fn clone(&self) -> Onscreen

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Onscreen

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Onscreen

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Hash for Onscreen

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Onscreen

Source§

fn cmp(&self, other: &Onscreen) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: ObjectType> PartialEq<T> for Onscreen

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ObjectType> PartialOrd<T> for Onscreen

Source§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for Onscreen

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl Eq for Onscreen

Source§

impl IsA<Framebuffer> for Onscreen

Source§

impl IsA<Object> for Onscreen

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> Cast for T
where T: ObjectType,

Source§

fn upcast<T>(self) -> T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a superclass or interface T. Read more
Source§

fn upcast_ref<T>(&self) -> &T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a reference of its superclass or interface T. Read more
Source§

fn downcast<T>(self) -> Result<T, Self>
where T: ObjectType, Self: CanDowncast<T>,

Tries to downcast to a subclass or interface implementor T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: ObjectType, Self: CanDowncast<T>,

Tries to downcast to a reference of its subclass or interface implementor T. Read more
Source§

fn dynamic_cast<T>(self) -> Result<T, Self>
where T: ObjectType,

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

fn dynamic_cast_ref<T>(&self) -> Option<&T>
where T: ObjectType,

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

unsafe fn unsafe_cast<T>(self) -> T
where T: ObjectType,

Casts to T unconditionally. Read more
Source§

unsafe fn unsafe_cast_ref<T>(&self) -> &T
where T: ObjectType,

Casts to &T unconditionally. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<O> FramebufferExt for O
where O: IsA<Framebuffer>,

Source§

fn add_fence_callback<P>(&self, callback: P) -> Option<FenceClosure>
where P: Fn(&Fence) + 'static,

Calls the provided callback when all previously-submitted commands have been executed by the GPU. Read more
Source§

fn allocate(&self) -> Result<bool, Error>

Explicitly allocates a configured Framebuffer allowing developers to check and handle any errors that might arise from an unsupported configuration so that fallback configurations may be tried. Read more
Source§

fn cancel_fence_callback(&self, closure: &mut FenceClosure)

Removes a fence previously submitted with Framebuffer::add_fence_callback; the callback will not be called. Read more
Source§

fn clear(&self, buffers: u32, color: &Color)

Clears all the auxiliary buffers identified in the buffers mask, and if that includes the color buffer then the specified color is used. Read more
Source§

fn clear4f(&self, buffers: u32, red: f32, green: f32, blue: f32, alpha: f32)

Clears all the auxiliary buffers identified in the buffers mask, and if that includes the color buffer then the specified color is used. Read more
Source§

fn discard_buffers(&self, buffers: u32)

Declares that the specified buffers no longer need to be referenced by any further rendering commands. This can be an important optimization to avoid subsequent frames of rendering depending on the results of a previous frame. Read more
Source§

fn draw_multitextured_rectangle( &self, pipeline: &Pipeline, x_1: f32, y_1: f32, x_2: f32, y_2: f32, tex_coords: &[f32], )

Draws a textured rectangle to self with the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). As a pipeline may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the pipeline. Read more
Source§

fn draw_rectangle( &self, pipeline: &Pipeline, x_1: f32, y_1: f32, x_2: f32, y_2: f32, )

Draws a rectangle to self with the given pipeline state and with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). Read more
Source§

fn draw_textured_rectangle( &self, pipeline: &Pipeline, x_1: f32, y_1: f32, x_2: f32, y_2: f32, s_1: f32, t_1: f32, s_2: f32, t_2: f32, )

Draws a textured rectangle to self using the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). The top left corner will have texture coordinates of (s_1, t_1) and the bottom right corner will have texture coordinates of (s_2, t_2). Read more
Source§

fn finish(&self)

This blocks the CPU until all pending rendering associated with the specified framebuffer has completed. It’s very rare that developers should ever need this level of synchronization with the GPU and should never be used unless you clearly understand why you need to explicitly force synchronization. Read more
Source§

fn frustum( &self, left: f32, right: f32, bottom: f32, top: f32, z_near: f32, z_far: f32, )

Replaces the current projection matrix with a perspective matrix for a given viewing frustum defined by 4 side clip planes that all cross through the origin and 2 near and far clip planes. Read more
Source§

fn get_alpha_bits(&self) -> i32

Retrieves the number of alpha bits of self Read more
Source§

fn get_blue_bits(&self) -> i32

Retrieves the number of blue bits of self Read more
Source§

fn get_color_mask(&self) -> ColorMask

Gets the current ColorMask of which channels would be written to the current framebuffer. Each bit set in the mask means that the corresponding color would be written. Read more
Source§

fn get_context(&self) -> Option<Context>

Can be used to query the Context a given self was instantiated within. This is the Context that was passed to Onscreen::new for example. Read more
Source§

fn get_depth_bits(&self) -> i32

Retrieves the number of depth bits of self Read more
Source§

fn get_depth_texture(&self) -> Option<Texture>

Retrieves the depth buffer of self as a Texture. You need to call cogl_framebuffer_get_depth_texture(fb, TRUE); before using this function. Read more
Source§

fn get_depth_texture_enabled(&self) -> bool

Queries whether texture based depth buffer has been enabled via Framebuffer::set_depth_texture_enabled. Read more
Source§

fn get_depth_write_enabled(&self) -> bool

Queries whether depth buffer writing is enabled for self. This can be controlled via Framebuffer::set_depth_write_enabled. Read more
Source§

fn get_dither_enabled(&self) -> bool

Returns whether dithering has been requested for the given self. See Framebuffer::set_dither_enabled for more details about dithering. Read more
Source§

fn get_green_bits(&self) -> i32

Retrieves the number of green bits of self Read more
Source§

fn get_height(&self) -> i32

Queries the current height of the given self. Read more
Source§

fn get_is_stereo(&self) -> bool

Source§

fn get_modelview_matrix(&self) -> Matrix

Stores the current model-view matrix in matrix. Read more
Source§

fn get_projection_matrix(&self) -> Matrix

Stores the current projection matrix in matrix. Read more
Source§

fn get_red_bits(&self) -> i32

Retrieves the number of red bits of self Read more
Source§

fn get_samples_per_pixel(&self) -> i32

Gets the number of points that are sampled per-pixel when rasterizing geometry. Usually by default this will return 0 which means that single-sample not multisample rendering has been chosen. When using a GPU supporting multisample rendering it’s possible to increase the number of samples per pixel using Framebuffer::set_samples_per_pixel. Read more
Source§

fn get_stereo_mode(&self) -> StereoMode

Gets the current StereoMode, which defines which stereo buffers should be drawn to. See Framebuffer::set_stereo_mode. Read more
Source§

fn get_viewport_height(&self) -> f32

Queries the height of the viewport as set using Framebuffer::set_viewport or the default value which is the height of the framebuffer. Read more
Source§

fn get_viewport_width(&self) -> f32

Queries the width of the viewport as set using Framebuffer::set_viewport or the default value which is the width of the framebuffer. Read more
Source§

fn get_viewport_x(&self) -> f32

Queries the x coordinate of the viewport origin as set using Framebuffer::set_viewport or the default value which is 0. Read more
Source§

fn get_viewport_y(&self) -> f32

Queries the y coordinate of the viewport origin as set using Framebuffer::set_viewport or the default value which is 0. Read more
Source§

fn get_width(&self) -> i32

Queries the current width of the given self. Read more
Source§

fn identity_matrix(&self)

Resets the current model-view matrix to the identity matrix.
Source§

fn orthographic( &self, x_1: f32, y_1: f32, x_2: f32, y_2: f32, near: f32, far: f32, )

Replaces the current projection matrix with an orthographic projection matrix. Read more
Source§

fn perspective(&self, fov_y: f32, aspect: f32, z_near: f32, z_far: f32)

Replaces the current projection matrix with a perspective matrix based on the provided values. Read more
Source§

fn pop_clip(&self)

Reverts the clipping region to the state before the last call to Framebuffer::push_scissor_clip, Framebuffer::push_rectangle_clip cogl_framebuffer_push_path_clip, or Framebuffer::push_primitive_clip.
Source§

fn pop_matrix(&self)

Restores the model-view matrix on the top of the matrix stack.
Source§

fn push_matrix(&self)

Copies the current model-view matrix onto the matrix stack. The matrix can later be restored with Framebuffer::pop_matrix.
Source§

fn push_primitive_clip( &self, primitive: &Primitive, bounds_x1: f32, bounds_y1: f32, bounds_x2: f32, bounds_y2: f32, )

Sets a new clipping area using a 2D shaped described with a Primitive. The shape must not contain self overlapping geometry and must lie on a single 2D plane. A bounding box of the 2D shape in local coordinates (the same coordinates used to describe the shape) must be given. It is acceptable for the bounds to be larger than the true bounds but behaviour is undefined if the bounds are smaller than the true bounds. Read more
Source§

fn push_rectangle_clip(&self, x_1: f32, y_1: f32, x_2: f32, y_2: f32)

Specifies a modelview transformed rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are transformed by the current model-view matrix. Read more
Source§

fn push_scissor_clip(&self, x: i32, y: i32, width: i32, height: i32)

Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are not transformed by the current model-view matrix. Read more
Source§

fn read_pixels( &self, x: i32, y: i32, width: i32, height: i32, format: PixelFormat, pixels: &[u8], ) -> bool

This is a convenience wrapper around Framebuffer::read_pixels_into_bitmap which allocates a temporary Bitmap to read pixel data directly into the given buffer. The rowstride of the buffer is assumed to be the width of the region times the bytes per pixel of the format. The source for the data is always taken from the color buffer. If you want to use any other rowstride or source, please use the Framebuffer::read_pixels_into_bitmap function directly. Read more
Source§

fn read_pixels_into_bitmap( &self, x: i32, y: i32, source: ReadPixelsFlags, bitmap: &Bitmap, ) -> bool

This reads a rectangle of pixels from the given framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and a rectangle of pixels with the same size as the bitmap is read right and downwards from that point. Read more
Source§

fn resolve_samples(&self)

When point sample rendering (also known as multisample rendering) has been enabled via Framebuffer::set_samples_per_pixel then you can optionally call this function (or Framebuffer::resolve_samples_region) to explicitly resolve the point samples into values for the final color buffer. Read more
Source§

fn resolve_samples_region(&self, x: i32, y: i32, width: i32, height: i32)

When point sample rendering (also known as multisample rendering) has been enabled via Framebuffer::set_samples_per_pixel then you can optionally call this function (or Framebuffer::resolve_samples) to explicitly resolve the point samples into values for the final color buffer. Read more
Source§

fn rotate(&self, angle: f32, x: f32, y: f32, z: f32)

Multiplies the current model-view matrix by one that rotates the model around the axis-vector specified by x, y and z. The rotation follows the right-hand thumb rule so for example rotating by 10 degrees about the axis-vector (0, 0, 1) causes a small counter-clockwise rotation. Read more
Source§

fn rotate_euler(&self, euler: &Euler)

Multiplies the current model-view matrix by one that rotates according to the rotation described by euler. Read more
Source§

fn rotate_quaternion(&self, quaternion: &Quaternion)

Multiplies the current model-view matrix by one that rotates according to the rotation described by quaternion. Read more
Source§

fn scale(&self, x: f32, y: f32, z: f32)

Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values. Read more
Source§

fn set_color_mask(&self, color_mask: ColorMask)

Defines a bit mask of which color channels should be written to the given self. If a bit is set in color_mask that means that color will be written. Read more
Source§

fn set_depth_texture_enabled(&self, enabled: bool)

If enabled is true, the depth buffer used when rendering to self is available as a texture. You can retrieve the texture with Framebuffer::get_depth_texture. Read more
Source§

fn set_depth_write_enabled(&self, depth_write_enabled: bool)

Enables or disables depth buffer writing when rendering to self. If depth writing is enabled for both the framebuffer and the rendering pipeline, and the framebuffer has an associated depth buffer, depth information will be written to this buffer during rendering. Read more
Source§

fn set_dither_enabled(&self, dither_enabled: bool)

Enables or disabled dithering if supported by the hardware. Read more
Source§

fn set_modelview_matrix(&self, matrix: &Matrix)

Sets matrix as the new model-view matrix. Read more
Source§

fn set_projection_matrix(&self, matrix: &Matrix)

Sets matrix as the new projection matrix. Read more
Source§

fn set_samples_per_pixel(&self, samples_per_pixel: i32)

Requires that when rendering to self then n point samples should be made per pixel which will all contribute to the final resolved color for that pixel. The idea is that the hardware aims to get quality similar to what you would get if you rendered everything twice as big (for 4 samples per pixel) and then scaled that image back down with filtering. It can effectively remove the jagged edges of polygons and should be more efficient than if you were to manually render at a higher resolution and downscale because the hardware is often able to take some shortcuts. For example the GPU may only calculate a single texture sample for all points of a single pixel, and for tile based architectures all the extra sample data (such as depth and stencil samples) may be handled on-chip and so avoid increased demand on system memory bandwidth. Read more
Source§

fn set_stereo_mode(&self, stereo_mode: StereoMode)

Sets which stereo buffers should be drawn to. The default is StereoMode::Both, which means that both the left and right buffers will be affected by drawing. For this to have an effect, the display system must support stereo drawables, and the framebuffer must have been created with stereo enabled. (See OnscreenTemplate::set_stereo_enabled, Framebuffer::get_is_stereo.) Read more
Source§

fn set_viewport(&self, x: f32, y: f32, width: f32, height: f32)

Defines a scale and offset for everything rendered relative to the top-left of the destination framebuffer. Read more
Source§

fn transform(&self, matrix: &Matrix)

Multiplies the current model-view matrix by the given matrix. Read more
Source§

fn translate(&self, x: f32, y: f32, z: f32)

Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

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> ObjectExt for T
where T: ObjectType,

Source§

fn is<U>(&self) -> bool
where U: StaticType,

Returns true if the object is an instance of (can be cast to) T.
Source§

fn get_type(&self) -> Type

Source§

fn get_object_class(&self) -> &ObjectClass

Source§

fn set_properties( &self, property_values: &[(&str, &dyn ToValue)], ) -> Result<(), BoolError>

Source§

fn set_property<'a, N>( &self, property_name: N, value: &dyn ToValue, ) -> Result<(), BoolError>
where N: Into<&'a str>,

Source§

fn get_property<'a, N>(&self, property_name: N) -> Result<Value, BoolError>
where N: Into<&'a str>,

Source§

unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)
where QD: 'static,

Safety Read more
Source§

unsafe fn get_qdata<QD>(&self, key: Quark) -> Option<&QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn set_data<QD>(&self, key: &str, value: QD)
where QD: 'static,

Safety Read more
Source§

unsafe fn get_data<QD>(&self, key: &str) -> Option<&QD>
where QD: 'static,

Safety Read more
Source§

unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>
where QD: 'static,

Safety Read more
Source§

fn block_signal(&self, handler_id: &SignalHandlerId)

Source§

fn unblock_signal(&self, handler_id: &SignalHandlerId)

Source§

fn stop_signal_emission(&self, signal_name: &str)

Source§

fn disconnect(&self, handler_id: SignalHandlerId)

Source§

fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + Send + Sync + 'static,

Source§

unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
where F: Fn(&T, &ParamSpec),

Source§

fn notify<'a, N>(&self, property_name: N)
where N: Into<&'a str>,

Source§

fn notify_by_pspec(&self, pspec: &ParamSpec)

Source§

fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool
where N: Into<&'a str>,

Source§

fn get_property_type<'a, N>(&self, property_name: N) -> Option<Type>
where N: Into<&'a str>,

Source§

fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec>
where N: Into<&'a str>,

Source§

fn list_properties(&self) -> Vec<ParamSpec>

Source§

fn connect<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Source§

fn connect_local<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value> + 'static,

Source§

unsafe fn connect_unsafe<'a, N, F>( &self, signal_name: N, after: bool, callback: F, ) -> Result<SignalHandlerId, BoolError>
where N: Into<&'a str>, F: Fn(&[Value]) -> Option<Value>,

Source§

fn emit<'a, N>( &self, signal_name: N, args: &[&dyn ToValue], ) -> Result<Option<Value>, BoolError>
where N: Into<&'a str>,

Source§

fn downgrade(&self) -> WeakRef<T>

Source§

fn bind_property<'a, O, N, M>( &'a self, source_property: N, target: &'a O, target_property: M, ) -> BindingBuilder<'a>
where O: ObjectType, N: Into<&'a str>, M: Into<&'a str>,

Source§

fn ref_count(&self) -> u32

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToValue for T
where T: SetValue + ?Sized,

Source§

fn to_value(&self) -> Value

Returns a Value clone of self.
Source§

fn to_value_type(&self) -> Type

Returns the type identifer of self. 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.
Source§

impl<Super, Sub> CanDowncast<Sub> for Super
where Super: IsA<Super>, Sub: IsA<Super>,

Source§

impl<O> ObjectExt for O
where O: IsA<Object>,