libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
ImageFile Class Reference

Image file loader and saver. More...

#include <imagefile.h>

Public Types

enum  ID { Invalid = 0 , PNG }
 Identifiers for supported image file formats. More...
 

Public Member Functions

 ImageFile (int id=0)
 Constructs an ImageFile for the given format.
 
const Stringfilename () const
 Returns the filename associated with this image file.
 
void setFilename (const String &val)
 Sets the filename for loading or saving.
 
const Imageimage () const
 Returns the image data.
 
void setImage (const Image &val)
 Sets the image data for saving.
 
Error load ()
 Loads an image from the file specified by filename().
 
Error save ()
 Saves the image to the file specified by filename().
 

Detailed Description

Image file loader and saver.

Provides a simple interface for loading and saving image files. The file format is determined by the ID passed at construction, which selects the corresponding ImageFileIO backend.

Member Enumeration Documentation

◆ ID

Identifiers for supported image file formats.

Enumerator
Invalid 

No format / invalid.

PNG 

PNG image format.

Constructor & Destructor Documentation

◆ ImageFile()

ImageFile::ImageFile ( int  id = 0)

Constructs an ImageFile for the given format.

Parameters
idThe format identifier (e.g. ImageFile::PNG). Defaults to Invalid.

Member Function Documentation

◆ filename()

const String & ImageFile::filename ( ) const
inline

Returns the filename associated with this image file.

Returns
A const reference to the filename string.

◆ image()

const Image & ImageFile::image ( ) const
inline

Returns the image data.

Returns
A const reference to the Image object.

◆ load()

Error ImageFile::load ( )

Loads an image from the file specified by filename().

Returns
Error::Ok on success, or an error on failure.

◆ save()

Error ImageFile::save ( )

Saves the image to the file specified by filename().

Returns
Error::Ok on success, or an error on failure.

◆ setFilename()

void ImageFile::setFilename ( const String val)
inline

Sets the filename for loading or saving.

Parameters
valThe filename to set.

◆ setImage()

void ImageFile::setImage ( const Image val)
inline

Sets the image data for saving.

Parameters
valThe Image to set.

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