Panel paint routine - different corner radius on same panel?
-
@DanH Yes I made a video about it :)
-
@David-Healey Thanks but I don't see what I'm looking for. Each corner a different radius. 10, 6, 4, 2 or something...
Probably didn't explain the question very well!
-
Oh I see what you mean, hmm you'd probably need to use a path for that.
-
@David-Healey yep. Maybe I'll see if Claude can add to source code though...
-
@DanH I've added a function a while back to make asymmetric rounded corners but they all share the same curve.
Path.addRoundedRectangleCustomisable(var area, var cornerSizeXY, var boolCurves)Perhaps a mix between Dave's object and this function could unlock asymmetric curves + different curves per corner + show/hide with boolean
-
@ustk said in Panel paint routine - different corner radius on same panel?:
asymmetric rounded corners but they all share the same curve
Got an image so I can visualise this?
-
-
@David-Healey @DanH but the problem is that it's derived from this Juce path function
void Path::addRoundedRectangle (const float x, const float y, const float w, const float h, float csx, float csy, const bool curveTopLeft, const bool curveTopRight, const bool curveBottomLeft, const bool curveBottomRight)where we can see there's only one set of
csxandcsyso in the end it's easier to make either a specific function in Hise script that reproduces the Juce's one with more customisation, or just import a path...
-
@ustk Ah cool. I wonder if it's possible to extend the existing drawRoundedRectangle function to allow for this behaviour and what Dan wants too, through the cornerData object.
-
@David-Healey I'm pretty sure all existing rectangles functions in Hise (or at least the ones with corner data) are ending their lives in this Juce function, with its limitations...
void Path::addRoundedRectangle (float x, float y, float w, float h, float cs) { addRoundedRectangle (x, y, w, h, cs, cs); } void Path::addRoundedRectangle (float x, float y, float w, float h, float csx, float csy) { addRoundedRectangle (x, y, w, h, csx, csy, true, true, true, true); } void Path::addRoundedRectangle (const float x, const float y, const float w, const float h, float csx, float csy, const bool curveTopLeft, const bool curveTopRight, const bool curveBottomLeft, const bool curveBottomRight) { csx = jmin (csx, w * 0.5f); csy = jmin (csy, h * 0.5f); auto cs45x = csx * 0.45f; auto cs45y = csy * 0.45f; auto x2 = x + w; auto y2 = y + h; if (curveTopLeft) { startNewSubPath (x, y + csy); cubicTo (x, y + cs45y, x + cs45x, y, x + csx, y); } else { startNewSubPath (x, y); } if (curveTopRight) { lineTo (x2 - csx, y); cubicTo (x2 - cs45x, y, x2, y + cs45y, x2, y + csy); } else { lineTo (x2, y); } if (curveBottomRight) { lineTo (x2, y2 - csy); cubicTo (x2, y2 - cs45y, x2 - cs45x, y2, x2 - csx, y2); } else { lineTo (x2, y2); } if (curveBottomLeft) { lineTo (x + csx, y2); cubicTo (x + cs45x, y2, x, y2 - cs45y, x, y2 - csy); } else { lineTo (x, y2); } closeSubPath(); }But it gives a good hint on how to create a more custom one in Hise script
