ScenicFramework / scenic

Core Scenic library
Apache License 2.0
1.99k stars 137 forks source link

Support draw rounded rectangles with varying corners. #290

Closed GPrimola closed 5 months ago

GPrimola commented 2 years ago

Description

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

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

Checklist

GPrimola commented 1 year ago

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

Many thanks!

GPrimola commented 10 months ago

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

crertel commented 5 months ago

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