Skip to content

How to fill to partially fill a shape? #6271

Answered by radarhere
sacrophyte asked this question in Q&A
Discussion options

You must be logged in to vote

If you were looking for a way to simplify your code, the rounded_rectangle() method would be helpful. That would allow you to draw your starting ellipse, middle rectangle and ending ellipse in one line. #4765 (comment) shows an example of a progress bar using that method.

If you wanted to just stop drawing a shape at a certain x position, I would talk about masking, but you would like to have the red portion also rounded.

I'm not sure what you precisely mean by "accurately represented". Are you after a way to not just fill 0.5% of the width, but instead to also consider every pixel? So that you can fill exactly 0.5% of the ellipse's pixels with red? While also having that red ellipse wax …

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@sacrophyte
Comment options

@radarhere
Comment options

@sacrophyte
Comment options

@radarhere
Comment options

@sacrophyte
Comment options

Answer selected by sacrophyte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants