Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fill for polygons #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dclaar opened this issue Oct 14, 2023 · 1 comment · Fixed by #76
Closed

Fill for polygons #63

dclaar opened this issue Oct 14, 2023 · 1 comment · Fixed by #76

Comments

@dclaar
Copy link

dclaar commented Oct 14, 2023

Please add a fill option for polygons. See also: https://forums.adafruit.com/viewtopic.php?t=205093

Unlike other classes in this library, polygon.py does not have a fill option.

It has this option that I don't really understand:

   :param int colors: (Optional) Number of colors to use. Most polygons would use two, one for
                    outline and one for fill. If you're not filling your polygon, set this to 1
                    for smaller memory footprint. (2)

But there's no way to select that second color. Setting this value to either 1 or 2 does not appear to make any difference at all!

It would be great if it supported all of the "standard" params (meaning what the others support):

    :param int|None fill: The color to fill the rectangle. Can be a hex value for a color or
                    ``None`` for transparent.
    :param int|None outline: The outline of the rectangle. Can be a hex value for a color or
                    ``None`` for no outline.
    :param int stroke: Used for the outline. Will not change the outer bound size set by ``width``
                    and ``height``.

I suppose it's a bit tricky for an arbitrary shape though.

@bablokb
Copy link

bablokb commented Nov 24, 2023

You could use vectorio.Polygon, which is always filled. To create a polygon with outline-color and fill-color unequal, you need to draw the outline above the filled-version. See adafruit_display_shapes/arc.py for some boilerplate code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants