Graphite  Version 3
An experimental 3D geometry processing program
GEO::ImageSerializer Class Reference

Loads and saves images. More...

#include <geogram/image/image_serializer.h>

Inheritance diagram for GEO::ImageSerializer:
GEO::Counted GEO::ImageSerializerSTB GEO::ImageSerializer_pgm GEO::ImageSerializer_xpm GEO::ImageSerializerSTBRead GEO::ImageSerializerSTBReadWrite

Public Member Functions

virtual Imageserialize_read (const std::string &file_name)
 reads an image from a file. More...
 
virtual bool serialize_write (const std::string &file_name, const Image *image)
 writes an image into a file. More...
 
virtual Imageserialize_read (std::istream &stream)
 reads an image from a stream. More...
 
virtual bool serialize_write (std::ostream &stream, const Image *image)
 writes an image into a stream. More...
 
virtual bool binary () const
 Tests whether the file format is binary or ASCII. More...
 
virtual bool streams_supported () const
 Tests whether the functions that use streams are supported. More...
 
virtual bool read_supported () const
 Tests whether reading is implemented. More...
 
virtual bool write_supported () const
 Tests whether writing is implemented. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Detailed Description

Loads and saves images.

Definition at line 65 of file image_serializer.h.

Member Function Documentation

◆ binary()

virtual bool GEO::ImageSerializer::binary ( ) const
virtual

Tests whether the file format is binary or ASCII.

It is used to determine whether a stream should be opened in ASCII or binary mode for loading image files. Default implementation in base class returns true.

Return values
trueif the file format is binary
falseif the file format is ASCII

Reimplemented in GEO::ImageSerializer_xpm, GEO::ImageSerializerSTB, and GEO::ImageSerializer_pgm.

◆ read_supported()

virtual bool GEO::ImageSerializer::read_supported ( ) const
virtual

Tests whether reading is implemented.

Some serializers implement only reading or only writing. Default implementation returns false

Return values
trueif reading is supported
falseotherwise

Reimplemented in GEO::ImageSerializer_xpm, GEO::ImageSerializerSTB, and GEO::ImageSerializer_pgm.

◆ serialize_read() [1/2]

virtual Image* GEO::ImageSerializer::serialize_read ( const std::string &  file_name)
virtual

reads an image from a file.

Parameters
[in]file_namethe name of the file
Returns
a pointer to the loaded image or nil if the image could not be loaded
Note
the loaded image can be stored in an Image_var

Reimplemented in GEO::ImageSerializerSTB, and GEO::ImageSerializer_pgm.

◆ serialize_read() [2/2]

virtual Image* GEO::ImageSerializer::serialize_read ( std::istream &  stream)
virtual

reads an image from a stream.

Parameters
[in,out]streamthe stream where the image should be read from
Returns
a pointer to the loaded image or nil if the image could not be loaded
Note
the loaded image can be stored in an Image_var

Reimplemented in GEO::ImageSerializer_xpm.

◆ serialize_write() [1/2]

virtual bool GEO::ImageSerializer::serialize_write ( const std::string &  file_name,
const Image image 
)
virtual

writes an image into a file.

Parameters
[in]file_namethe name of the file
[in]imagea pointer to the image to be saved
Return values
trueif the image could be saved
falseotherwise

Reimplemented in GEO::ImageSerializerSTB.

◆ serialize_write() [2/2]

virtual bool GEO::ImageSerializer::serialize_write ( std::ostream &  stream,
const Image image 
)
virtual

writes an image into a stream.

Parameters
[in,out]streamthe stream where the image should be written
[in]imagea pointer to the image to be saved
Return values
trueif the image could be saved
falseotherwise

◆ streams_supported()

virtual bool GEO::ImageSerializer::streams_supported ( ) const
virtual

Tests whether the functions that use streams are supported.

Default implementation in base class returns true.

Return values
trueif the functions that use streams are supported
falseotherwise

Reimplemented in GEO::ImageSerializerSTB.

◆ write_supported()

virtual bool GEO::ImageSerializer::write_supported ( ) const
virtual

Tests whether writing is implemented.

Some serializers implement only reading or only writing. Default implementation returns false

Return values
trueif writing is supported
falseotherwise

Reimplemented in GEO::ImageSerializerSTB.


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