rotate function

VARP rotate(
  1. VARP src,
  2. int mode
)

Implementation

VARP rotate(VARP src, int mode) {
  if (mode == ROTATE_90_CLOCKWISE) {
    return flip(transpose(src, [1, 0, 2]), 1);
  }
  if (mode == ROTATE_180) {
    return flip(src, -1);
  }
  if (mode == ROTATE_90_COUNTERCLOCKWISE) {
    return flip(transpose(src, [1, 0, 2]), 0);
  }
  return src;
}