Function References

    Methods

    ImageDraw.drawFunction
    img_new = draw(img, drawable, color)
    img_new = draw(img, [drawable], [color])

    Draws the drawable object on a copy of image img using color color. Can also draw multiple Drawable objects when passed as a AbstractVector{Drawable} with corresponding colors in [color]

    source
    draw(img::AbstractArray{T,2}, verts::Vector{CartesianIndex{2}}, f::AbstractPolyFillAlgorithm; closed::Bool)

    Draw on img using algorithm f.

    Output

    When img is specified, a copy of img is made and changes are made on it and returned.

    Example

    Just simply pass an algorithm with parameters, with image and vertices of polygon

    using ImageDraw
    
    img = zeros(RGB, 7, 7)
    expected = copy(img)
    expected[2:6, 2:6] .= RGB{N0f8}(1)
    
    verts = [CartesianIndex(2, 2), CartesianIndex(2, 6), CartesianIndex(6, 6), CartesianIndex(6, 2), CartesianIndex(2,2)]
    
    res = draw(img, verts, BoundaryFill(4, 4; fill_value = RGB(1), boundary_value = RGB(1)); closed = true)
    source
    ImageDraw.draw!Function
    img = draw!(img, drawable, color)
    img = draw!(img, drawable)

    Draws drawable on img using color color which defaults to oneunit(eltype(img))

    source
    img = draw!(img, [drawable], [color])
    img = draw!(img, [drawable] ,color)
    img = draw!(img, [drawable])

    Draws all objects in [drawable] in the given order on img using corresponding colors from [color] which defaults to oneunit(eltype(img)) If only a single color color is specified then all objects will be colored with that color.

    source
    draw!(img::AbstractArray{T,2}, verts::Vector{CartesianIndex{2}}, f::AbstractPolyFillAlgorithm; closed::Bool)

    Draw on img using algorithm f.

    Output

    When img is specified, changes are made on img and returned.

    Example

    Just simply pass an algorithm with parameters, with image and vertices of polygon

    using ImageDraw
    
    img = zeros(RGB, 7, 7)
    expected = copy(img)
    expected[2:6, 2:6] .= RGB{N0f8}(1)
    
    verts = [CartesianIndex(2, 2), CartesianIndex(2, 6), CartesianIndex(6, 6), CartesianIndex(6, 2), CartesianIndex(2,2)]
    
    draw!(img, verts, BoundaryFill(4, 4; fill_value = RGB(1), boundary_value = RGB(1)); closed = true)
    source
    ImageDraw.bresenhamFunction
    res = bresenham(img, y0, x0, y1, x1, color)

    Method to generate a line profile from (x0,y0) to (x1,y1) of a 2d image using Bresenham's algorithm.

    source
    ImageDraw.xiaolin_wuFunction
    res = xiaolin_wu(img, x0, y0, x1, x2, color)

    Method to generate a line profile from (x0,y0) to (x1,y1) of a 2d image using Xiaolin Wu line algorithm.

    source