00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _UMD_H_
00029 #define _UMD_H_
00030
00031 #include <stdio.h>
00032
00053 #define UMD_LOG(f) ((void (*) (void *, const char *, ...)) f)
00054
00056 typedef void (*umd_log) (void *, const char *, ...);
00057
00059 typedef enum
00060 {
00062 UMD_TEXT,
00063
00065 UMD_IMAGE
00066 } umd_type_t;
00067
00069 typedef struct umd_s umd_t;
00070
00072 typedef struct umd_page_s umd_page_t;
00073
00075 typedef struct
00076 {
00078 int type;
00080 char *image_data;
00082 size_t image_size;
00083 } umd_cover_t;
00084
00086 typedef struct
00087 {
00089 char *title;
00091 char *content;
00093 size_t length;
00095 size_t page_index;
00096 } umd_chapter_t;
00097
00098 #ifdef __cplusplus
00099 extern "C"
00100 {
00101 #endif
00102
00107 umd_t *umd_new ();
00108
00114 void umd_free (umd_t * umd);
00115
00121 void umd_destroy (umd_t * umd);
00122
00128 umd_t *umd_new_from_file (const char *file);
00129
00135 int umd_parser_file (umd_t * umd, const char *file);
00136
00145 void umd_set_log (umd_t * umd, int loglevel, umd_log log, void *arg);
00146
00155 void umd_set_font_face (umd_t * umd, const char *face, int italic,
00156 int bold);
00157
00163 char *umd_get_title (umd_t * umd);
00164
00170 char *umd_get_author (umd_t * umd);
00171
00177 char *umd_get_year (umd_t * umd);
00178
00184 char *umd_get_month (umd_t * umd);
00185
00191 char *umd_get_day (umd_t * umd);
00192
00198 char *umd_get_type (umd_t * umd);
00199
00205 char *umd_get_publisher (umd_t * umd);
00206
00212 char *umd_get_vendor (umd_t * umd);
00213
00220 char *umd_get_content (umd_t * umd, size_t * lenp);
00221
00228 int umd_get_chapter_n (umd_t * umd);
00229
00236 umd_chapter_t *umd_get_nth_chapter (umd_t * umd, size_t id);
00237
00243 umd_cover_t *umd_get_cover (umd_t * umd);
00244
00251 int *umd_write_file (umd_t * umd, const char *file);
00252
00259 int *umd_write_fp (umd_t * umd, FILE * fp);
00260
00267 void umd_fprintf (umd_t * umd, FILE * fp);
00268
00274 int umd_get_page_n (umd_t * umd);
00275
00282 umd_page_t *umd_get_nth_page (umd_t * umd, size_t id);
00283
00291 int umd_page_get_content (umd_page_t * page, char *buf, size_t size);
00292
00297 void umd_page_free (umd_page_t * page);
00298
00306 int umd_page_get_size (umd_page_t * page, int *px, int *py);
00307
00321 int umd_page_render (umd_page_t * page, int fromx, int fromy, int tox,
00322 int toy, double zm, int rot, unsigned char *buffer,
00323 size_t size);
00324
00325 #ifdef __cplusplus
00326 }
00327 #endif
00328
00333 #endif