ImageDraw.jl icon indicating copy to clipboard operation
ImageDraw.jl copied to clipboard

Semi-transparent shapes and automatic flood fill.

Open norpadon opened this issue 2 years ago • 2 comments

Add an option to make drawn shapes semi-transparent by specifying a keyword argument opacity, like this:

ImageDraw.draw!(image, ImageDraw.Cross(ImageDraw.Point(x, y), 3), color, opacity=0.2)

Also change the polygon filling API. Now you don't need to pass any objects containing seed coordinates, just specify keyword arguments fill_color and fill_opacity:

ImageDraw.draw(keypoint_vis, rectangle, RGBA{Float64}(1, 0, 0), opacity=1.0, fill_color=RGBA{Float64}(0, 1, 0), fill_opacity=0.5)

keypoint_vis

norpadon avatar Sep 25 '23 22:09 norpadon

The new feature looks pretty nice!

This PR introduces a few breaking things, I insist you trying both of the following before merging:

  • use @deprecate and Base.depwarn to properly handle methods/types that could still be supported in a compatible way. For deprecation, This is a good reference if you've never done such kind of thing before.
  • introduce a good changelog.md file to let future users what's breaking, the rational, and the suggested steps to migrate. Documenter.jl does this really really well.

johnnychen94 avatar Sep 28 '23 13:09 johnnychen94

I would like to know why is it good to introduce the flag opacity, instead of using RGBA{N0f8}(1.,0,0,0.4) for 40% opacity? I mean if the color already defines the opacity, then why define it in the function call?

Sixzero avatar Jan 18 '24 15:01 Sixzero