The Dart Image Library provides a number of functions for applying color filters to images. These functions will be applied to the image itself rather than create a new image.
Most of the drawing and filter functions can take a mask parameter. A mask is an image that controls the blending of the filter per pixel. You can specify which channel of the mask, or its luminance, to use for the blending value. Where the mask channel is full intensity, the filter has full effect, and where the mask channel is 0, it has no effect; and values in between will blend the filter with the original image.
Using a mask image to blend the sketch filter:
Image adjustColor(Image src,
{ Color? blacks, Color? whites, Color? mids, num? contrast, num? saturation, num? brightness, num? gamma, num? exposure,
num? hue, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image billboard(Image src, { num grid = 10, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image bleachBypass(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image bulgeDistortion(Image src, { int? centerX, int? centerY, num? radius, num scale = 0.5,
Interpolation interpolation = Interpolation.nearest, Image? mask, Channel maskChannel = Channel.luminance })
Image bumpToNormal(Image src, { num strength = 2 })
Image chromaticAberration(Image src, { int shift = 5, Image? mask, Channel maskChannel = Channel.luminance })
Image colorHalftone(Image src, { num amount = 1, int? centerX, int? centerY,
num angle = 180, num size = 5, Image? mask, Channel maskChannel = Channel.luminance })
Image colorOffset(Image src, { num red = 0, num green = 0, num blue = 0, num alpha = 0,
Image? mask, Channel maskChannel = Channel.luminance })
Image contrast(Image src, { required num contrast, Image? mask, Channel maskChannel = Channel.luminance,
ContrastMode mode = ContrastMode.proportional})
Image convolution(Image src, { required List<num> filter,
num div = 1.0, num offset = 0.0, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image copyImageChannels(Image src, { required Image from, bool scaled = false,
Channel? red, Channel? green, Channel? blue, Channel? alpha,
Image? mask, Channel maskChannel = Channel.luminance })
Image ditherImage(Image image, { Quantizer? quantizer,
DitherKernel kernel = DitherKernel.floydSteinberg,
bool serpentine = false })
Image dotScreen(Image src, { num angle = 180, num size = 5.75, int? centerX,
int? centerY, num amount = 1, Image? mask,
Channel maskChannel = Channel.luminance })
Image dropShadow(Image src, int hShadow, int vShadow, int blur, { Color? shadowColor })
Image edgeGlow(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image emboss(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image gamma(Image src, { required num gamma, Image? mask, Channel maskChannel = Channel.luminance })
Image gaussianBlur(Image src, { required int radius, Image? mask, Channel maskChannel = Channel.luminance })
Image grayscale(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image hdrToLdr(Image hdr, { num? exposure })
Image hexagonPixelate(Image src, { int? centerX, int? centerY, int size = 5,
num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image invert(Image src, { Image? mask, Channel maskChannel = Channel.luminance })
Image luminanceThreshold(Image src, { num threshold = 0.5,
bool outputColor = false, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image monochrome(Image src, { Color? color, num amount = 1,
Image? mask, Channel maskChannel = Channel.luminance })
Image noise(Image image, num sigma, { NoiseType type = NoiseType.gaussian, Random? random,
Image? mask, Channel maskChannel = Channel.luminance })
Image normalize(Image src, { required num min, required num max,
Image? mask, Channel maskChannel = Channel.luminance })
Image pixelate(Image src, { required int size,
PixelateMode mode = PixelateMode.upperLeft, num amount = 1, Image? mask,
Channel maskChannel = Channel.luminance })
Image quantize(Image src, { int numberOfColors = 256, QuantizeMethod method = QuantizeMethod.neuralNet,
DitherKernel dither = DitherKernel.none, bool ditherSerpentine = false })
Image reinhardTonemap(Image hdr, { Image? mask, Channel maskChannel = Channel.luminance })
Image remapColors(Image src, { Channel red = Channel.red, Channel green = Channel.green,
Channel blue = Channel.blue, Channel alpha = Channel.alpha })
Image scaleRgba(Image src, { required Color scale, Image? mask, Channel maskChannel = Channel.luminance })
Image separableConvolution(Image src, { required SeparableKernel kernel,
Image? mask, Channel maskChannel = Channel.luminance })
Image sepia(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image sketch(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
Image smooth(Image src, { required num weight, Image? mask, Channel maskChannel = Channel.luminance })
Image sobel(Image src, { num amount = 1, Image? mask, Channel maskChannel = Channel.luminance })
enum SolarizeMode { highlights, shadows }
Image solarize(Image src, { required int threshold, SolarizeMode mode = SolarizeMode.highlights })
Image stretchDistortion(Image src, { int? centerX, int? centerY,
Interpolation interpolation = Interpolation.nearest, Image? mask, Channel maskChannel = Channel.luminance })
Image vignette(Image src, { num start = 0.3, num end = 0.85,
num amount = 0.9, Color? color, Image? mask, Channel maskChannel = Channel.luminance })