rigImage 0.1.0
RigKit pack API - rigImage
Loading...
Searching...
No Matches
Image.h File Reference

Load image files into a CPU raster and upload them as GLES textures. More...

#include <string>
#include <vector>
#include "Raster.h"
Include dependency graph for Image.h:

Classes

struct  rig::image::GpuTexture
 GLES texture name. Destroy while the GL context is alive. More...
struct  rig::image::FloatRaster
 Linear RGBA float image. More...

Functions

std::string rig::image::resolvePath (const std::string &href, const std::string &basePath={})
 Resolve a local href: as written, then basePath, then <exeDir>/data.
bool rig::image::size (const std::string &path, int &w, int &h)
 Pixel width/height without a full decode.
bool rig::image::loadHdr (const std::string &path, FloatRaster &out, int maxEdge=kDefaultHdrMaxEdge)
 Decode a Radiance HDR (or any stb float image) into out.
bool rig::image::savePng (const std::string &path, const pixel::Raster &raster)
 Write raster as PNG.

Variables

constexpr int rig::image::kDefaultMaxEdge = 2048
 Long-edge cap before upload. 0 = no cap.
constexpr int rig::image::kDefaultHdrMaxEdge = 256
 Long-edge cap for a float HDR decode. Spherical harmonics do not need the source size.

Detailed Description

Load image files into a CPU raster and upload them as GLES textures.

Texture names live in GpuTexture, not in a component, and must be destroyed while the GL context is alive. The long edge is capped before upload so Pi memory stays sane.

Function Documentation

◆ resolvePath()

std::string rig::image::resolvePath ( const std::string & href,
const std::string & basePath = {} )

Resolve a local href: as written, then basePath, then <exeDir>/data.

Empty when the href is a URL or no file exists.

◆ savePng()

bool rig::image::savePng ( const std::string & path,
const pixel::Raster & raster )

Write raster as PNG.

Parent folder must exist.

◆ size()

bool rig::image::size ( const std::string & path,
int & w,
int & h )

Pixel width/height without a full decode.

False when the file is not an image.