ImageProperties GetImageProperties()

in src/utils/Image_Utils.cpp [40:59]


ImageProperties GetImageProperties(char const* filePath) {
  ImageProperties result = {
      1,
      1,
      IMAGE_OPAQUE,
  };

  FILE* f = fopen(filePath, "rb");
  if (f == nullptr) {
    return result;
  }

  int channels;
  int success = stbi_info_from_file(f, &result.width, &result.height, &channels);

  if (success && channels == 4 && imageHasTransparentPixels(f)) {
    result.occlusion = IMAGE_TRANSPARENT;
  }
  return result;
}