flutter定制更好的抗质量
paint.isantialias = false;
paint.isantialias = true;
@override
void paint(Canvas canvas, Size size) {
final Path path_0 = Path();
path_0.moveTo(
size.width * 0.5002533,
size.height * 0.004880920,
);
path_0.cubicTo(
size.width * 0.2252237,
size.height * 0.004880922,
size.width * 0.002532500,
size.height * 0.2268787,
size.width * 0.002532500,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.002532500,
size.height * 0.7752251,
size.width * 0.2252237,
size.height * 0.9972229,
size.width * 0.5002533,
size.height * 0.9972220,
);
path_0.cubicTo(
size.width * 0.7752828,
size.height * 0.9972229,
size.width * 0.9979740,
size.height * 0.7752251,
size.width * 0.9979740,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.9979740,
size.height * 0.2268787,
size.width * 0.7752828,
size.height * 0.004880922,
size.width * 0.5002533,
size.height * 0.004880920,
);
path_0.close();
path_0.moveTo(
size.width * 0.5002533,
size.height * 0.8731800,
);
path_0.cubicTo(
size.width * 0.3693230,
size.height * 0.8731802,
size.width * 0.2513929,
size.height * 0.7020954,
size.width * 0.2513929,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.2513929,
size.height * 0.3000084,
size.width * 0.3692386,
size.height * 0.1289237,
size.width * 0.5002533,
size.height * 0.1289230,
);
path_0.cubicTo(
size.width * 0.6312679,
size.height * 0.1289237,
size.width * 0.7491136,
size.height * 0.3000084,
size.width * 0.7491136,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.7491136,
size.height * 0.7020954,
size.width * 0.6311835,
size.height * 0.8731802,
size.width * 0.5002533,
size.height * 0.8731800,
);
path_0.close();
final Paint paint0Fill = Paint()..style = PaintingStyle.fill;
paint0Fill.color = colors['kMainColor']!;
canvas.drawPath(path_0, paint0Fill);
final Path path_1 = Path();
path_1.moveTo(
size.width * 0.8129326,
size.height * 0.1151220,
);
path_1.cubicTo(
size.width * 0.7594125,
size.height * 0.07859968,
size.width * 0.6966064,
size.height * 0.05444753,
size.width * 0.6312679,
size.height * 0.05444750,
);
path_1.cubicTo(
size.width * 0.5330069,
size.height * 0.05444753,
size.width * 0.4440317,
size.height * 0.1035934,
size.width * 0.3782711,
size.height * 0.1804250,
);
path_1.cubicTo(
size.width * 0.4149924,
size.height * 0.1479424,
size.width * 0.4568631,
size.height * 0.1288395,
size.width * 0.5002533,
size.height * 0.1288390,
);
path_1.cubicTo(
size.width * 0.6311835,
size.height * 0.1288395,
size.width * 0.7491136,
size.height * 0.2999243,
size.width * 0.7491136,
size.height * 0.5009670,
);
path_1.cubicTo(
size.width * 0.7491136,
size.height * 0.7020113,
size.width * 0.6312679,
size.height * 0.8730960,
size.width * 0.5002533,
size.height * 0.8730960,
);
path_1.cubicTo(
size.width * 0.4568631,
size.height * 0.8730960,
size.width * 0.4149924,
size.height * 0.8539931,
size.width * 0.3782711,
size.height * 0.8215090,
);
path_1.cubicTo(
size.width * 0.4440317,
size.height * 0.8984263,
size.width * 0.5330069,
size.height * 0.9474880,
size.width * 0.6312679,
size.height * 0.9474880,
);
path_1.cubicTo(
size.width * 0.6966064,
size.height * 0.9474880,
size.width * 0.7594125,
size.height * 0.9233359,
size.width * 0.8129326,
size.height * 0.8868970,
);
path_1.cubicTo(
size.width * 0.9257977,
size.height * 0.7960111,
size.width * 0.9979740,
size.height * 0.6569890,
size.width * 0.9979740,
size.height * 0.5009670,
);
path_1.cubicTo(
size.width * 0.9979740,
size.height * 0.3450307,
size.width * 0.9257133,
size.height * 0.2060927,
size.width * 0.8129326,
size.height * 0.1151220,
);
path_1.close();
final Paint paint1Fill = Paint()..style = PaintingStyle.fill;
paint1Fill.color = AppTheme.darken(colors['kMainColor']!);
canvas.drawPath(path_1, paint1Fill);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
有什么办法可以更好地走到tialias帆布路径(不是图像)?如果是图像,我会使用过滤器,但不是图像。我认为这是可能的。
在
的定制版中
a>,但没有找到一种在Flutter “>
Paint.isAntiAlias = false;
Paint.isAntiAlias = true;
@override
void paint(Canvas canvas, Size size) {
final Path path_0 = Path();
path_0.moveTo(
size.width * 0.5002533,
size.height * 0.004880920,
);
path_0.cubicTo(
size.width * 0.2252237,
size.height * 0.004880922,
size.width * 0.002532500,
size.height * 0.2268787,
size.width * 0.002532500,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.002532500,
size.height * 0.7752251,
size.width * 0.2252237,
size.height * 0.9972229,
size.width * 0.5002533,
size.height * 0.9972220,
);
path_0.cubicTo(
size.width * 0.7752828,
size.height * 0.9972229,
size.width * 0.9979740,
size.height * 0.7752251,
size.width * 0.9979740,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.9979740,
size.height * 0.2268787,
size.width * 0.7752828,
size.height * 0.004880922,
size.width * 0.5002533,
size.height * 0.004880920,
);
path_0.close();
path_0.moveTo(
size.width * 0.5002533,
size.height * 0.8731800,
);
path_0.cubicTo(
size.width * 0.3693230,
size.height * 0.8731802,
size.width * 0.2513929,
size.height * 0.7020954,
size.width * 0.2513929,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.2513929,
size.height * 0.3000084,
size.width * 0.3692386,
size.height * 0.1289237,
size.width * 0.5002533,
size.height * 0.1289230,
);
path_0.cubicTo(
size.width * 0.6312679,
size.height * 0.1289237,
size.width * 0.7491136,
size.height * 0.3000084,
size.width * 0.7491136,
size.height * 0.5010510,
);
path_0.cubicTo(
size.width * 0.7491136,
size.height * 0.7020954,
size.width * 0.6311835,
size.height * 0.8731802,
size.width * 0.5002533,
size.height * 0.8731800,
);
path_0.close();
final Paint paint0Fill = Paint()..style = PaintingStyle.fill;
paint0Fill.color = colors['kMainColor']!;
canvas.drawPath(path_0, paint0Fill);
final Path path_1 = Path();
path_1.moveTo(
size.width * 0.8129326,
size.height * 0.1151220,
);
path_1.cubicTo(
size.width * 0.7594125,
size.height * 0.07859968,
size.width * 0.6966064,
size.height * 0.05444753,
size.width * 0.6312679,
size.height * 0.05444750,
);
path_1.cubicTo(
size.width * 0.5330069,
size.height * 0.05444753,
size.width * 0.4440317,
size.height * 0.1035934,
size.width * 0.3782711,
size.height * 0.1804250,
);
path_1.cubicTo(
size.width * 0.4149924,
size.height * 0.1479424,
size.width * 0.4568631,
size.height * 0.1288395,
size.width * 0.5002533,
size.height * 0.1288390,
);
path_1.cubicTo(
size.width * 0.6311835,
size.height * 0.1288395,
size.width * 0.7491136,
size.height * 0.2999243,
size.width * 0.7491136,
size.height * 0.5009670,
);
path_1.cubicTo(
size.width * 0.7491136,
size.height * 0.7020113,
size.width * 0.6312679,
size.height * 0.8730960,
size.width * 0.5002533,
size.height * 0.8730960,
);
path_1.cubicTo(
size.width * 0.4568631,
size.height * 0.8730960,
size.width * 0.4149924,
size.height * 0.8539931,
size.width * 0.3782711,
size.height * 0.8215090,
);
path_1.cubicTo(
size.width * 0.4440317,
size.height * 0.8984263,
size.width * 0.5330069,
size.height * 0.9474880,
size.width * 0.6312679,
size.height * 0.9474880,
);
path_1.cubicTo(
size.width * 0.6966064,
size.height * 0.9474880,
size.width * 0.7594125,
size.height * 0.9233359,
size.width * 0.8129326,
size.height * 0.8868970,
);
path_1.cubicTo(
size.width * 0.9257977,
size.height * 0.7960111,
size.width * 0.9979740,
size.height * 0.6569890,
size.width * 0.9979740,
size.height * 0.5009670,
);
path_1.cubicTo(
size.width * 0.9979740,
size.height * 0.3450307,
size.width * 0.9257133,
size.height * 0.2060927,
size.width * 0.8129326,
size.height * 0.1151220,
);
path_1.close();
final Paint paint1Fill = Paint()..style = PaintingStyle.fill;
paint1Fill.color = AppTheme.darken(colors['kMainColor']!);
canvas.drawPath(path_1, paint1Fill);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
Is there any way to antialias canvas path(not image) better? If it was an image i'd use filterQuality but it's not an image. I think this should be possible.
Read article about this thing on Android, but did not find a way to use bitmap in Flutter's CustomPaint
I expect to get a result that looks like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论