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§
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: Read>(
&mut self,
reader: &mut Reader<R>
) -> Result<B::Image, Error>
fn new_image_from_png<R: Read>( &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§
Object Safety§
This trait is not object safe.