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
Added border_radius keyword for draw.rect and drawing of one circle quadrant, fixed bounding rects #1494
Conversation
…cle bounding rect
Thanks @MightyJosip :) |
@charlesej since you did draw documentation, can you just check if I wrote it right, this is my first time I was writing docs and using rst files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your documentation looks good. I made a few minor comments.
One final note. When you are done making your changes to draw.rst, remember to run setup on the docs (python setup.py docs) to generate/update the draw_doc.h file.
About quadrant=0-4... Is it confusing? I'm not sure if it's better than 0-3, and a default None for quadrant? If kwargs were used (top_left, top_right, bottom_left, bottom_right) each defaulting to True, then it would make it possible from the API that different quadrants could be True and drawn at once. I'm not sure if that's desirable? |
@MightyJosip here's an example of usage you asked for. Edit: here is how it looks using the quadrant argument. pygame.draw.circle(screen, BLUE, [250, 250], 40, 0, quadrant=1)
pygame.draw.circle(screen, RED, [250, 250], 40, 30, 2, quadrant=2)
pygame.draw.circle(screen, GREEN, [250, 250], 40, 20, quadrant=3)
pygame.draw.circle(screen, BLACK, [250, 250], 40, 10, quadrant=4)
# draw top left, bottom left slices of the circle.
pygame.draw.circle(screen, BLACK, [250, 250], 40, 10, quadrant=1)
pygame.draw.circle(screen, BLACK, [250, 250], 40, 10, quadrant=4) Here is how it looks using the top, left, bottom, right args. pygame.draw.circle(screen, BLUE, [250, 250], 40, 0, top_left=True)
pygame.draw.circle(screen, RED, [250, 250], 40, 30, 2, top_right=True)
pygame.draw.circle(screen, GREEN, [250, 250], 40, 20, bottom_right=True)
pygame.draw.circle(screen, BLACK, [250, 250], 40, 10, bottom_left=True)
# draw top left, bottom left slices of the circle.
pygame.draw.circle(screen, BLACK, [250, 250], 40, 10, bottom_left=True, top_left=True) They should probably default to None, so that it is not required to call each one with False? The only problem is that bottom_left, top_left doesn't read very well. It does not saying anything about what top_left refers to (drawing only the top_left quarter of the circle). Here's some other possible names...
|
Regarding:
Do you mean for the rounded corners? In css they do let each corner be controlled with separate rules:
This way they have the default border-radius, and then each other rule can override that.
|
I updated the example usage comment above with the quadrant=, and top_left= styles to make comparison easier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
This should fix #895, #1120, #1122, #1153, #1212, #1241, #1305 and #1306