Make an invisible canvas buffer, and draw on it.
@param {number} width The width of the buffer
@param {number} height The height of the buffer
@param {drawCallback} drawFun The callback that draws on the buffer
@returns {external:canvas} The drawn buffer
function makeBuffer(width, height, drawFun) {
  var canvas = makeCanvas(width, height);
  var ctx = canvas.getContext("2d");
  // when image smoothing is enabled, the image gets blurred and the pixel data isn't correct even when the image shouldn't be scaled which breaks NinePatch
  if (platform.isEjecta()) {
    ctx.imageSmoothingEnabled = false;
  }
  drawFun(ctx);
  return canvas;
}