feat: 实现 ShapeStyle 配置
This commit is contained in:
@@ -651,6 +651,26 @@ impl MSCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_rect1(&mut self, p1: Point, p2: Point) {
|
||||
let mut x = p1.x;
|
||||
let mut y = p1.y;
|
||||
let mut width = (p2.x - p1.x);
|
||||
let mut height = (p2.y - p1.y);
|
||||
if width < 0.0 && height < 0.0 {
|
||||
x = p2.x;
|
||||
y = p2.y;
|
||||
width = (p1.x - p2.x);
|
||||
height = (p1.y - p2.y);
|
||||
} else if width < 0.0 {
|
||||
x += width;
|
||||
width = -width;
|
||||
} else if height < 0.0 {
|
||||
y += height;
|
||||
height = -height;
|
||||
}
|
||||
self.fill_rect(x as i32, y as i32, width as i32, height as i32);
|
||||
}
|
||||
|
||||
/// 填充一个圆角矩形
|
||||
/// - x, y: 左上角坐标
|
||||
/// - width, height: 尺寸(必须 > 0)
|
||||
|
||||
Reference in New Issue
Block a user