orhanbalci / rough-rs

draw handy sketches from your rust applications
MIT License
30 stars 9 forks source link

set line_cap and line_join in draw function from RenderContext #13

Closed AlanLang closed 1 year ago

AlanLang commented 1 year ago

Subject: Feature Request: Adding Line Cap and Line Join Configuration Options

Dear Author's,

First and foremost, I would like to extend my gratitude for creating and maintaining such an invaluable repository. Your work has been incredibly useful for my projects.

I have been looking to customize the line_cap and line_join attributes on the ctx object, similar to what has been implemented in this Excalidraw commit: Excalidraw Commit. However, I was unable to find a straightforward way to achieve this with the existing codebase.

As a temporary measure, I forked the repository and made the following changes to the kurbo_generator.rs file, specifically at line 79:

  ss.set_dash_pattern(stroke_line_dash.as_slice());
  ss.set_dash_offset(self.options.stroke_line_dash_offset.unwrap_or(1.0f64));
  ss.set_line_cap(LineCap::Round);
  ss.set_line_join(piet::LineJoin::Round);

While this approach works, I believe that incorporating a more user-friendly method to configure these attributes would greatly benefit the community. Would you consider adding this feature in a future release?

Thank you for considering my request. I look forward to your response.

Best regards

orhanbalci commented 1 year ago

Hi Alan this would be a nice feature to have. Looked at your implementation, its legit. If you like to contribute you can open a pr. In addition to your implementation please provide an example and try to integrate this feature to tiny-skia wrapper also.