Skip to main content

Surface

Trait Surface 

Source
pub trait Surface {
    type Uniforms;
    type CoordinateSpace: CoordinateSpace;
    type Pixel;

    // Required methods
    fn set_shader<T: Shader<Self::Uniforms, Self::CoordinateSpace, Self::Pixel> + 'static>(
        &mut self,
        shader: T,
    );
    fn clear_shader(&mut self);
    fn set_rect(&mut self, rect: Rectangle<Self::CoordinateSpace>);
    fn set_opacity(&mut self, opacity: Fract8);
    fn set_visible(&mut self, visible: bool);
    fn set_offset(&mut self, offset: Coordinates<Self::CoordinateSpace>);
}
Expand description

A rectangular set of pixels that can be drawn on with a Shader

Required Associated Types§

Source

type Uniforms

The type of uniform data that is supported by this shader

Source

type CoordinateSpace: CoordinateSpace

The coordiante space over which this shader can operate

Source

type Pixel

The format of the pixels produced by this shader

Required Methods§

Source

fn set_shader<T: Shader<Self::Uniforms, Self::CoordinateSpace, Self::Pixel> + 'static>( &mut self, shader: T, )

Sets the shader for this surface

Source

fn clear_shader(&mut self)

Clears the shader

Source

fn set_rect(&mut self, rect: Rectangle<Self::CoordinateSpace>)

Changes the size of the surface

Source

fn set_opacity(&mut self, opacity: Fract8)

Sets the opacity of this surface, where 0 is completely transparent and 255 is completely opaque

Source

fn set_visible(&mut self, visible: bool)

Sets the visibility of the surface without adjusting the stored opacity

Source

fn set_offset(&mut self, offset: Coordinates<Self::CoordinateSpace>)

Sets the scroll offset of the surface without adjusting shader coordinates

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DerefMut<Target = S>, S: Surface> Surface for [T]

Source§

type Uniforms = <S as Surface>::Uniforms

Source§

type CoordinateSpace = <S as Surface>::CoordinateSpace

Source§

type Pixel = <S as Surface>::Pixel

Source§

fn set_shader<SH: Shader<Self::Uniforms, Self::CoordinateSpace, Self::Pixel> + 'static>( &mut self, _shader: SH, )

Source§

fn clear_shader(&mut self)

Source§

fn set_rect(&mut self, rect: Rectangle<Self::CoordinateSpace>)

Source§

fn set_opacity(&mut self, opacity: Fract8)

Source§

fn set_visible(&mut self, visible: bool)

Source§

fn set_offset(&mut self, offset: Coordinates<Self::CoordinateSpace>)

Implementors§

Source§

impl<U, Space: CoordinateSpace, P> Surface for NullSurface<U, Space, P>