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

sw_engine/stroke: Enhance the quality of the dash line corners. #1685

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

hermet
Copy link
Member

@hermet hermet commented Oct 4, 2023

Previously, the engine didn't properly cover the dash line corner styles because it considered a new line to start at the corner.

This update modifies the logic to recognize curved lines as a single line, including the corners.

There may still be some quality issues,
but it's an improvement over the previous version.

@issue: #121

스크린샷 2023-10-05 010343

Previously, the engine didn't properly cover the dash line corner styles
because it considered a new line to start at the corner.

This update modifies the logic to recognize curved lines
as a single line, including the corners.

There may still be some quality issues,
but it's an improvement over the previous version.

@issue: #121
@hermet hermet added enhancement Improve features image Bitmap image features (jpg/png/webp/gif) labels Oct 4, 2023
@hermet hermet self-assigned this Oct 4, 2023
@capnm
Copy link
Collaborator

capnm commented Oct 4, 2023

I did a quick test of the PR while working on other Godot issues 👍

Details:

image

I have noticed that the stroke-dashoffset isn't calculated correctly.

Details:

Related (line example): #1591 #1607

thi_121-join-lines-attribute-misbehaviour_opt

<svg width="512" height="512" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
	<g fill="none">
		<g stroke-width="20">
			<path d="m20 40h120l-20 90-80-10v-100" stroke="#f00" stroke-linecap="round" stroke-linejoin="bevel"/>
			<path d="m170 40h120l-20 90-80-10v-100" stroke="#ff0" stroke-linecap="square" stroke-linejoin="bevel"/>
			<path d="m320 40h120l-20 90-80-10v-100" stroke="#0f0" stroke-linecap="square" stroke-miterlimit="5"/>
		</g>
		<g stroke-dasharray="40, 40, 60" stroke-width="20">
			<path d="m20 175.21h120l-20 90-80-10v-100" stroke="#f00" stroke-linecap="round" stroke-linejoin="round"/>
			<path d="m170 175.21h120l-20 90-80-10v-100" stroke="#ff0" stroke-linecap="square" stroke-linejoin="bevel"/>
			<path d="m320 175.21h120l-20 90-80-10v-100" stroke="#0f0" stroke-linecap="square" stroke-miterlimit="5"/>
		</g>
		<g stroke-width="15">
			<path d="m137.52 295.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#f00" stroke-linecap="round" stroke-linejoin="round"/>
			<path d="m287.52 295.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#ff0" stroke-linecap="square" stroke-linejoin="bevel"/>
			<path d="m437.52 295.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#0f0" stroke-linecap="square" stroke-miterlimit="5"/>
		</g>
		<g stroke-dashoffset="10" stroke-width="10">
			<path d="m137.52 405.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#f00" stroke-dasharray="30,20" stroke-linecap="round" stroke-linejoin="round"/>
			<path d="m287.52 405.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#ff0" stroke-dasharray="30, 20" stroke-linecap="square" stroke-linejoin="bevel"/>
			<path d="m437.52 405.83a100 100 0 0 1-58.193 77.9l-40.912-91.248z" stroke="#0f0" stroke-dasharray="30, 20" stroke-linecap="square" stroke-miterlimit="5"/>
		</g>
		<g stroke="#ff0" stroke-linejoin="bevel" stroke-width="10">
			<ellipse cx="475" cy="245" rx="15" ry="75" stroke-dashoffset="5"/>
			<ellipse cx="475" cy="410" rx="15" ry="75" stroke-dasharray="30, 10" stroke-dashoffset="20"/>
			<ellipse cx="475" cy="79.999" rx="15" ry="75" stroke-dasharray="30" stroke-linecap="square"/>
		</g>
	</g>
</svg>

@capnm
Copy link
Collaborator

capnm commented Oct 5, 2023

Title: s/enhanced/Enhance

@hermet
Copy link
Member Author

hermet commented Oct 5, 2023

@capnm thanks for info. let's revisit the dash-offset problem with a separate issue ticket.
#1686

@hermet hermet changed the title sw_engine/stroke: enhanced the quality of the dash line corners. sw_engine/stroke: Enhance the quality of the dash line corners. Oct 5, 2023
@hermet hermet merged commit 0cc6cff into main Oct 5, 2023
14 checks passed
@hermet hermet deleted the hermet/sw_engine branch October 5, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve features image Bitmap image features (jpg/png/webp/gif)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants