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

LineDash cannot handle complex patterns #67

Closed
manutiedra opened this issue Jul 7, 2024 · 3 comments
Closed

LineDash cannot handle complex patterns #67

manutiedra opened this issue Jul 7, 2024 · 3 comments

Comments

@manutiedra
Copy link

There wasn't anything I couldn't do in VectSharp until I found dashed lines with complex patterns like most of:

image

Unfortunately, the current implementation of LineDash only lets you specify one "on" and one "off" length. However, SVG lets you specify an array that lets you handle the most complex patterns:

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray

Is there any plan to improve the LineDash to support this?

@arklumpus
Copy link
Owner

Hi! I'm glad VectSharp has been useful to you!

Thank you for pointing this out! The reason I implemented LineDash like that is that I though the PDF specification only supports one "on" and one "off" length, but I just realised that this is not the case - it's just that all the examples in the spec document are like that 😅

I will work on the implementation, let's leave this open in the meantime!

@arklumpus
Copy link
Owner

This is now implemented in VectSharp 2.6.0! The LineDash constructor now has additional overloads that accept a dash array parameter, which can be used to specify complex dash patterns like the ones above. This is also briefly mentioned in the docs.

You can even animate the dash patterns!

animation

I'm closing this issue for now, feel free to reopen it (or create a new one) if you see any problems with this or if you have any other question!

@manutiedra
Copy link
Author

Outstanding work man! Thank you very much

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

No branches or pull requests

2 participants