Context

Trait Context 

Source
pub trait Context: Clone + 'static {
    type ColorSourceFragment: ColorSourceFragment;
    type DisplayList: DisplayList;
    type DisplayListBuilder: DisplayListBuilder<DisplayList = Self::DisplayList, ImageFilterFragment = Self::ImageFilterFragment, Paint = Self::Paint, ParagraphBuilder = Self::ParagraphBuilder, PathBuilder = Self::PathBuilder, Texture = Self::Texture>;
    type Fonts: Fonts;
    type FragmentProgram: FragmentProgram;
    type ImageFilterFragment: ImageFilterFragment;
    type Paint: Paint<ColorSourceFragment = Self::ColorSourceFragment, ImageFilterFragment = Self::ImageFilterFragment, Texture = Self::Texture>;
    type ParagraphBuilder: ParagraphBuilder<Texture = Self::Texture, Paint = Self::Paint, Fonts = Self::Fonts>;
    type PathBuilder: PathBuilder;
    type Surface: Surface<DisplayList = Self::DisplayList>;
    type Texture: Texture;

    // Required methods
    fn get_api_capabilities(api: GraphicsApi) -> Option<Capabilities>;
    fn get_capabilities(&self) -> Capabilities;
    unsafe fn create_texture(
        &self,
        contents: Cow<'static, [u8]>,
        descriptor: TextureDescriptor,
    ) -> Result<Self::Texture, &'static str>;
    unsafe fn new_color_source_from_fragment_program(
        &self,
        frag_program: &Self::FragmentProgram,
        samplers: &[Self::Texture],
        uniform_data: &[u8],
    ) -> ColorSource<Self::Texture, Self::ColorSourceFragment>;
    unsafe fn new_image_filter_from_fragment_program(
        &self,
        frag_program: &Self::FragmentProgram,
        samplers: &[Self::Texture],
        uniform_data: &[u8],
    ) -> ImageFilter<Self::ImageFilterFragment>;
}
Expand description

An abstraction over graphics context (like OpenGL or Vulkan context).

This object contains common methods for all backends.

Required Associated Types§

Source

type ColorSourceFragment: ColorSourceFragment

Source

type DisplayList: DisplayList

Source

type DisplayListBuilder: DisplayListBuilder<DisplayList = Self::DisplayList, ImageFilterFragment = Self::ImageFilterFragment, Paint = Self::Paint, ParagraphBuilder = Self::ParagraphBuilder, PathBuilder = Self::PathBuilder, Texture = Self::Texture>

Source

type Fonts: Fonts

Source

type FragmentProgram: FragmentProgram

Source

type ImageFilterFragment: ImageFilterFragment

Source

type Paint: Paint<ColorSourceFragment = Self::ColorSourceFragment, ImageFilterFragment = Self::ImageFilterFragment, Texture = Self::Texture>

Source

type ParagraphBuilder: ParagraphBuilder<Texture = Self::Texture, Paint = Self::Paint, Fonts = Self::Fonts>

Source

type PathBuilder: PathBuilder

Source

type Surface: Surface<DisplayList = Self::DisplayList>

Source

type Texture: Texture

Required Methods§

Source

fn get_api_capabilities(api: GraphicsApi) -> Option<Capabilities>

Gets implementation capabilities depending on graphics API.

Source

fn get_capabilities(&self) -> Capabilities

Gets implementation capabilities of the current instance.

Source

unsafe fn create_texture( &self, contents: Cow<'static, [u8]>, descriptor: TextureDescriptor, ) -> Result<Self::Texture, &'static str>

Creates a new texture.

Source

unsafe fn new_color_source_from_fragment_program( &self, frag_program: &Self::FragmentProgram, samplers: &[Self::Texture], uniform_data: &[u8], ) -> ColorSource<Self::Texture, Self::ColorSourceFragment>

Creates a color source whose pixels are shaded by a fragment program.

Source

unsafe fn new_image_filter_from_fragment_program( &self, frag_program: &Self::FragmentProgram, samplers: &[Self::Texture], uniform_data: &[u8], ) -> ImageFilter<Self::ImageFilterFragment>

Creates an image filter where each pixel is shaded by a fragment program.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§