img.h

Go to the documentation of this file.
00001 
00002   /* image object v. 1.0 */
00003 
00004 #ifndef IMG_H
00005 #define IMG_H
00006 
00007 #ifdef __cplusplus
00008 
00009 extern "C" {
00010 
00011 #endif
00012 
00013 #define IMG_ARGUMENT    0x0001
00014 #define IMG_ALLOC       0x0002
00015 #define IMG_OPEN        0x0004
00016 #define IMG_READ        0x0008
00017 #define IMG_FORMAT      0x0010
00018 #define IMG_FIELD       0x0020
00019 
00020   /* Tag */
00021 
00022 typedef struct
00023 {
00024   char                 *tag;
00025   char                 *data;
00026 }
00027 img_tag;
00028 
00029 
00030   /* Image */
00031 
00032 typedef struct
00033 {
00034   int                   tags;
00035   img_tag              *tag;
00036 
00037   int                   size [2];
00038   int                  *image;
00039 }
00040 img_object;
00041 
00042 typedef img_object *img_handle;
00043 
00044   /* Functions */
00045 
00046 #define img_pixel(img,x,y) (((img)->image) [((img)->size) [1] * (int) (x) + (int) (y)])
00047 #define img_columns(img)    ((img)->size [0])
00048 #define img_rows(img)       ((img)->size [1])
00049 
00050 img_handle  img_make_handle    ();
00051 int         img_read           (img_handle img, const char *name);
00052 int         img_free_handle    (img_handle img);
00053 int         img_delete_field   (img_handle img, const char *tag);
00054 const char *img_get_field      (img_handle img, const char *tag);
00055 int         img_set_field      (img_handle img, const char *tag, const char *data);
00056 double      img_get_number     (img_handle img, const char *tag);
00057 int         img_set_number     (img_handle img, const char *tag, const char *format,
00058                                                                   double data);
00059 int         img_get_pixel      (img_handle img, int x, int y);
00060 int         img_set_pixel      (img_handle img, int x, int y, int data);
00061 int         img_set_dimensions (img_handle img, int columns, int rows);
00062 int         img_get_dimension  (img_handle img, int dimension);
00063 
00064 
00065 #ifdef __cplusplus
00066 
00067 }
00068 
00069 #endif
00070 
00071 #endif /* IMG_H */
00072