You can do this in init without access to the canvas using the api->canvas_w and api->canvas_h

// No setup required:
int sharpen_init(magic_api * api){
  
  int i;
  char fname[1024];

  for (i = 0; i < sharpen_NUM_TOOLS; i++){
  snprintf(fname, sizeof(fname), "%s/sounds/magic/%s", api->data_directory, sharpen_snd_filenames[i]);
  sharpen_snd_effect[i] = Mix_LoadWAV(fname);
  }

  sharpen_temp = (double*)malloc(api->canvas_w*api->canvas_h*sizeof(double));

  return(1);
}