Loads and saves images.  
 More...
#include <geogram/image/image_serializer.h>
|  | 
| virtual Image * | serialize_read (const std::string &file_name) | 
|  | reads an image from a file. 
 | 
|  | 
| virtual bool | serialize_write (const std::string &file_name, const Image *image) | 
|  | writes an image into a file. 
 | 
|  | 
| virtual Image * | serialize_read (std::istream &stream) | 
|  | reads an image from a stream. 
 | 
|  | 
| virtual bool | serialize_write (std::ostream &stream, const Image *image) | 
|  | writes an image into a stream. 
 | 
|  | 
| virtual bool | binary () const | 
|  | Tests whether the file format is binary or ASCII. 
 | 
|  | 
| virtual bool | streams_supported () const | 
|  | Tests whether the functions that use streams are supported. 
 | 
|  | 
| virtual bool | read_supported () const | 
|  | Tests whether reading is implemented. 
 | 
|  | 
| virtual bool | write_supported () const | 
|  | Tests whether writing is implemented. 
 | 
|  | 
| void | ref () const | 
|  | Increments the reference count. 
 | 
|  | 
| void | unref () const | 
|  | Decrements the reference count. 
 | 
|  | 
| bool | is_shared () const | 
|  | Check if the object is shared. 
 | 
|  | 
| int | nb_refs () const | 
|  | Gets the number of references that point to this object. 
 | 
|  | 
|  | 
| static void | ref (const Counted *counted) | 
|  | Increments the reference count. 
 | 
|  | 
| static void | unref (const Counted *counted) | 
|  | Decrements the reference count. 
 | 
|  | 
|  | Counted () | 
|  | Creates a reference counted object. 
 | 
|  | 
| virtual | ~Counted () | 
|  | Destroys a reference counted object. 
 | 
|  | 
Loads and saves images. 
Definition at line 65 of file image_serializer.h.
◆ 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
- 
  
    | true | if the file format is binary |  | false | if the file format is ASCII |  
 
Reimplemented in GEO::ImageSerializer_pgm, GEO::ImageSerializerSTB, and GEO::ImageSerializer_xpm.
 
 
◆ read_supported()
  
  | 
        
          | virtual bool GEO::ImageSerializer::read_supported | ( |  | ) | const |  | virtual | 
 
 
◆ 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_name | the 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::ImageSerializer_pgm, and GEO::ImageSerializerSTB.
 
 
◆ serialize_read() [2/2]
  
  | 
        
          | virtual Image * GEO::ImageSerializer::serialize_read | ( | std::istream & | stream | ) |  |  | virtual | 
 
reads an image from a stream. 
- Parameters
- 
  
    | [in,out] | stream | the 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_name | the name of the file |  | [in] | image | a pointer to the image to be saved |  
 
- Return values
- 
  
    | true | if the image could be saved |  | false | otherwise |  
 
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] | stream | the stream where the image should be written |  | [in] | image | a pointer to the image to be saved |  
 
- Return values
- 
  
    | true | if the image could be saved |  | false | otherwise |  
 
 
 
◆ 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
- 
  
    | true | if the functions that use streams are supported |  | false | otherwise |  
 
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
- 
  
    | true | if writing is supported |  | false | otherwise |  
 
Reimplemented in GEO::ImageSerializerSTB.
 
 
The documentation for this class was generated from the following file: