forked from lxm_flutter/FlutterUnit
优化绘制冰墩墩
This commit is contained in:
@@ -24,7 +24,7 @@ class _DunDunViewState extends State<DunDunView> {
|
||||
}
|
||||
|
||||
void loadImage() async {
|
||||
ByteData data2 = await rootBundle.load('assets/images/logo1.png');
|
||||
ByteData data2 = await rootBundle.load('assets/images/logo1.webp');
|
||||
image = await decodeImageFromList(data2.buffer.asUint8List());
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
@@ -232,11 +232,10 @@ class DunDunPainter extends CustomPainter {
|
||||
pathPaint..color = Colors.red;
|
||||
starPath = starPath.shift(Offset(152, -20));
|
||||
canvas.drawPath(starPath, pathPaint);
|
||||
|
||||
if (image != null) {
|
||||
Rect src2 = Rect.fromLTWH(
|
||||
0, 0, image!.width.toDouble(), image!.height.toDouble());
|
||||
Rect dst2 = Rect.fromLTWH(50, 55, 899 / 27, 1066 / 27);
|
||||
Rect dst2 = Rect.fromLTWH(50, 55, 899 / 28, 1066 / 28);
|
||||
|
||||
canvas.drawImageRect(image!, src2, dst2, Paint());
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class GalleryFactory {
|
||||
title: "冰墩墩",
|
||||
author: "张风捷特烈",
|
||||
info:
|
||||
" 本样例会绘制 2022 年北京冬奥会吉祥物冰墩墩的绘制,可以学到路径绘制、渐变色等知识。",
|
||||
" 本样例是绘制 2022 年北京冬奥会吉祥物冰墩墩的形体,从中可以学到路径绘制、渐变色等知识。",
|
||||
content: DunDunView()),
|
||||
FrameShower(
|
||||
title: "井字棋",
|
||||
|
||||
Reference in New Issue
Block a user