Add RoundedRectanglePolygon and PathBuilder helpers.
Merged
JI
6mo ago+619+619+012345678901234567890123456789-346-346-012345678901234567890123456789
Prerequisites
- I have written a descriptive pull-request title
- I have verified that there are no overlapping pull-requests open
- I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
- I have provided test coverage for my change (where applicable)
Description
Fixes #9
This pull request introduces support for rounded rectangles in the drawing library by adding a new RoundedRectanglePolygon shape and integrating it with the PathBuilder API. It also includes comprehensive tests and a reference image to ensure correctness and visual fidelity.
New Shape and API Enhancements:
- Added the
RoundedRectanglePolygonclass, which defines a rounded rectangle shape with configurable corner radii and provides transformation support. - Extended the
PathBuilderclass with multipleAddRoundedRectangleoverloads to easily add rounded rectangles to paths using various parameter types (rectangle, radii, coordinates).
Testing and Validation:
- Added new tests in
RoundedRectangleTests.csto verify the correctness of theRoundedRectanglePolygonimplementation, including bounds, flattening, corner shapes, scaling, and transformation behavior. - Added tests in
PathBuilderTests.csto ensure that the newAddRoundedRectanglemethods produce paths equivalent to direct construction ofRoundedRectanglePolygon. - Added a test in
DrawingCanvasTests.Primitives.csto compare rendering output of filled and stroked rounded rectangles against a reference image. - Included a new reference PNG image for visual regression testing of rounded rectangles.
Documentation and Minor Improvements:
- Improved the summary comment for
RectangularPolygonfor clarity.