Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
io_utils.h File Reference

Miscellaneous file input & output utilities. More...

#include "Frame/frame_fwd.h"
#include "Math/math_fwd.h"
#include "DataIO/EPictureFile.h"
#include <Common/primitive_type.h>
#include <cstddef>
#include <string_view>
#include <string>

Go to the source code of this file.

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::io_utils
 Helpers for data I/O.
 
namespace  ph::io_utils::detail
 

Functions

std::string ph::io_utils::load_text (const Path &filePath)
 Read the whole file as a formatted string.
 
bool ph::io_utils::has_LDR_support (std::string_view filenameExt)
 Checks whether the provided picture format supports LDR by filename extension.
 
bool ph::io_utils::has_HDR_support (std::string_view filenameExt)
 Checks whether the provided picture format supports HDR by filename extension.
 
bool ph::io_utils::load_picture_meta (const Path &picturePath, PictureMeta *out_meta, math::Vector2S *out_sizePx=nullptr, std::size_t *out_numChannels=nullptr)
 Load general information that describes the picture. For most formats, this parses the image header without loading actual pixel data.
 
void ph::io_utils::save (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a LDR frame to the specified file. Similar to save(4), except file name and format are deduced from path.
 
void ph::io_utils::save (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a HDR frame to the specified file. Similar to save(4), except file name and format are deduced from path.
 
void ph::io_utils::save (const LdrRgbFrame &frame, const Path &fileDirectory, const std::string &name, EPictureFile format, const PictureMeta *meta=nullptr)
 Saves a LDR frame to the specified file. Notice that if the specified format is HDR, values will be promoted to higher precision types which can have extra storage cost.
 
void ph::io_utils::save (const HdrRgbFrame &frame, const Path &fileDirectory, const std::string &name, EPictureFile format, const PictureMeta *meta=nullptr)
 Saves a HDR frame to the specified file. Notice that if the specified format is LDR, values outside [0, 1] will be clamped (this may result in significant data loss depending on the values stored).
 
void ph::io_utils::save_png (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in PNG format.
 
void ph::io_utils::save_jpg (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in JPG format.
 
void ph::io_utils::save_bmp (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in BMP format.
 
void ph::io_utils::save_tga (const LdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in TGA format.
 
void ph::io_utils::save_hdr (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in HDR format.
 
void ph::io_utils::save_exr (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in EXR format.
 
void ph::io_utils::save_exr_high_precision (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in EXR format with high precision encoding.
 
void ph::io_utils::save_pfm (const HdrRgbFrame &frame, const Path &filePath, const PictureMeta *meta=nullptr)
 Saves a frame in PFM format.
 
void ph::io_utils::save_exr (const HdrRgbFrame &frame, ByteBuffer &buffer, const PictureMeta *meta=nullptr)
 Saves a frame in EXR format to memory.
 
bool ph::io_utils::detail::init_picture_IO ()
 
RegularPicture ph::io_utils::load_picture (const Path &picturePath, std::size_t layerIdx=0)
 Loads common picture types from file. Format is deduced from filename extension. Tries to load the specified layer into a regular picture.
 
RegularPicture ph::io_utils::load_LDR_picture (const Path &picturePath, std::size_t layerIdx)
 
RegularPicture ph::io_utils::load_HDR_picture (const Path &picturePath, std::size_t layerIdx)
 

Detailed Description

Miscellaneous file input & output utilities.