gKit2 light

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

image_io.h
Go to the documentation of this file.
1
2 #ifndef _IMAGE_IO_H
3 #define _IMAGE_IO_H
4
5 #include "image.h"
6
7
10
13
16 Image read_image( const char *filename );
17
19 int write_image( const Image& image, const char *filename );
20
21
23 struct ImageData
24 {
25 ImageData( ) : data(), width(0), height(0), channels(0), size(0) {}
26 ImageData( const int w, const int h, const int c, const int s= 1 ) : data(w*h*c*s), width(w), height(h), channels(c), size(s) {}
27
28 std::size_t offset( const int x, const int y ) { return y * width * channels * size + x * channels * size; }
29 const void *buffer( ) const { return &data.front(); }
30 void *buffer( ) { return &data.front(); }
31
32 std::vector<unsigned char> data;
33
34 int width;
35 int height;
36 int channels;
37 int size;
38 };
39
41 ImageData read_image_data( const char *filename );
42
44 int write_image_data( ImageData& image, const char *filename );
45
47
48 #endif
read_image_data
ImageData read_image_data(const char *filename)
charge les donnees d'un fichier png. renvoie une image initialisee par defaut en cas d'echec...
Definition: image_io.cpp:144
ImageData
stockage temporaire des donnees d'une image.
Definition: image_io.h:23
write_image_data
int write_image_data(ImageData &image, const char *filename)
enregistre des donnees dans un fichier png.
Definition: image_io.cpp:222
image.h
read_image
Image read_image(const char *filename)
Definition: image_io.cpp:16
write_image
int write_image(const Image &image, const char *filename)
enregistre une image dans un fichier png.
Definition: image_io.cpp:88
Image
representation d'une image.
Definition: image.h:18