pub fn _draw_circle_with_border(&self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f64, border_color: &[u8; 4], border_size: f64) {
        let center = (rect.0 as f64 + rect.2 as f64 / 2.0, rect.1 as f64 + rect.3 as f64 / 2.0);
        for y in rect.1..rect.1+rect.3 {
            for x in rect.0..rect.0+rect.2 {
                let i = x * 4 + y * stride * 4;

                let mut d = (x as f64 - center.0).powf(2.0) + (y as f64 - center.1).powf(2.0);
                d = d.sqrt() - radius;

                if d < 1.0 {
                    let t = self.fill_mask(d);

                    let background = &[frame[i], frame[i+1], frame[i+2], 255];
                    let mut mixed_color = self.mix_color(&background, &color, t);

                    let b = self.border_mask(d, border_size);
                    mixed_color = self.mix_color(&mixed_color, &border_color, b);

                    frame[i..i + 4].copy_from_slice(&mixed_color);
                }
            }
        }
    }
/// Draws a circle with a border of a given size
Draws a circle with a border of a given size
Draws a circle with a border of a given size
pub fn _draw_circle_with_border(&self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f64, border_color: &[u8; 4], border_size: f64) {
        let center = (rect.0 as f64 + rect.2 as f64 / 2.0, rect.1 as f64 + rect.3 as f64 / 2.0);
        for y in rect.1..rect.1+rect.3 {
            for x in rect.0..rect.0+rect.2 {
                let i = x * 4 + y * stride * 4;
                let mut d = (x as f64 - center.0).powf(2.0) + (y as f64 - center.1).powf(2.0);
                d = d.sqrt() - radius;
                if d < 1.0 {
                    let t = self.fill_mask(d);
                    let background = &[frame[i], frame[i+1], frame[i+2], 255];
                    let mut mixed_color = self.mix_color(&background, &color, t);
                    let b = self.border_mask(d, border_size);
                    mixed_color = self.mix_color(&mixed_color, &border_color, b);
                    frame[i..i + 4].copy_from_slice(&mixed_color);
                }
            }
        }
    }
pub fn _draw_circle_with_border ( & self , frame : & mut [ u8 ] , rect : & ( usize , usize , usize , usize ) , stride : usize , color : & [ u8 ; 4 ] , radius : f64 , border_color : & [ u8 ; 4 ] , border_size : f64 ) { let center = ( rect . 0 as f64 + rect . 2 as f64 / 2.0 , rect . 1 as f64 + rect . 3 as f64 / 2.0 ) ; for y in rect . 1 .. rect . 1 + rect . 3 { for x in rect . 0 .. rect . 0 + rect . 2 { let i = x * 4 + y * stride * 4 ; let mut d = ( x as f64 - center . 0 ) . powf ( 2.0 ) + ( y as f64 - center . 1 ) . powf ( 2.0 ) ; d = d . sqrt ( ) - radius ; if d < 1.0 { let t = self . fill_mask ( d ) ; let background = & [ frame [ i ] , frame [ i + 1 ] , frame [ i + 2 ] , 255 ] ; let mut mixed_color = self . mix_color ( & background , & color , t ) ; let b = self . border_mask ( d , border_size ) ; mixed_color = self . mix_color ( & mixed_color , & border_color , b ) ; frame [ i .. i + 4 ] . copy_from_slice ( & mixed_color ) ; } } } }
Draws a circle with a border of a given size
Draws a circle with a border of a given size
&self
frame
&mut [u8]
rect
&(usize, usize, usize, usize)
stride
usize
color
&[u8; 4]
radius
f64
border_color
&[u8; 4]
border_size
f64
&self
frame
&mut [u8]
rect
&(usize, usize, usize, usize)
stride
usize
color
&[u8; 4]
radius
f64
border_color
&[u8; 4]
border_size
f64