fn stroke_geometry(&mut self, path: path::Path, stroke_options: StrokeSettings, scale_factor: f64) -> VertexBuffers<render::Vertex2D, u16> {
        // Create the tessellator and geometry
        let mut tessellator         = tessellation::StrokeTessellator::new();
        let mut geometry            = VertexBuffers::new();

        // Set up the stroke options
        let render::Rgba8(color)    = stroke_options.stroke_color;
        let mut stroke_options      = Self::convert_stroke_settings(stroke_options);
        stroke_options.tolerance    = StrokeOptions::DEFAULT_TOLERANCE * (scale_factor as f32);
        stroke_options.tolerance    = f32::min(MAX_TOLERANCE, stroke_options.tolerance);
        stroke_options.tolerance    = f32::max(MIN_TOLERANCE, stroke_options.tolerance);

        // Stroke the path
        tessellator.tessellate_path(&path, &stroke_options,
            &mut BuffersBuilder::new(&mut geometry, move |point: StrokeVertex| {
                let advancement = point.advancement();
                let side        = match point.side() { Side::Left => 0.0, Side::Right => 1.0 };

                render::Vertex2D {
                    pos:        point.position().to_array(),
                    tex_coord:  [advancement, side],
                    color:      color
                }
            })).unwrap();

        geometry
    }
///
/// Generates the geometry for a stroke
///
Generates the geometry for a stroke
Generates the geometry for a stroke
fn stroke_geometry(&mut self, path: path::Path, stroke_options: StrokeSettings, scale_factor: f64) -> VertexBuffers<render::Vertex2D, u16> {
        // Create the tessellator and geometry
        let mut tessellator         = tessellation::StrokeTessellator::new();
        let mut geometry            = VertexBuffers::new();
        // Set up the stroke options
        let render::Rgba8(color)    = stroke_options.stroke_color;
        let mut stroke_options      = Self::convert_stroke_settings(stroke_options);
        stroke_options.tolerance    = StrokeOptions::DEFAULT_TOLERANCE * (scale_factor as f32);
        stroke_options.tolerance    = f32::min(MAX_TOLERANCE, stroke_options.tolerance);
        stroke_options.tolerance    = f32::max(MIN_TOLERANCE, stroke_options.tolerance);
        // Stroke the path
        tessellator.tessellate_path(&path, &stroke_options,
            &mut BuffersBuilder::new(&mut geometry, move |point: StrokeVertex| {
                let advancement = point.advancement();
                let side        = match point.side() { Side::Left => 0.0, Side::Right => 1.0 };
                render::Vertex2D {
                    pos:        point.position().to_array(),
                    tex_coord:  [advancement, side],
                    color:      color
                }
            })).unwrap();
        geometry
    }
fn stroke_geometry ( & mut self , path : path :: Path , stroke_options : StrokeSettings , scale_factor : f64 ) -> VertexBuffers < render :: Vertex2D , u16 > { // Create the tessellator and geometry let mut tessellator = tessellation :: StrokeTessellator :: new ( ) ; let mut geometry = VertexBuffers :: new ( ) ; // Set up the stroke options let render :: Rgba8 ( color ) = stroke_options . stroke_color ; let mut stroke_options = Self :: convert_stroke_settings ( stroke_options ) ; stroke_options . tolerance = StrokeOptions :: DEFAULT_TOLERANCE * ( scale_factor as f32 ) ; stroke_options . tolerance = f32 :: min ( MAX_TOLERANCE , stroke_options . tolerance ) ; stroke_options . tolerance = f32 :: max ( MIN_TOLERANCE , stroke_options . tolerance ) ; // Stroke the path tessellator . tessellate_path ( & path , & stroke_options , & mut BuffersBuilder :: new ( & mut geometry , move | point : StrokeVertex | { let advancement = point . advancement ( ) ; let side = match point . side ( ) { Side :: Left => 0.0 , Side :: Right => 1.0 } ; render :: Vertex2D { pos : point . position ( ) . to_array ( ) , tex_coord : [ advancement , side ] , color : color } } ) ) . unwrap ( ) ; geometry }
Generates the geometry for a stroke
Generates the geometry for a stroke
&mut self
path
path::Path
stroke_options
StrokeSettings
scale_factor
f64