Android 如何在颤振中创建过滤图像
我正在尝试创建一个图像过滤器,我想知道的是,是否可以对图像应用颜色过滤器,然后使用应用的颜色过滤器保存该图像?如果是,那么怎么做。现在,我已经能够使用以下代码将颜色过滤器应用于图像。但我们需要的是保存该图像并用彩色滤光片显示Android 如何在颤振中创建过滤图像,android,flutter,image-processing,dart,image-editing,Android,Flutter,Image Processing,Dart,Image Editing,我正在尝试创建一个图像过滤器,我想知道的是,是否可以对图像应用颜色过滤器,然后使用应用的颜色过滤器保存该图像?如果是,那么怎么做。现在,我已经能够使用以下代码将颜色过滤器应用于图像。但我们需要的是保存该图像并用彩色滤光片显示 Container( child: Stack( children: <Widget>[ ColorFiltered( colorFilter: ColorFilter.mode(Colors.black87, Blend
Container(
child: Stack(
children: <Widget>[
ColorFiltered(
colorFilter: ColorFilter.mode(Colors.black87, BlendMode.color),
child: Image(
image: FileImage(
this.images[index]
),
),
),
)
]
)
);
使用小部件,您可以进行各种操作
import 'dart:io';
import 'package:image/image.dart';
void main() {
// Create an image
Image image = Image(320, 240); // You can also load an image here
// Fill it with a solid color (blue) OR add color filter
fill(image, getColor(0, 0, 255));
// Draw some text using 24pt arial font
drawString(image, arial_24, 0, 0, 'Hello World');
// Draw a line
drawLine(image, 0, 0, 320, 240, getColor(255, 0, 0), thickness: 3);
// Blur the image
gaussianBlur(image, 10);
// Save the image to disk as a PNG
File('test.png').writeAsBytesSync(encodePng(image));
}
使用小部件,您可以进行各种操作
import 'dart:io';
import 'package:image/image.dart';
void main() {
// Create an image
Image image = Image(320, 240); // You can also load an image here
// Fill it with a solid color (blue) OR add color filter
fill(image, getColor(0, 0, 255));
// Draw some text using 24pt arial font
drawString(image, arial_24, 0, 0, 'Hello World');
// Draw a line
drawLine(image, 0, 0, 320, 240, getColor(255, 0, 0), thickness: 3);
// Blur the image
gaussianBlur(image, 10);
// Save the image to disk as a PNG
File('test.png').writeAsBytesSync(encodePng(image));
}
哇,太好了。非常感谢你喜欢它@marvinralph:你能接受这个答案吗?但有一件事我似乎不明白,那就是如何将blendMethod设置为flutter BlendMode哇,太棒了。非常感谢您喜欢它@marvinralph:您能接受这个答案吗?但有一件事我似乎不明白,那就是如何将blendMethod设置为flutter BlendMode