Open elronayellin opened 2 years ago
Quick workaround for circles:
function circle!(image, x0, y0, rad, color; thickness=1)
rad2 = rad^2
for d1 in -rad:rad
d2 = trunc(Int, sqrt(rad2 - d1^2))
ImageDraw.drawifinbounds!(image, CartesianIndex(x0 + d1, y0 + d2), color)
ImageDraw.drawifinbounds!(image, CartesianIndex(x0 + d1, y0 - d2), color)
ImageDraw.drawifinbounds!(image, CartesianIndex(x0 + d2, y0 + d1), color)
ImageDraw.drawifinbounds!(image, CartesianIndex(x0 - d2, y0 + d1), color)
end
if thickness > 1
delta = trunc(Int, thickness / 2)
drange = ((-delta + (thickness + 1) % 2):delta)
for d in drange
circle!(image, x0, y0, rad + d, color; thickness=1)
end
end
image
end
eg:
will not draw anything because the code is using a bogus normalized distance for the inner ellipse.