Skip to content

Conversation

@SoloByte
Copy link
Collaborator

@SoloByte SoloByte commented Dec 10, 2025

Summary

This PR is about overhauling, cleaning, and improving Shape drawing in ShapeEngine. The main goal is to fix all outline drawing functions of closed shapes and Polyline drawing.
I am implementing custom algorithms to construct and draw triangles instead of just drawing lines with cap types. Currently, using colors with any transparency for outlines will look bad on almost all shapes (line, ray, segment are not affected). Every other shape will have overlaps in the corners that will become visible with alpha values below 255.

Current Problematic Version

ShapeEngine-ShapeOutlineDrawingProblem

New Version

ShapeEngine-ShapeOutlineDrawing-New

ShapeEngine-ShapeOutlineDrawing-New2

Affected Functions

Below is a list of functions that are affected by this problem and need to be fixed (might be missing some functions):

  • CircleLine
  • CircleSectorLine
  • CircleLinePercentage
  • RingLine
  • RingSectorLine
  • TriangleLine
  • TrianglePercentageLine
  • TriangleCornered
  • TriangleRounded
  • TriangleRoundedLines
  • RectLines
  • RectRounded
  • RectRoundedLines
  • RectPercentageLines
  • RectCornered
  • RectSlantedCorners
  • QuadLines
  • QuadRounded
  • QuadRoundedLines
  • QuadPercentageLines
  • QuadCornered
  • QuadSlantedCorners
  • PolygonLines
  • PolygonCornered
  • PolygonPercentageLines
  • PolygonRoundedLines
  • PolygonRounded?
  • Polyline
  • PolylineRounded
  • PolylinePercentage
  • PolylineCornered

At first, I did not realize how much work it would be to do this, and I just started working on this. Thankfully, I am close to the end now with most of the functions already working. Still needs complete testing to make sure all of this works!

Performance

This should (theoretically) come with performance improvements on a lot of drawing functions because they are now drawing much fewer triangles than before. The downside is that the function itself needs to do more work to calculate all the triangle points needed. I will test it once I am finished.

…nstead of drawing segments with cap types that might overlap.
Refactor: New DrawCircleLinesInternal function added for drawing circle outlines. (calculates triangles and draws them directly instead of using DrawSegment)
Refactor: DrawCircleSectorLinesInternal started.
Refactor: DrawSectorLines unified into 2 variations with only 1 concrete implementation each
…ge are now the same function just with different parameters (f or start/endangle)
Refactor: Some clean up.
Refactor: totalMiterLengthLimit calculation changed in DrawLinesMiteredHelper.
@SoloByte SoloByte added this to the 5.0 milestone Dec 10, 2025
@SoloByte SoloByte self-assigned this Dec 10, 2025
@SoloByte SoloByte added the improvement Improvement of existing code. label Dec 10, 2025
@SoloByte
Copy link
Collaborator Author

#126

@SoloByte SoloByte moved this from Inbox to Backlog in Shape Engine Roadmap Jan 15, 2026
@SoloByte SoloByte moved this from Backlog to Next Release in Shape Engine Roadmap Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement of existing code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants