Skip to content
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 methods to drawing thin poly-lines #44337

Closed

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Dec 13, 2020

This is one of the ways to fix #44332 - I've added add_thin_polyline to RenderServer and draw_thin_polyline, draw_thin_polyline_colors, draw_thin_arc to CanvasItem. Instead PRIMITIVE_TRIANGLE_STRIP it used PRIMITIVE_LINE and does not have thickness and antialiasing parameters.

Also, the line with width < 1.0 is already draw incorrectly - for example with width = 0.1:
image
so I've added a limiter to canvas_item_add_polyline to prevent this.

@briansemrau
Copy link
Contributor

I'm uncertain whether limiting width to a minimum of 1.0 is the way to go. If someone prefers to use the canvas zoomed in, they might want to draw thinner lines than that. And I would expect the line at width=1 to disappear anyway if you zoomed out, right?

@Chaosus
Copy link
Member Author

Chaosus commented Dec 13, 2020

I don't think that disappearing and invalid looking lines should be expected behavior - if you really need them to disappear you could do it programmatically by detecting the required zoom level.

@briansemrau
Copy link
Contributor

Yeah I agree, I just don't think there's an easy way to avoid that because canvas scaling will always be able to scale (non-hairline) geometry small enough to disappear.

@Chaosus
Copy link
Member Author

Chaosus commented Dec 13, 2020

There always been some limitations the goal is to keep balance like anywhere in the engine.

@Chaosus
Copy link
Member Author

Chaosus commented Dec 13, 2020

And I would expect the line at width=1 to disappear anyway if you zoomed out, right?

Yes, and I think it's not fixable (or at least I don't know how), but at least you will have a thin line which is a different kind of geometry that always preserved its form.

@Chaosus
Copy link
Member Author

Chaosus commented Dec 17, 2020

Closed in favor of #44361 (I think it's more compact and relevant)

@Chaosus Chaosus closed this Dec 17, 2020
@Chaosus Chaosus deleted the added_thin_polylines_methods branch December 17, 2020 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CanvasItem.draw_polyline does not draw 1px lines when width<=1.0
3 participants