Struct components::platform::core::Framebuffer
source · [−]pub struct Framebuffer { /* private fields */ }
Implementations
sourceimpl Framebuffer
impl Framebuffer
sourcepub fn set_window_size(&self, width: i32, height: i32)
pub fn set_window_size(&self, width: i32, height: i32)
set_window_size: @window: A #Stage @width: A width, in pixels @height: A height, in pixels
Sets the size of the window, taking into account any window border. This corresponds to the window’s available area for its child, minus the area occupied by the window’s toolbar, if it’s enabled.
Trait Implementations
sourceimpl AsRef<Framebuffer> for Framebuffer
impl AsRef<Framebuffer> for Framebuffer
sourcefn as_ref(&self) -> &Framebuffer
fn as_ref(&self) -> &Framebuffer
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl AsRef<FramebufferType> for Framebuffer
impl AsRef<FramebufferType> for Framebuffer
sourcefn as_ref(&self) -> &FramebufferType
fn as_ref(&self) -> &FramebufferType
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Debug for Framebuffer
impl Debug for Framebuffer
sourceimpl Default for Framebuffer
impl Default for Framebuffer
sourcefn default() -> Framebuffer
fn default() -> Framebuffer
Returns the “default value” for a type. Read more
sourceimpl Display for Framebuffer
impl Display for Framebuffer
impl Is<Framebuffer> for Framebuffer
impl Object for Framebuffer
Auto Trait Implementations
impl !RefUnwindSafe for Framebuffer
impl !Send for Framebuffer
impl !Sync for Framebuffer
impl Unpin for Framebuffer
impl !UnwindSafe for Framebuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<O> FramebufferExt for O where
O: Is<Framebuffer>,
impl<O> FramebufferExt for O where
O: Is<Framebuffer>,
sourcefn add_fence_callback<P>(&self, callback: P) -> Option<FenceClosure> where
P: 'static + Fn(&Fence),
fn add_fence_callback<P>(&self, callback: P) -> Option<FenceClosure> where
P: 'static + Fn(&Fence),
Calls the provided callback when all previously-submitted commands have been executed by the GPU. Read more
sourcefn allocate(&self) -> bool
fn allocate(&self) -> bool
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
sourcefn cancel_fence_callback(&self, closure: &mut FenceClosure)
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
sourcefn clear(&self, buffers: u64, color: &Color)
fn clear(&self, buffers: u64, 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
sourcefn clear4f(&self, buffers: u64, red: f32, green: f32, blue: f32, alpha: f32)
fn clear4f(&self, buffers: u64, 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
sourcefn discard_buffers(&self, buffers: u64)
fn discard_buffers(&self, buffers: u64)
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
sourcefn draw_multitextured_rectangle(
&self,
pipeline: &Pipeline,
x_1: f32,
y_1: f32,
x_2: f32,
y_2: f32,
tex_coords: &[f32]
)
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
sourcefn draw_rectangle(
&self,
pipeline: &Pipeline,
x_1: f32,
y_1: f32,
x_2: f32,
y_2: f32
)
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
sourcefn 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
)
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
sourcefn finish(&self)
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
sourcefn frustum(
&self,
left: f32,
right: f32,
bottom: f32,
top: f32,
z_near: f32,
z_far: f32
)
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
sourcefn alpha_bits(&self) -> i32
fn alpha_bits(&self) -> i32
Retrieves the number of alpha bits of self
Read more
sourcefn color_mask(&self) -> ColorMask
fn 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
sourcefn context(&self) -> Option<Context>
fn 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
sourcefn depth_bits(&self) -> i32
fn depth_bits(&self) -> i32
Retrieves the number of depth bits of self
Read more
sourcefn depth_texture(&self) -> Option<Texture>
fn depth_texture(&self) -> Option<Texture>
Retrieves the depth buffer of self
as a Texture
. You need to
call framebuffer_get_depth_texture(fb, true); before using this
function. Read more
sourcefn depth_texture_enabled(&self) -> bool
fn depth_texture_enabled(&self) -> bool
Queries whether texture based depth buffer has been enabled via
Framebuffer::set_depth_texture_enabled
. Read more
sourcefn depth_write_enabled(&self) -> bool
fn 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
sourcefn dither_enabled(&self) -> bool
fn 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
sourcefn green_bits(&self) -> i32
fn green_bits(&self) -> i32
Retrieves the number of green bits of self
Read more
fn is_stereo(&self) -> bool
sourcefn modelview_matrix(&self) -> Matrix
fn modelview_matrix(&self) -> Matrix
Stores the current model-view matrix in matrix
. Read more
sourcefn projection_matrix(&self) -> Matrix
fn projection_matrix(&self) -> Matrix
Stores the current projection matrix in matrix
. Read more
sourcefn samples_per_pixel(&self) -> i32
fn 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
sourcefn stereo_mode(&self) -> StereoMode
fn stereo_mode(&self) -> StereoMode
Gets the current StereoMode
, which defines which stereo buffers
should be drawn to. See Framebuffer::set_stereo_mode
. Read more
sourcefn viewport_height(&self) -> f32
fn 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
sourcefn viewport_width(&self) -> f32
fn 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
sourcefn viewport_x(&self) -> f32
fn 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
sourcefn viewport_y(&self) -> f32
fn 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
sourcefn identity_matrix(&self)
fn identity_matrix(&self)
Resets the current model-view matrix to the identity matrix.
sourcefn orthographic(
&self,
x_1: f32,
y_1: f32,
x_2: f32,
y_2: f32,
near: f32,
far: f32
)
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
sourcefn perspective(&self, fov_y: f32, aspect: f32, z_near: f32, z_far: f32)
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
sourcefn pop_clip(&self)
fn pop_clip(&self)
Reverts the clipping region to the state before the last call to
Framebuffer::push_scissor_clip
, Framebuffer::push_rectangle_clip
framebuffer_push_path_clip
, or Framebuffer::push_primitive_clip
. Read more
sourcefn pop_matrix(&self)
fn pop_matrix(&self)
Restores the model-view matrix on the top of the matrix stack.
sourcefn push_matrix(&self)
fn push_matrix(&self)
Copies the current model-view matrix onto the matrix stack. The matrix
can later be restored with Framebuffer::pop_matrix
. Read more
sourcefn push_primitive_clip(
&self,
primitive: &Primitive,
bounds_x1: f32,
bounds_y1: f32,
bounds_x2: f32,
bounds_y2: f32
)
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
sourcefn push_rectangle_clip(&self, x_1: f32, y_1: f32, x_2: f32, y_2: f32)
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
sourcefn push_scissor_clip(&self, x: i32, y: i32, width: i32, height: i32)
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
sourcefn read_pixels(
&self,
x: i32,
y: i32,
width: i32,
height: i32,
format: PixelFormat,
pixels: &[u8]
) -> bool
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
fn directly. Read more
sourcefn read_pixels_into_bitmap(
&self,
x: i32,
y: i32,
source: ReadPixelsFlags,
bitmap: &Bitmap
) -> bool
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
sourcefn resolve_samples(&self)
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 fn (or
Framebuffer::resolve_samples_region
) to explicitly resolve
the point samples into values for the final color buffer. Read more
sourcefn resolve_samples_region(&self, x: i32, y: i32, width: i32, height: i32)
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 fn (or
Framebuffer::resolve_samples
) to explicitly resolve the point
samples into values for the final color buffer. Read more
sourcefn rotate(&self, angle: f32, x: f32, y: f32, z: f32)
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
sourcefn rotate_euler(&self, euler: &Euler)
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
sourcefn rotate_quaternion(&self, quaternion: &Quaternion)
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
sourcefn scale(&self, x: f32, y: f32, z: f32)
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
sourcefn set_color_mask(&self, color_mask: ColorMask)
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
sourcefn set_depth_texture_enabled(&self, enabled: bool)
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
sourcefn set_depth_write_enabled(&self, depth_write_enabled: bool)
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
sourcefn set_dither_enabled(&self, dither_enabled: bool)
fn set_dither_enabled(&self, dither_enabled: bool)
Enables or disabled dithering if supported by the hardware. Read more
sourcefn set_modelview_matrix(&self, matrix: &Matrix)
fn set_modelview_matrix(&self, matrix: &Matrix)
Sets matrix
as the new model-view matrix. Read more
sourcefn set_projection_matrix(&self, matrix: &Matrix)
fn set_projection_matrix(&self, matrix: &Matrix)
Sets matrix
as the new projection matrix. Read more
sourcefn set_samples_per_pixel(&self, samples_per_pixel: i32)
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
sourcefn set_stereo_mode(&self, stereo_mode: StereoMode)
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
sourcefn set_viewport(&self, x: f32, y: f32, width: f32, height: f32)
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
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
fn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.