Skip to content

Latest commit

 

History

History
151 lines (106 loc) · 5.18 KB

draw.md

File metadata and controls

151 lines (106 loc) · 5.18 KB

Draw Functions

The Dart Image Library provides a number of functions for modifying images, by applying color filters, transformations into other images (resize, crop), or basic drawing.

Masking Draw Functions

Most of the drawing 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:

mask sketchMask

Draw Functions

Image compositeImage(Image dst, Image src, {
    int? dstX, int? dstY, int? dstW, int? dstH, int? srcX, int? srcY,
    int? srcW, int? srcH, BlendMode blend = BlendMode.alpha,
    bool linearBlend = false,
    bool center = false, Image? mask,
    Channel maskChannel = Channel.luminance })

compositeImage

Image drawChar(Image image, String char, { required BitmapFont font,
    required int x, required int y, Color? color, Image? mask,
    Channel maskChannel = Channel.luminance });

drawChar

Image drawCircle(Image image, { required int x, required int y,
    required int radius, required Color color, bool antialias = false,
    Image? mask, Channel maskChannel = Channel.luminance })

drawCircle

Image drawLine(Image image, { required int x1, required int y1,
    required int x2, required int y2, required Color color,
    bool antialias = false, num thickness = 1, Image? mask,
    Channel maskChannel = Channel.luminance })

drawLine

Image drawPixel(Image image, int x, int y, Color c, { Color? filter,
    num? alpha, BlendMode blend = BlendMode.alpha,
    bool linearBlend = false, Image? mask,
    Channel maskChannel = Channel.luminance })

drawPixel

Image drawPolygon(Image src, { required List<Point> vertices,
    required Color color, bool antialias = false, Image? mask, Channel maskChannel = Channel.luminance })

drawPolygon

Image drawRect(Image dst, { required int x1, required int y1, required int x2,
    required int y2, required Color color, num radius = 0, num thickness = 1, Image? mask,
    Channel maskChannel = Channel.luminance })

drawRect

Image drawString(Image image, String string, { required BitmapFont font,
    int? x, int? y, Color? color, bool rightJustify = false, bool wrap = false,
    Image? mask, Channel maskChannel = Channel.luminance })

drawString

Image fill(Image image, { required Color color, Image? mask,
Channel maskChannel = Channel.luminance })

fill

Image fillCircle(Image image, { required int x, required int y,
  required int radius, required Color color, bool antialias = false, 
  Image? mask, Channel maskChannel = Channel.luminance})

fillCircle

Image fillFlood(Image src, { required int x, required int y,
    required Color color, num threshold = 0.0, bool compareAlpha = false,
    Image? mask, Channel maskChannel = Channel.luminance })

fillFlood

Image fillPolygon(Image src, { required List<Point> vertices,
    required Color color, Image? mask, Channel maskChannel = Channel.luminance })

fillPolygon

Image fillRect(Image src, { required int x1, required int y1, required int x2,
    required int y2, required Color color, num Radius = 0, Image? mask,
    Channel maskChannel = Channel.luminance })

fillRect