imageFilter property
The ImageFilter to use when drawing raster images.
For example, to blur an image using Canvas.drawImage, apply an ImageFilter.blur:
import 'dart:ui' as ui;
ui.Image image;
void paint(Canvas canvas, Size size) {
canvas.drawImage(
image,
Offset.zero,
Paint()..imageFilter = ui.ImageFilter.blur(sigmaX: .5, sigmaY: .5),
);
}
See also:
- MaskFilter, which is used for drawing geometry.
Implementation
ImageFilter get imageFilter {
if (_objects == null || _objects[_kImageFilterIndex] == null)
return null;
return _objects[_kImageFilterIndex].creator as ImageFilter;
}
Implementation
set imageFilter(ImageFilter value) {
if (value == null) {
if (_objects != null) {
_objects[_kImageFilterIndex] = null;
}
} else {
_objects ??= List<dynamic>(_kObjectCount);
if (_objects[_kImageFilterIndex]?.creator != value) {
_objects[_kImageFilterIndex] = value._toNativeImageFilter();
}
}
}