pub trait Context<B: Backend> {
// Required methods
fn pixel_format(&self) -> PixelFormat;
fn path_builder(&self) -> Option<B::PathBuilder>;
fn raster_builder(&self) -> Option<B::RasterBuilder>;
fn new_image(&mut self, size: Size2D<u32>) -> B::Image;
fn new_image_from_png<R: BufRead + Seek>(
&mut self,
reader: &mut Reader<R>,
) -> Result<B::Image, Error>;
fn get_image(&mut self, image_index: u32) -> B::Image;
fn get_current_image(&mut self, context: &ViewAssistantContext) -> B::Image;
fn render_with_clip(
&mut self,
composition: &mut B::Composition,
clip: Rect<u32>,
image: B::Image,
ext: &RenderExt<B>,
);
// Provided method
fn render(
&mut self,
composition: &mut B::Composition,
clip: Option<Rect<u32>>,
image: B::Image,
ext: &RenderExt<B>,
) { ... }
}Expand description
Rendering context and API start point.
Required Methods§
Sourcefn pixel_format(&self) -> PixelFormat
fn pixel_format(&self) -> PixelFormat
Returns the context’s pixel format.
Sourcefn path_builder(&self) -> Option<B::PathBuilder>
fn path_builder(&self) -> Option<B::PathBuilder>
Optionally returns a PathBuilder. May return None of old builder is still alive.
Sourcefn raster_builder(&self) -> Option<B::RasterBuilder>
fn raster_builder(&self) -> Option<B::RasterBuilder>
Optionally returns a RasterBuilder. May return None of old builder is still alive.
Sourcefn new_image_from_png<R: BufRead + Seek>(
&mut self,
reader: &mut Reader<R>,
) -> Result<B::Image, Error>
fn new_image_from_png<R: BufRead + Seek>( &mut self, reader: &mut Reader<R>, ) -> Result<B::Image, Error>
Creates a new image from PNG reader.
Sourcefn get_current_image(&mut self, context: &ViewAssistantContext) -> B::Image
fn get_current_image(&mut self, context: &ViewAssistantContext) -> B::Image
Returns the context’s current image.
Sourcefn render_with_clip(
&mut self,
composition: &mut B::Composition,
clip: Rect<u32>,
image: B::Image,
ext: &RenderExt<B>,
)
fn render_with_clip( &mut self, composition: &mut B::Composition, clip: Rect<u32>, image: B::Image, ext: &RenderExt<B>, )
Renders the composition with a clip to the image.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".