chickadee » sdl2 » rect-grow/center!

rect-grow/center rect dw dhprocedure
rect-grow/center! rect dw dh #!optional destprocedure

Efficiently increase rect's size while trying to keep the same center point. See also rect-grow!, which keeps the rect's top left corner the same. The results will be clamped to the range -2147483648 to 2147483647.

dw and dh must be integers. Negative numbers cause the size to decrease (i.e. shrink).

For best results, use even numbers for dw and dh. If dw or dh are odd numbers, the rect's center point will change by half a pixel due to rounding.

  • rect-grow/center returns a new managed sdl2:rect.
  • rect-grow/center! modifies and returns dest. If dest is omitted, rect is modified and returned.

Requires sdl2 egg 0.2.0 or higher.