Skip to main content

IPlatformRenderInterface

Trait IPlatformRenderInterface 

Source
pub trait IPlatformRenderInterface: 'static {
Show 27 methods // Required methods fn create_ellipse_geometry(&self, rect: Rect) -> Arc<dyn IGeometryImpl> ⓘ; fn create_line_geometry( &self, p1: Point, p2: Point, ) -> Arc<dyn IGeometryImpl> ⓘ; fn create_rectangle_geometry(&self, rect: Rect) -> Arc<dyn IGeometryImpl> ⓘ; fn create_stream_geometry_builder( &self, source: Option<&dyn IGeometryImpl>, ) -> Box<dyn IStreamGeometryBuilder>; fn create_geometry_group( &self, fill_rule: FillRule, children: &[Arc<dyn IGeometryImpl>], ) -> Arc<dyn IGeometryImpl> ⓘ; fn create_combined_geometry( &self, combine_mode: GeometryCombineMode, g1: Arc<dyn IGeometryImpl>, g2: Arc<dyn IGeometryImpl>, ) -> Arc<dyn IGeometryImpl> ⓘ; fn build_glyph_run_geometry( &self, glyph_run: &GlyphRun, ) -> Arc<dyn IGeometryImpl> ⓘ; fn create_glyph_run( &self, glyph_typeface: &Rc<GlyphTypeface>, font_rendering_em_size: f64, glyph_infos: &[GlyphInfo], baseline_origin: Point, ) -> Arc<dyn IGlyphRunImpl> ⓘ; fn create_render_target_bitmap( &self, size: PixelSize, dpi: Vector, ) -> Arc<dyn IRenderTargetBitmapImpl> ⓘ; fn create_writeable_bitmap( &self, size: PixelSize, dpi: Vector, format: PixelFormat, alpha_format: AlphaFormat, ) -> Arc<dyn IWriteableBitmapImpl> ⓘ; fn load_bitmap_from_file( &self, file_name: &str, ) -> Result<Arc<SharedBitmapImpl>>; fn load_bitmap( &self, stream: &mut dyn Read, ) -> Result<Arc<SharedBitmapImpl>>; fn load_writeable_bitmap_to_width( &self, stream: &mut dyn Read, width: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<dyn IWriteableBitmapImpl>>; fn load_writeable_bitmap_to_height( &self, stream: &mut dyn Read, height: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<dyn IWriteableBitmapImpl>>; fn load_writeable_bitmap_from_file( &self, file_name: &str, ) -> Result<Arc<dyn IWriteableBitmapImpl>>; fn load_writeable_bitmap( &self, stream: &mut dyn Read, ) -> Result<Arc<dyn IWriteableBitmapImpl>>; fn load_bitmap_to_width( &self, stream: &mut dyn Read, width: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<SharedBitmapImpl>>; fn load_bitmap_to_height( &self, stream: &mut dyn Read, height: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<SharedBitmapImpl>>; fn resize_bitmap( &self, bitmap_impl: &dyn IBitmapImpl, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Arc<SharedBitmapImpl> ⓘ; fn load_bitmap_from_pixels( &self, format: PixelFormat, alpha_format: AlphaFormat, data: &[u8], size: PixelSize, dpi: Vector, stride: i32, ) -> Arc<SharedBitmapImpl> ⓘ; fn create_backend_context( &self, graphics_api_context: Option<Rc<dyn IPlatformGraphicsContext>>, ) -> Rc<dyn IPlatformRenderInterfaceContext>; fn supports_individual_round_rects(&self) -> bool; fn default_alpha_format(&self) -> AlphaFormat; fn default_pixel_format(&self) -> PixelFormat; fn is_supported_bitmap_pixel_format(&self, format: PixelFormat) -> bool; fn supports_regions(&self) -> bool; fn create_region(&self) -> Rc<dyn IPlatformRenderInterfaceRegion>;
}
Expand description

Defines the main platform-specific interface for the rendering subsystem.

This is the contract a rendering backend implements; it is registered in the service locator and everything that needs platform rendering objects goes through it.

Required Methods§

Source

fn create_ellipse_geometry(&self, rect: Rect) -> Arc<dyn IGeometryImpl> ⓘ

Creates an ellipse geometry implementation.

Source

fn create_line_geometry(&self, p1: Point, p2: Point) -> Arc<dyn IGeometryImpl> ⓘ

Creates a line geometry implementation.

Source

fn create_rectangle_geometry(&self, rect: Rect) -> Arc<dyn IGeometryImpl> ⓘ

Creates a rectangle geometry implementation.

Source

fn create_stream_geometry_builder( &self, source: Option<&dyn IGeometryImpl>, ) -> Box<dyn IStreamGeometryBuilder>

Creates a builder used to define a stream geometry.

source is a geometry created by this render interface whose figures the new geometry starts with, or None to start with an empty geometry. source itself isn’t modified.

Source

fn create_geometry_group( &self, fill_rule: FillRule, children: &[Arc<dyn IGeometryImpl>], ) -> Arc<dyn IGeometryImpl> ⓘ

Creates a geometry group implementation.

Source

fn create_combined_geometry( &self, combine_mode: GeometryCombineMode, g1: Arc<dyn IGeometryImpl>, g2: Arc<dyn IGeometryImpl>, ) -> Arc<dyn IGeometryImpl> ⓘ

Creates a geometry that combines two geometries.

Source

fn build_glyph_run_geometry( &self, glyph_run: &GlyphRun, ) -> Arc<dyn IGeometryImpl> ⓘ

Builds a glyph run geometry.

Source

fn create_glyph_run( &self, glyph_typeface: &Rc<GlyphTypeface>, font_rendering_em_size: f64, glyph_infos: &[GlyphInfo], baseline_origin: Point, ) -> Arc<dyn IGlyphRunImpl> ⓘ

Creates a platform implementation of a glyph run.

  • glyph_typeface — the glyph typeface.
  • font_rendering_em_size — the font rendering em size.
  • glyph_infos — the list of glyphs.
  • baseline_origin — the baseline origin of the run. Can be zero.
Source

fn create_render_target_bitmap( &self, size: PixelSize, dpi: Vector, ) -> Arc<dyn IRenderTargetBitmapImpl> ⓘ

Creates a render target bitmap.

dpi is the DPI of the bitmap; 96 means one pixel per logical unit.

Source

fn create_writeable_bitmap( &self, size: PixelSize, dpi: Vector, format: PixelFormat, alpha_format: AlphaFormat, ) -> Arc<dyn IWriteableBitmapImpl> ⓘ

Creates a writeable bitmap.

Source

fn load_bitmap_from_file( &self, file_name: &str, ) -> Result<Arc<SharedBitmapImpl>>

Loads a bitmap from a file.

Source

fn load_bitmap(&self, stream: &mut dyn Read) -> Result<Arc<SharedBitmapImpl>>

Loads a bitmap from a stream.

Source

fn load_writeable_bitmap_to_width( &self, stream: &mut dyn Read, width: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<dyn IWriteableBitmapImpl>>

Loads a writeable bitmap from a stream, decoded to the given width.

Source

fn load_writeable_bitmap_to_height( &self, stream: &mut dyn Read, height: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<dyn IWriteableBitmapImpl>>

Loads a writeable bitmap from a stream, decoded to the given height.

Source

fn load_writeable_bitmap_from_file( &self, file_name: &str, ) -> Result<Arc<dyn IWriteableBitmapImpl>>

Loads a writeable bitmap from a file.

Source

fn load_writeable_bitmap( &self, stream: &mut dyn Read, ) -> Result<Arc<dyn IWriteableBitmapImpl>>

Loads a writeable bitmap from a stream.

Source

fn load_bitmap_to_width( &self, stream: &mut dyn Read, width: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<SharedBitmapImpl>>

Loads a bitmap from a stream, decoded to the given width.

Source

fn load_bitmap_to_height( &self, stream: &mut dyn Read, height: i32, interpolation_mode: BitmapInterpolationMode, ) -> Result<Arc<SharedBitmapImpl>>

Loads a bitmap from a stream, decoded to the given height.

Source

fn resize_bitmap( &self, bitmap_impl: &dyn IBitmapImpl, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Arc<SharedBitmapImpl> ⓘ

Creates a resized copy of a bitmap.

Source

fn load_bitmap_from_pixels( &self, format: PixelFormat, alpha_format: AlphaFormat, data: &[u8], size: PixelSize, dpi: Vector, stride: i32, ) -> Arc<SharedBitmapImpl> ⓘ

Loads a bitmap from raw pixel data.

data holds stride * size.height bytes in the given formats.

Source

fn create_backend_context( &self, graphics_api_context: Option<Rc<dyn IPlatformGraphicsContext>>, ) -> Rc<dyn IPlatformRenderInterfaceContext>

Creates a backend-specific render context from a platform graphics context (None selects software rendering).

Source

fn supports_individual_round_rects(&self) -> bool

Whether the backend supports individual corner radii on rounded rectangles.

Source

fn default_alpha_format(&self) -> AlphaFormat

The default alpha format of the backend.

Source

fn default_pixel_format(&self) -> PixelFormat

The default pixel format of the backend.

Source

fn is_supported_bitmap_pixel_format(&self, format: PixelFormat) -> bool

Whether bitmaps can be created in the given pixel format.

Source

fn supports_regions(&self) -> bool

Whether the backend supports regions.

Source

fn create_region(&self) -> Rc<dyn IPlatformRenderInterfaceRegion>

Creates an empty region.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§