pub fn fill_roundrect(&mut self, rect: &Rect, corner_radius: Coord, color: Color) {
        let rect_i = rect.round_out().to_i32();
        if let Some(clipped_rect) = self.bounds.intersection(&rect_i) {
            let corner_radius = corner_radius.max(0.0);
            if corner_radius == 0.0 {
                self.fill_rect(rect, color);
                return;
            }
            let center_min_x = rect.min_x() + corner_radius;
            let center_max_x = rect.max_x() - corner_radius;
            let center_min_y = rect.min_y() + corner_radius;
            let center_max_y = rect.max_y() - corner_radius;
            let top_left = Point::new(center_min_x, center_min_y);
            let bottom_left = Point::new(center_min_x, center_max_y);
            let top_right = Point::new(center_max_x, center_min_y);
            let bottom_right = Point::new(center_max_x, center_max_y);
            let corner_radius2 = corner_radius * corner_radius;
            for y in clipped_rect.min_y()..clipped_rect.max_y() {
                let y_f = y as Coord;
                for x in clipped_rect.min_x()..clipped_rect.max_x() {
                    let x_f = x as Coord;
                    let offset = self.offset_from_x_y(x, y);
                    if x_f < center_min_x && y_f < center_min_y {
                        if Self::point_in_circle(x, y, &top_left, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f > center_max_x && y_f < center_min_y {
                        if Self::point_in_circle(x, y, &top_right, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f < center_min_x && y_f > center_max_y {
                        if Self::point_in_circle(x, y, &bottom_left, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f > center_max_x && y_f > center_max_y {
                        if Self::point_in_circle(x, y, &bottom_right, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else {
                        self.write_color_at_offset(offset as usize, color);
                    }
                }
            }
        }
    }
/// Fill a rounded rectangle with a particular color.
Fill a rounded rectangle with a particular color.
Fill a rounded rectangle with a particular color .
pub fn fill_roundrect(&mut self, rect: &Rect, corner_radius: Coord, color: Color) {
        let rect_i = rect.round_out().to_i32();
        if let Some(clipped_rect) = self.bounds.intersection(&rect_i) {
            let corner_radius = corner_radius.max(0.0);
            if corner_radius == 0.0 {
                self.fill_rect(rect, color);
                return;
            }
            let center_min_x = rect.min_x() + corner_radius;
            let center_max_x = rect.max_x() - corner_radius;
            let center_min_y = rect.min_y() + corner_radius;
            let center_max_y = rect.max_y() - corner_radius;
            let top_left = Point::new(center_min_x, center_min_y);
            let bottom_left = Point::new(center_min_x, center_max_y);
            let top_right = Point::new(center_max_x, center_min_y);
            let bottom_right = Point::new(center_max_x, center_max_y);
            let corner_radius2 = corner_radius * corner_radius;
            for y in clipped_rect.min_y()..clipped_rect.max_y() {
                let y_f = y as Coord;
                for x in clipped_rect.min_x()..clipped_rect.max_x() {
                    let x_f = x as Coord;
                    let offset = self.offset_from_x_y(x, y);
                    if x_f < center_min_x && y_f < center_min_y {
                        if Self::point_in_circle(x, y, &top_left, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f > center_max_x && y_f < center_min_y {
                        if Self::point_in_circle(x, y, &top_right, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f < center_min_x && y_f > center_max_y {
                        if Self::point_in_circle(x, y, &bottom_left, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else if x_f > center_max_x && y_f > center_max_y {
                        if Self::point_in_circle(x, y, &bottom_right, corner_radius2) {
                            self.write_color_at_offset(offset as usize, color);
                        }
                    } else {
                        self.write_color_at_offset(offset as usize, color);
                    }
                }
            }
        }
    }
pub fn fill_roundrect ( & mut self , rect : & Rect , corner_radius : Coord , color : Color ) { let rect_i = rect . round_out ( ) . to_i32 ( ) ; if let Some ( clipped_rect ) = self . bounds . intersection ( & rect_i ) { let corner_radius = corner_radius . max ( 0.0 ) ; if corner_radius == 0.0 { self . fill_rect ( rect , color ) ; return ; } let center_min_x = rect . min_x ( ) + corner_radius ; let center_max_x = rect . max_x ( ) - corner_radius ; let center_min_y = rect . min_y ( ) + corner_radius ; let center_max_y = rect . max_y ( ) - corner_radius ; let top_left = Point :: new ( center_min_x , center_min_y ) ; let bottom_left = Point :: new ( center_min_x , center_max_y ) ; let top_right = Point :: new ( center_max_x , center_min_y ) ; let bottom_right = Point :: new ( center_max_x , center_max_y ) ; let corner_radius2 = corner_radius * corner_radius ; for y in clipped_rect . min_y ( ) .. clipped_rect . max_y ( ) { let y_f = y as Coord ; for x in clipped_rect . min_x ( ) .. clipped_rect . max_x ( ) { let x_f = x as Coord ; let offset = self . offset_from_x_y ( x , y ) ; if x_f < center_min_x && y_f < center_min_y { if Self :: point_in_circle ( x , y , & top_left , corner_radius2 ) { self . write_color_at_offset ( offset as usize , color ) ; } } else if x_f > center_max_x && y_f < center_min_y { if Self :: point_in_circle ( x , y , & top_right , corner_radius2 ) { self . write_color_at_offset ( offset as usize , color ) ; } } else if x_f < center_min_x && y_f > center_max_y { if Self :: point_in_circle ( x , y , & bottom_left , corner_radius2 ) { self . write_color_at_offset ( offset as usize , color ) ; } } else if x_f > center_max_x && y_f > center_max_y { if Self :: point_in_circle ( x , y , & bottom_right , corner_radius2 ) { self . write_color_at_offset ( offset as usize , color ) ; } } else { self . write_color_at_offset ( offset as usize , color ) ; } } } } }
Fill a rounded rectangle with a particular color.
Fill a rounded rectangle with a particular color .
&mut self
rect
&Rect
corner_radius
Coord
color
Color
&mut self
rect
&Rect
corner_radius
Coord
color
Color