pub fn wu_circle (&self, x0: i32, y0: i32, radius: i32, color: Color){
        let r = color.r();
        let g = color.g();
        let b = color.b();
        let a = color.a();
        let mut y =0;
        let mut x = radius;
        let mut d =0_f64;
        
        self.pixel (x0+x,y0+y,color);
        self.pixel (x0-x,y0-y,color);
        self.pixel (x0+y,y0-x,color);
        self.pixel (x0-y,y0+x,color);
        
        while x > y {
            let di = dist(radius,y);
            if di < d { x -= 1;}
            let col = Color::rgba(r,g,b,(a as f64*(1.0-di)) as u8);
            let col2 = Color::rgba(r,g,b,(a as f64*di) as u8);
            
            self.pixel(x0+x, y0+y, col);
            self.pixel(x0+x-1, y0+y, col2);//-
            self.pixel(x0-x, y0+y, col);
            self.pixel(x0-x+1, y0+y, col2);//+
            self.pixel(x0+x, y0-y, col);
            self.pixel(x0+x-1, y0-y, col2);//-
            self.pixel(x0-x, y0-y, col);
            self.pixel(x0-x+1, y0-y, col2);//+
            
            self.pixel(x0+y, y0+x, col);
            self.pixel(x0+y, y0+x-1, col2);
            self.pixel(x0-y, y0+x, col);
            self.pixel(x0-y, y0+x-1, col2);
            self.pixel(x0+y, y0-x, col);
            self.pixel(x0+y, y0-x+1, col2);
            self.pixel(x0-y, y0-x, col);
            self.pixel(x0-y, y0-x+1, col2);
            d = di;
            y += 1;
        }
        
        fn dist(r: i32, y: i32) -> f64{
            let x :f64 = ((r*r-y*y)as f64).sqrt();
            x.ceil()-x
        }
    }
///Draws antialiased circle with mask support
Draws antialiased circle with mask support
Draws antialiased circle with mask support
pub fn wu_circle (&self, x0: i32, y0: i32, radius: i32, color: Color){
        let r = color.r();
        let g = color.g();
        let b = color.b();
        let a = color.a();
        let mut y =0;
        let mut x = radius;
        let mut d =0_f64;
        self.pixel (x0+x,y0+y,color);
        self.pixel (x0-x,y0-y,color);
        self.pixel (x0+y,y0-x,color);
        self.pixel (x0-y,y0+x,color);
        while x > y {
            let di = dist(radius,y);
            if di < d { x -= 1;}
            let col = Color::rgba(r,g,b,(a as f64*(1.0-di)) as u8);
            let col2 = Color::rgba(r,g,b,(a as f64*di) as u8);
            self.pixel(x0+x, y0+y, col);
            self.pixel(x0+x-1, y0+y, col2);//-
            self.pixel(x0-x, y0+y, col);
            self.pixel(x0-x+1, y0+y, col2);//+
            self.pixel(x0+x, y0-y, col);
            self.pixel(x0+x-1, y0-y, col2);//-
            self.pixel(x0-x, y0-y, col);
            self.pixel(x0-x+1, y0-y, col2);//+
            self.pixel(x0+y, y0+x, col);
            self.pixel(x0+y, y0+x-1, col2);
            self.pixel(x0-y, y0+x, col);
            self.pixel(x0-y, y0+x-1, col2);
            self.pixel(x0+y, y0-x, col);
            self.pixel(x0+y, y0-x+1, col2);
            self.pixel(x0-y, y0-x, col);
            self.pixel(x0-y, y0-x+1, col2);
            d = di;
            y += 1;
        }
        fn dist(r: i32, y: i32) -> f64{
            let x :f64 = ((r*r-y*y)as f64).sqrt();
            x.ceil()-x
        }
    }
pub fn wu_circle ( & self , x0 : i32 , y0 : i32 , radius : i32 , color : Color ) { let r = color . r ( ) ; let g = color . g ( ) ; let b = color . b ( ) ; let a = color . a ( ) ; let mut y = 0 ; let mut x = radius ; let mut d = 0_f64 ; self . pixel ( x0 + x , y0 + y , color ) ; self . pixel ( x0 - x , y0 - y , color ) ; self . pixel ( x0 + y , y0 - x , color ) ; self . pixel ( x0 - y , y0 + x , color ) ; while x > y { let di = dist ( radius , y ) ; if di < d { x -= 1 ; } let col = Color :: rgba ( r , g , b , ( a as f64 * ( 1.0 - di ) ) as u8 ) ; let col2 = Color :: rgba ( r , g , b , ( a as f64 * di ) as u8 ) ; self . pixel ( x0 + x , y0 + y , col ) ; self . pixel ( x0 + x - 1 , y0 + y , col2 ) ; //- self . pixel ( x0 - x , y0 + y , col ) ; self . pixel ( x0 - x + 1 , y0 + y , col2 ) ; //+ self . pixel ( x0 + x , y0 - y , col ) ; self . pixel ( x0 + x - 1 , y0 - y , col2 ) ; //- self . pixel ( x0 - x , y0 - y , col ) ; self . pixel ( x0 - x + 1 , y0 - y , col2 ) ; //+ self . pixel ( x0 + y , y0 + x , col ) ; self . pixel ( x0 + y , y0 + x - 1 , col2 ) ; self . pixel ( x0 - y , y0 + x , col ) ; self . pixel ( x0 - y , y0 + x - 1 , col2 ) ; self . pixel ( x0 + y , y0 - x , col ) ; self . pixel ( x0 + y , y0 - x + 1 , col2 ) ; self . pixel ( x0 - y , y0 - x , col ) ; self . pixel ( x0 - y , y0 - x + 1 , col2 ) ; d = di ; y += 1 ; } fn dist ( r : i32 , y : i32 ) -> f64 { let x : f64 = ( ( r * r - y * y ) as f64 ) . sqrt ( ) ; x . ceil ( ) - x } }
Draws antialiased circle with mask support
Draws antialiased circle with mask support
&self
x0
i32
y0
i32
radius
i32
color
Color
&self
x0
i32
y0
i32
radius
i32
color
Color