Main Page | Data Structures | File List | Data Fields | Globals

mr_pnm_io.h

Go to the documentation of this file.
00001 /* The Partitions Musics Recognition System project.
00002  * (c)2003 by Fabien Pelisson (fabien dot pelisson at wanadoo dot fr)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef MR_PNM_IO_H
00020 #define MR_PNM_IO_H
00021 
00042 #ifdef __cplusplus
00043 extern              "C"
00044 {
00045 #endif                          /* __cplusplus */
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  * Errors types 
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                          /* __cplusplus */
00170 
00171 #endif /* MR_PNM_IO_H */

Generated on Sun Apr 9 17:29:40 2006 for MusicReco by  doxygen 1.4.4