/// Submit the path events to be tessellated.
Submit the path events to be tessellated.
Submit the path events to be tessellated .
pub(crate) fn events<I>(self, ctxt: DrawingContext<S>, events: I) -> Polygon<S>
    where
        S: BaseFloat,
        I: IntoIterator<Item = PathEvent>,
    {
        let DrawingContext {
            mesh,
            fill_tessellator,
            path_event_buffer,
            ..
        } = ctxt;
        path_event_buffer.clear();
        path_event_buffer.extend(events);
        // Fill tessellation.
        let (fill_vdr, fill_ir, min_index) = if !self.opts.no_fill {
            let mut builder = mesh.builder();
            let opts = Default::default();
            let events = path_event_buffer.iter().cloned();
            let res = fill_tessellator.tessellate_path(events, &opts, &mut builder);
            if let Err(err) = res {
                eprintln!("fill tessellation failed: {:?}", err);
            }
            (
                builder.vertex_data_ranges(),
                builder.index_range(),
                builder.min_index(),
            )
        } else {
            let builder = mesh.builder();
            (
                builder.vertex_data_ranges(),
                builder.index_range(),
                builder.min_index(),
            )
        };
        // Stroke tessellation.
        let (stroke_vdr, stroke_ir) = match (self.opts.stroke, self.opts.stroke_color) {
            (options, color) if options.is_some() || color.is_some() => {
                let opts = options.unwrap_or_else(Default::default);
                let mut builder = mesh.builder();
                let mut stroke_tessellator = StrokeTessellator::default();
                let events = path_event_buffer.drain(..);
                let res = stroke_tessellator.tessellate_path(events, &opts, &mut builder);
                if let Err(err) = res {
                    eprintln!("stroke tessellation failed: {:?}", err);
                }
                let stroke_vdr = builder.vertex_data_ranges();
                let stroke_ir = builder.index_range();
                (stroke_vdr, stroke_ir)
            }
            _ => (Default::default(), 0..0),
        };
        path_event_buffer.clear();
        Polygon {
            position: self.opts.position,
            orientation: self.opts.orientation,
            color: self.opts.color,
            stroke_color: self.opts.stroke_color,
            vertex_data_ranges: (fill_vdr, stroke_vdr),
            index_ranges: (fill_ir, stroke_ir),
            min_index,
        }
    }
pub ( crate ) fn events < I > ( self , ctxt : DrawingContext < S > , events : I ) -> Polygon < S > where S : BaseFloat , I : IntoIterator < Item = PathEvent > , { let DrawingContext { mesh , fill_tessellator , path_event_buffer , .. } = ctxt ; path_event_buffer . clear ( ) ; path_event_buffer . extend ( events ) ; // Fill tessellation. let ( fill_vdr , fill_ir , min_index ) = if ! self . opts . no_fill { let mut builder = mesh . builder ( ) ; let opts = Default :: default ( ) ; let events = path_event_buffer . iter ( ) . cloned ( ) ; let res = fill_tessellator . tessellate_path ( events , & opts , & mut builder ) ; if let Err ( err ) = res { eprintln ! ( " " err ) ; } ( builder . vertex_data_ranges ( ) , builder . index_range ( ) , builder . min_index ( ) , ) } else { let builder = mesh . builder ( ) ; ( builder . vertex_data_ranges ( ) , builder . index_range ( ) , builder . min_index ( ) , ) } ; // Stroke tessellation. let ( stroke_vdr , stroke_ir ) = match ( self . opts . stroke , self . opts . stroke_color ) { ( options , color ) if options . is_some ( ) || color . is_some ( ) => { let opts = options . unwrap_or_else ( Default :: default ) ; let mut builder = mesh . builder ( ) ; let mut stroke_tessellator = StrokeTessellator :: default ( ) ; let events = path_event_buffer . drain ( .. ) ; let res = stroke_tessellator . tessellate_path ( events , & opts , & mut builder ) ; if let Err ( err ) = res { eprintln ! ( " " err ) ; } let stroke_vdr = builder . vertex_data_ranges ( ) ; let stroke_ir = builder . index_range ( ) ; ( stroke_vdr , stroke_ir ) } _ => ( Default :: default ( ) , 0 .. 0 ) , } ; path_event_buffer . clear ( ) ; Polygon { position : self . opts . position , orientation : self . opts . orientation , color : self . opts . color , stroke_color : self . opts . stroke_color , vertex_data_ranges : ( fill_vdr , stroke_vdr ) , index_ranges : ( fill_ir , stroke_ir ) , min_index , } }
Submit the path events to be tessellated.
Submit the path events to be tessellated .
self
ctxt
DrawingContext<S>
events
I