Raytracer
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Raytracer::Utils::ImageHelper Class Reference

Public Member Functions

 ImageHelper (const char *filename)
 Construct a new ImageHelper object.
 
bool load (const std::string &filename)
 Load the image from the given filename.
 
const unsigned char * pixelData (int x, int y) const
 Get the pixel data at the given coordinates.
 
 GET_SET (int, width)
 
 GET_SET (int, height)
 

Constructor & Destructor Documentation

◆ ImageHelper()

Raytracer::Utils::ImageHelper::ImageHelper ( const char * filename)

Construct a new ImageHelper object.

This function constructs a new ImageHelper object with the given filename. The ImageHelper object is used to load and read PPM images.

Parameters
filenameThe filename of the image.
Returns
A new ImageHelper object.

Member Function Documentation

◆ load()

bool Raytracer::Utils::ImageHelper::load ( const std::string & filename)

Load the image from the given filename.

This function loads the image from the given filename. The image must be in PPM format (P6). The function returns true if the image was successfully loaded, and false otherwise.

Parameters
filenameThe filename of the image.
Returns
True if the image was successfully loaded, and false otherwise.

◆ pixelData()

const unsigned char * Raytracer::Utils::ImageHelper::pixelData ( int x,
int y ) const

Get the pixel data at the given coordinates.

This function returns the pixel data at the given coordinates. The function returns magenta if the coordinates are out of bounds.

Parameters
xThe x-coordinate.
yThe y-coordinate.
Returns
The pixel data at the given coordinates.

The documentation for this class was generated from the following files: