Quick answer: Enable Nine Slice in the sprite editor and set the slice guides. Then draw with draw_sprite_stretched — it respects the nine-slice; plain scaled draws don’t.

A UI panel sprite stretches its rounded corners when resized. Nine-slice wasn’t enabled on the sprite, or the draw call doesn’t use the stretched variant.

Enable Nine Slice on the Sprite

  1. Open the sprite in the Sprite Editor.
  2. Toggle Nine Slice on.
  3. Drag the four slice guides to mark the non-stretching border (corners) vs the stretchable center/edges.

The corners stay fixed-size; edges stretch on one axis; the center stretches both.

Draw with the Stretched Function

draw_sprite_stretched(spr_panel, 0, x, y, panel_w, panel_h);

draw_sprite_stretched honors the nine-slice guides. Plain draw_sprite_ext with x/y scale ignores nine-slice and stretches everything — that’s the bug.

Tile vs Stretch per Slice

In the Nine Slice settings you can set each edge to Stretch, Repeat (tile), or Mirror. For textured borders, Repeat avoids the smeared look that Stretch gives.

Minimum Size

If you draw the panel smaller than (left + right) corner widths, the corners overlap and look wrong. Clamp the panel size to a sensible minimum.

Verifying

Resize the panel to many sizes. Corners stay crisp and fixed; edges and center stretch/tile correctly. No distorted rounded corners.

“Nine-slice needs both: enabled+guided on the sprite, and draw_sprite_stretched at the call site.”

Author panel art with a generous, uniform border — it makes the slice guides easy to place and the stretch results predictable.