pub trait DrawingContext: 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§
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§
Sourcefn get_api_capabilities(api: GraphicsApi) -> Option<Capabilities>
fn get_api_capabilities(api: GraphicsApi) -> Option<Capabilities>
Gets implementation capabilities depending on graphics API.
Sourcefn get_capabilities(&self) -> Capabilities
fn get_capabilities(&self) -> Capabilities
Gets implementation capabilities of the current instance.
Sourceunsafe fn create_texture(
&self,
contents: Cow<'static, [u8]>,
descriptor: TextureDescriptor,
) -> Result<Self::Texture, &'static str>
unsafe fn create_texture( &self, contents: Cow<'static, [u8]>, descriptor: TextureDescriptor, ) -> Result<Self::Texture, &'static str>
Creates a new texture.
Sourceunsafe 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_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.
Sourceunsafe fn new_image_filter_from_fragment_program(
&self,
frag_program: &Self::FragmentProgram,
samplers: &[Self::Texture],
uniform_data: &[u8],
) -> ImageFilter<Self::ImageFilterFragment>
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.