00001 #ifndef IMPORT_H_HEADER_INCLUDED
00002 #define IMPORT_H_HEADER_INCLUDED
00003
00004 #include "asimage.h"
00005 #include "xcf.h"
00006 #include "xpm.h"
00007
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define SCREEN_GAMMA 2.2
00034 #define DEFAULT_PNG_IMAGE_GAMMA 0.45455
00035
00036
00037
00038
00039
00040
00041 typedef enum
00042 {
00043 ASIT_Xpm = 0,
00044 ASIT_ZCompressedXpm,
00045 ASIT_GZCompressedXpm,
00046 ASIT_Png,
00047 ASIT_Jpeg,
00048 ASIT_Xcf,
00049 ASIT_Ppm,
00050 ASIT_Pnm,
00051 ASIT_Bmp,
00052 ASIT_Ico,
00053 ASIT_Cur,
00054 ASIT_Gif,
00055 ASIT_Tiff,
00056 ASIT_XMLScript,
00057 ASIT_SVG,
00058
00059 ASIT_Xbm,
00060 ASIT_Targa,
00061 ASIT_Supported = ASIT_Targa,
00062 ASIT_Pcx,
00063 ASIT_HTML,
00064 ASIT_XML,
00065 ASIT_Unknown
00066 }ASImageFileTypes;
00067
00068
00069
00070
00071
00072
00073
00074
00075 typedef struct ASImageListEntryBuffer
00076 {
00077 #define ASILEB_Dirty (0x01<<0)
00078 #define ASILEB_Binary (0x01<<1)
00079
00080 ASFlagType flags ;
00081
00082 size_t size ;
00083 char *data ;
00084
00085 }ASImageListEntryBuffer;
00086
00087 typedef struct ASImageListEntry
00088 {
00089 #define MAGIC_ASIMAGE_LIST_ENTRY 0xA3A311E4
00090 #define IS_ASIMAGE_LIST_ENTRY(e) (((e)!=NULL)&&((e)->magic==MAGIC_ASIMAGE_LIST_ENTRY)&&((e)->ref_count>0))
00091
00092 unsigned long magic ;
00093 struct ASImageListEntry *prev, *next ;
00094 char *name ;
00095 char *fullfilename ;
00096
00097 ASImageFileTypes type;
00098 ASImage *preview;
00099
00100 #ifndef _WIN32
00101 mode_t d_mode;
00102 #endif
00103 time_t d_mtime;
00104 off_t d_size;
00105
00106 ASImageListEntryBuffer *buffer ;
00107
00108 int ref_count;
00109 }ASImageListEntry;
00110
00111
00112 #define AS_IMPORT_ORIGINAL 0
00113 #define AS_IMPORT_RESIZE_H (0x01<<1)
00114 #define AS_IMPORT_RESIZE_V (0x01<<2)
00115 #define AS_IMPORT_RESIZED (AS_IMPORT_RESIZE_V|AS_IMPORT_RESIZE_H)
00116 #define AS_IMPORT_SCALED_H (0x01<<3)
00117 #define AS_IMPORT_SCALED_V (0x01<<4)
00118 #define AS_IMPORT_SCALED_BOTH (AS_IMPORT_SCALED_H|AS_IMPORT_SCALED_V)
00119 #define AS_IMPORT_FAST (0x01<<5)
00120
00121
00122 typedef struct ASImageImportParams
00123 {
00124 ASFlagType flags ;
00125 int width, height ;
00126 ASFlagType filter ;
00127 double gamma ;
00128 CARD8 *gamma_table ;
00129 int subimage ;
00130 ASAltImFormats format ;
00131 unsigned int compression ;
00132 char **search_path ;
00133
00134 int return_animation_delay ;
00135 int return_animation_repeats ;
00136 }ASImageImportParams;
00137
00138 typedef ASImage* (*as_image_loader_func)( const char * path, ASImageImportParams *params );
00139 extern as_image_loader_func as_image_file_loaders[ASIT_Unknown];
00140
00141 ASImage *xpm2ASImage ( const char * path, ASImageImportParams *params );
00142 ASImage *xpm_data2ASImage( const char **data, ASImageImportParams *params );
00143 ASImage *xpmRawBuff2ASImage( const char *data, ASImageImportParams *params );
00144 ASImage *png2ASImage ( const char * path, ASImageImportParams *params );
00145 ASImage *jpeg2ASImage( const char * path, ASImageImportParams *params );
00146 ASImage *xcf2ASImage ( const char * path, ASImageImportParams *params );
00147 ASImage *ppm2ASImage ( const char * path, ASImageImportParams *params );
00148 ASImage *bmp2ASImage ( const char * path, ASImageImportParams *params );
00149 ASImage *ico2ASImage ( const char * path, ASImageImportParams *params );
00150 ASImage *gif2ASImage ( const char * path, ASImageImportParams *params );
00151 ASImage *tiff2ASImage( const char * path, ASImageImportParams *params );
00152 ASImage *xml2ASImage ( const char * path, ASImageImportParams *params );
00153 ASImage *tga2ASImage ( const char * path, ASImageImportParams *params );
00154 ASImage *svg2ASImage ( const char * path, ASImageImportParams *params );
00155 ASImage *convert_argb2ASImage( ASVisual *asv, int width, int height, ARGB32 *argb, CARD8 *gamma_table );
00156 ASImage *argb2ASImage( const char *path, ASImageImportParams *params );
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 ASImage *file2ASImage( const char *file, ASFlagType what, double gamma, unsigned int compression, ... );
00219 ASImage *file2ASImage_extra( const char *file, ASImageImportParams *params );
00220 ASImage *get_asimage( ASImageManager* imageman, const char *file, ASFlagType what, unsigned int compression );
00221 ASImage *get_asimage_extra( ASImageManager* imageman, const char *file, ASImageImportParams *params );
00222 ASImageFileTypes get_asimage_file_type( ASImageManager* imageman, const char *file );
00223
00224 #define AS_THUMBNAIL_PROPORTIONAL (0x01<<0)
00225 #define AS_THUMBNAIL_DONT_ENLARGE (0x01<<1)
00226 #define AS_THUMBNAIL_DONT_REDUCE (0x01<<2)
00227 ASImage *get_thumbnail_asimage( ASImageManager* imageman, const char *file, int thumb_width, int thumb_height, ASFlagType flags );
00228
00229 ASImageFileTypes check_asimage_file_type( const char *realfilename );
00230
00231
00232 Bool reload_asimage_manager( ASImageManager *imman );
00233
00234 #define NO_PREVIEW 0
00235 #define LOAD_PREVIEW AS_IMPORT_RESIZED
00236 #define SCALE_PREVIEW_H AS_IMPORT_SCALED_H
00237 #define SCALE_PREVIEW_V AS_IMPORT_SCALED_V
00238
00239 ASImageListEntry *get_asimage_list( struct ASVisual *asv, const char *dir,
00240 ASFlagType preview_type, double gamma,
00241 unsigned int preview_width, unsigned int preview_height,
00242 unsigned int preview_compression,
00243 unsigned int *count_ret,
00244 int (*select) (const char *) );
00245
00246 ASImageListEntry *ref_asimage_list_entry( ASImageListEntry *entry );
00247 ASImageListEntry *unref_asimage_list_entry( ASImageListEntry *entry );
00248 ASImageListEntry *create_asimage_list_entry();
00249 void destroy_asimage_list_entry_buffer( ASImageListEntryBuffer **pbuffer );
00250 void destroy_asimage_list( ASImageListEntry **plist );
00251 char *format_asimage_list_entry_details( ASImageListEntry *entry, Bool vertical );
00252 Bool load_asimage_list_entry_data( ASImageListEntry *entry, size_t max_bytes );
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 Pixmap file2pixmap(struct ASVisual *asv, Window root, const char *realfilename, Pixmap *mask_out);
00278
00279
00280 ASImage *PNGBuff2ASimage( CARD8 *buffer, ASImageImportParams *params );
00281
00282 #ifdef __cplusplus
00283 }
00284 #endif
00285
00286 #endif
00287