00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MR_PNM_IO_H
00020 #define MR_PNM_IO_H
00021
00042 #ifdef __cplusplus
00043 extern "C"
00044 {
00045 #endif
00046
00048 #define MR_PBM_ASCII 1
00049 #define MR_PGM_ASCII 2
00050 #define MR_PPM_ASCII 3
00051 #define MR_PBM_RAW 4
00052 #define MR_PGM_RAW 5
00053 #define MR_PPM_RAW 6
00054
00055
00056
00057
00058
00060 #define MR_PNM_ELIBC 0
00061
00062 #define MR_PNM_EMAGIC 1
00063
00064 #define MR_PNM_EITEMS 2
00065
00066 #define MR_PNM_EDATA 3
00067
00068 #define MR_PNM_ESIZE 4
00069
00070 #define MR_PNM_EMAXVAL 5
00071
00077 extern int mr_pnm_errno;
00078
00079 typedef struct MrPNMImage MrPNMImage;
00080
00085 struct MrPNMImage
00086 {
00088 short int pnm_type;
00090 short int nc;
00092 short int depth;
00094 unsigned int byte_width;
00096 unsigned short int maxval;
00098 unsigned int width;
00100 unsigned int height;
00102 unsigned char* data;
00103 };
00104
00109 MrPNMImage* mr_pnm_new();
00110
00116 void mr_pnm_free(MrPNMImage* img);
00117
00125 MrPNMImage* mr_pnm_new_from_file(const char* filename);
00126
00133 int mr_pnm_write_to_file(MrPNMImage* image, const char* filename);
00134
00147 void mr_pnm_draw_rectangle(MrPNMImage* image,
00148 unsigned int x, unsigned int y,
00149 unsigned int w, unsigned int h,
00150 unsigned char r, unsigned char g, unsigned char b,
00151 short int fill);
00152
00163 void mr_pnm_draw_horizontal_line(MrPNMImage* image,
00164 unsigned int x, unsigned int y, unsigned int len,
00165 unsigned char r, unsigned char g, unsigned char b);
00166
00167 #ifdef __cplusplus
00168 }
00169 #endif
00170
00171 #endif