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: Read>(
        &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§

source

fn pixel_format(&self) -> PixelFormat

Returns the context’s pixel format.

source

fn path_builder(&self) -> Option<B::PathBuilder>

Optionally returns a PathBuilder. May return None of old builder is still alive.

source

fn raster_builder(&self) -> Option<B::RasterBuilder>

Optionally returns a RasterBuilder. May return None of old builder is still alive.

source

fn new_image(&mut self, size: Size2D<u32>) -> B::Image

Creates a new image with size.

source

fn new_image_from_png<R: Read>( &mut self, reader: &mut Reader<R> ) -> Result<B::Image, Error>

Creates a new image from PNG reader.

source

fn get_image(&mut self, image_index: u32) -> B::Image

Returns the image at image_index.

source

fn get_current_image(&mut self, context: &ViewAssistantContext) -> B::Image

Returns the context’s current image.

source

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§

source

fn render( &mut self, composition: &mut B::Composition, clip: Option<Rect<u32>>, image: B::Image, ext: &RenderExt<B> )

Renders the composition with an optional clip to the image.

Object Safety§

This trait is not object safe.

Implementors§