pub fn polygon(&self, x0: i32, y0: i32, r: i32, sides: u32, angle: f32, color: Color, antialias: bool ) {
        let mut x:Vec<i32> = Vec::new();
        let mut y:Vec<i32> = Vec::new();
        let i :usize = 0;
        let sides = sides as usize;
        //find vertices
        for i in 0..=sides {
            let t :f32 =angle + 2.0*PI* i as f32 /sides as f32;
            x.push((r as f32 * t.cos()) as i32 + x0);
            y.push((r as f32 * t.sin()) as i32 + y0);
        }
        
        if antialias {
        for i in 0..sides {
            self.wu_line(x[i],y[i],x[i+1],y[i+1],color);
        }
        self.wu_line(x[sides],y[sides],x[0],y[0],color);    
        }else{
        for i in 0..sides {
            self.line(x[i],y[i],x[i+1],y[i+1],color);
        }
        self.line(x[sides],y[sides],x[0],y[0],color);
        }
    }
///Draws a regular polygon with mask support
Draws a regular polygon with mask support
Draws a regular polygon with mask support
pub fn polygon(&self, x0: i32, y0: i32, r: i32, sides: u32, angle: f32, color: Color, antialias: bool ) {
        let mut x:Vec<i32> = Vec::new();
        let mut y:Vec<i32> = Vec::new();
        let i :usize = 0;
        let sides = sides as usize;
        //find vertices
        for i in 0..=sides {
            let t :f32 =angle + 2.0*PI* i as f32 /sides as f32;
            x.push((r as f32 * t.cos()) as i32 + x0);
            y.push((r as f32 * t.sin()) as i32 + y0);
        }
        if antialias {
        for i in 0..sides {
            self.wu_line(x[i],y[i],x[i+1],y[i+1],color);
        }
        self.wu_line(x[sides],y[sides],x[0],y[0],color);    
        }else{
        for i in 0..sides {
            self.line(x[i],y[i],x[i+1],y[i+1],color);
        }
        self.line(x[sides],y[sides],x[0],y[0],color);
        }
    }
pub fn polygon ( & self , x0 : i32 , y0 : i32 , r : i32 , sides : u32 , angle : f32 , color : Color , antialias : bool ) { let mut x : Vec < i32 > = Vec :: new ( ) ; let mut y : Vec < i32 > = Vec :: new ( ) ; let i : usize = 0 ; let sides = sides as usize ; //find vertices for i in 0 ..= sides { let t : f32 = angle + 2.0 * PI * i as f32 / sides as f32 ; x . push ( ( r as f32 * t . cos ( ) ) as i32 + x0 ) ; y . push ( ( r as f32 * t . sin ( ) ) as i32 + y0 ) ; } if antialias { for i in 0 .. sides { self . wu_line ( x [ i ] , y [ i ] , x [ i + 1 ] , y [ i + 1 ] , color ) ; } self . wu_line ( x [ sides ] , y [ sides ] , x [ 0 ] , y [ 0 ] , color ) ; } else { for i in 0 .. sides { self . line ( x [ i ] , y [ i ] , x [ i + 1 ] , y [ i + 1 ] , color ) ; } self . line ( x [ sides ] , y [ sides ] , x [ 0 ] , y [ 0 ] , color ) ; } }
Draws a regular polygon with mask support
Draws a regular polygon with mask support
&self
x0
i32
y0
i32
r
i32
sides
u32
angle
f32
color
Color
antialias
bool
&self
x0
i32
y0
i32
r
i32
sides
u32
angle
f32
color
Color
antialias
bool