JuliaImages / ImageDraw.jl

Drawing Package for JuliaImages
Other
27 stars 17 forks source link

Add a cross #24

Closed yakir12 closed 5 years ago

yakir12 commented 5 years ago

I often need to mark something in the image without obscuring it so much. A cross does exactly that.

I'll therefor try to PR something like this:

struct Cross <: Drawable
    c::Point
    arm::Int
end

function draw!(img::AbstractArray{T, 2}, cross::Cross, color::T) where T<:Colorant
    for x in -cross.arm:cross.arm
        img[cross.c.y, cross.c.x + x] = color
    end
    for y in -cross.arm:cross.arm
        img[cross.c.y + y, cross.c.x] = color
    end
    img
end
yakir12 commented 5 years ago

Pinging the person who last committed here, hope that's ok, if not, I apologize.
@johnnychen94

johnnychen94 commented 5 years ago

I saw the PR when you opened it, but unfortunately, I'm not the right person to review it; I'm still quite new to many of JuliaImages packages, including this ImageDraw.jl.

cc: @mronian

yakir12 commented 5 years ago

Ah, I see, thanks. Well, it's a really simple PR, very basic. In fact I'm expecting some requests to add some features (e.g. cross line thickness etc)...