作者:雅蕙蕙蕙 | 来源:互联网 | 2023-09-11 23:51
先正确的评判自己,才有能力评断他人。
你是否欺骗别人,或是自己?想清楚再回答。
三思而后行的人,很少会做错事情。
企图说服不用大脑的人,是徒劳无功。
认为整个世界都错的人,极可能错在自己。
drawLine(绘制直线)
drawLine(Offset p1, Offset p2, Paint paint)
Offset【off 开始或结束的意思;set 设置、设定的意思】
p1:绘制开始坐标【相对于原点 [0,0] 的偏移量】
p2:绘制结束坐标【相对于原点 [0,0] 的偏移量】
paint:画笔
isAntiAlias | 是否抗锯齿(bool) |
strokeWidth | 画笔宽度 (double) |
color | 画笔颜色(Color) |
strokeCap | 延伸绘制(画 冒) |
invertColors | 转换颜色值(二进制补码) |
isAntiAlias=false(保留锯齿)
CustomPaint(size: Size(300, 300), //指定画布大小painter: MyPainter(),),
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = false..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/d8b9b34ac18fe9c3.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = false..strokeisAntiAlias%3Dtrue%EF%BC%88%E6%B6%88%E9%99%A4%E9%94%AF%E9%BD%BF%EF%BC%89">isAntiAlias=true(消除锯齿)
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..strokestrokeWidth%EF%BC%88%E7%94%BB%E7%AC%94%E5%AE%BD%E5%BA%A6%EF%BC%89">strokeWidth(画笔宽度) class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..color = Colors.red;canvas.drawLine(Offset(50.0, 46.0), Offset(200.0,46.0), paint..strokeCap..strokestrokeCap%EF%BC%88buff%E3%80%81round%E3%80%81square%EF%BC%89">strokeCap(buff、round、square)
StrokeCap.butt(无延伸)
(画笔绘制轮廓的边缘是平的,无延伸)buff_cap.png
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke%C2%A0StrokeCap.round%EF%BC%88%E4%B8%A4%E8%BE%B9%20%E3%80%81%E5%BB%B6%E4%BC%B8%E3%80%81%E5%8D%8A%E5%9C%86%EF%BC%89"> StrokeCap.round(两边 、延伸、半圆) (画笔绘制的开始和结束轮廓都会扩展,扩展的直线距离为画笔宽度的一半,扩展为半圆)round_cap.png
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/ac9c57b8f3c16d0b.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..strokeStrokeCap.square%EF%BC%88%E4%B8%A4%E8%BE%B9%20%E3%80%81%E5%BB%B6%E4%BC%B8%E3%80%81%E5%8D%8A%E6%AD%A3%E6%96%B9%E5%BD%A2%5B%E9%95%BF%E6%96%B9%E5%BD%A2%5D%EF%BC%89">StrokeCap.square(两边 、延伸、半正方形[长方形]) (画笔绘制的开始和结束轮廓都会扩展,扩展的直线距离为画笔宽度的一半,扩展为半正方形)square_cap.png
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/7714b52ee80099f8.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/ab81126397248977.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/29b5fca9db8fa528.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/f1d2e11ec1c794cc.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/80a9ff9c1b5a8ccb.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/4257a894304b4efa.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/8511f58baf8a1fe3.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/dc66cf6c70968c36.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/11f9a3afa7080e38.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/e5829167caccdf4d.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/a26b022553532af4.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..stroke" src="https://img3.php1.cn/3cdc5/65b8/3b4/eef5383de9357582.png" />
class MyPainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {//画背景var paint = Paint()..isAntiAlias = true..strokeWidth=1.0..color=Colors.redAccent..invertColors=false;double rowLineCount=size.height/10.0;for(int i=0;i true;
}