Function getFormatFromFileExtension

Synopsis

#include <Source/Falcor/Utils/Image/Bitmap.h>

static FileFormat getFormatFromFileExtension(const std::string &ext)

Description

Get the file format flags for the image extension

Parameters:

[ in ] ext - The image file extension to get the

Source

Lines 336-354 in Source/Falcor/Utils/Image/Bitmap.cpp. Line 115 in Source/Falcor/Utils/Image/Bitmap.h.

Bitmap::FileFormat Bitmap::getFormatFromFileExtension(const std::string& ext)
{
    // This array is in the order of the enum
    static const char* kExtensions[] = {
        /* PngFile */ "png",
        /*JpegFile */ "jpg",
        /* TgaFile */ "tga",
        /* BmpFile */ "bmp",
        /* PfmFile */ "pfm",
        /* ExrFile */ "exr"
    };
    for (uint32_t i = 0 ; i < arraysize(kExtensions) ; i++)
    {
        if (kExtensions[i] == ext) return Bitmap::FileFormat(i);
    }
    logError("Can't find a matching format for file extension '" + ext + "'");
    return Bitmap::FileFormat(-1);
}





Add Discussion as Guest

Log in to DocsForge