scenic icon indicating copy to clipboard operation
scenic copied to clipboard

Support draw rounded rectangles with varying corners.

Open GPrimola opened this issue 2 years ago • 2 comments

Description

This PR extends the already existent Scenic.Script.draw_rounded_rectangle/5 functions to 3 others:

  • Scenic.Script.draw_rounded_rectangle/6
  • Scenic.Script.draw_rounded_rectangle/7
  • Scenic.Script.draw_rounded_rectangle/8

Those extra arguments can be used to draw a rounded rectangle with varying corners radii, and it was done having in mind the HTML <canvas> spec for rounded rectangle while keeping the already existing behavior of rounded rectangle on Scenic.

This functionality was implemented using the already included function nvgRoundedRectVarying on the NanoVG's version Scenic relies on, so there's no need to update any dep's version.

This PR depends on and relates to https://github.com/ScenicFramework/scenic_driver_local/pull/17.

This PR introduces no breaking changes once it doesn't change neither the interface nor the behaviour of the previous existing Scenic.Script.draw_rounded_rectangle/5. And while it depends on https://github.com/ScenicFramework/scenic_driver_local/pull/17, it won't break without it. Instead of breaking, scenic_driver_local/c_src/script.c will only emit a log warning that the operation 0x0C (draw_rrectv on Scenic) doesn't exist.

Motivation and Context

The motivation behind this PR is for Scenic.Script be more compatible with HTML specs.

Types of changes

  • [ ] Bug fix (a non-breaking change which fixes an issue)
  • [x] New feature (a non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

Checklist

  • [x] Check other PRs and make sure that the changes are not done yet.
  • [x] The PR title is no longer than 64 characters.

GPrimola avatar Sep 11 '22 14:09 GPrimola

Hi @crertel, can you take a look on this again? :)

Many thanks!

GPrimola avatar Aug 02 '23 14:08 GPrimola

Hey @crertel, on https://github.com/ScenicFramework/scenic/pull/290#pullrequestreview-1103347521 you added a change request. After that I've tackled some stuff. Could you check again if the changes you requested have been tackled?

Thanks! :D

GPrimola avatar Feb 07 '24 15:02 GPrimola

The other half of this is handled in https://github.com/ScenicFramework/scenic_driver_local/pull/67 .

crertel avatar Jun 15 '24 23:06 crertel