xpm.h

Go to the documentation of this file.
00001 #ifndef AFTERSTEP_XPM_H_HEADER_INCLUDED
00002 #define AFTERSTEP_XPM_H_HEADER_INCLUDED
00003 
00004 /* our own Xpm handling code : */
00005 
00006 #include "scanline.h"
00007 
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011 
00012 struct ASColormap;
00013 
00014 typedef enum
00015 {
00016         XPM_Outside = 0,
00017         XPM_InFile,
00018         XPM_InImage,
00019         XPM_InComments,
00020         XPM_InString
00021 }ASXpmParseState;
00022 
00023 #define MAX_XPM_BPP     16
00024 
00025 typedef struct ASXpmFile
00026 {
00027         int      fd ;
00028         char   **data;                             /* preparsed and preloaded data */
00029 
00030 #define AS_XPM_BUFFER_UNDO              8
00031 #define AS_XPM_BUFFER_SIZE              8192
00032 
00033 #ifdef HAVE_LIBXPM
00034         XpmImage xpmImage;
00035 #else
00036         char     *buffer;
00037         size_t   bytes_in;
00038         size_t   curr_byte;
00039 #endif
00040 
00041         int      curr_img;
00042         int      curr_img_line;
00043 
00044         ASXpmParseState parse_state;
00045 
00046         char    *str_buf ;
00047         size_t   str_buf_size ;
00048 
00049         unsigned short width, height, bpp;
00050         size_t     cmap_size;
00051         ASScanline scl ;
00052 
00053         ARGB32          *cmap, **cmap2;
00054         ASHashTable *cmap_name_xref;
00055 
00056         Bool do_alpha, full_alpha ;
00057 }ASXpmFile;
00058 
00059 typedef enum {
00060         XPM_Error = -2,
00061         XPM_EndOfFile = -1,
00062         XPM_EndOfImage = 0,
00063         XPM_Success = 1
00064 }ASXpmStatus;
00065 
00066 typedef struct ASXpmCharmap
00067 {
00068         unsigned int count ;
00069         unsigned int cpp ;
00070         char *char_code ;
00071 }ASXpmCharmap;
00072 
00073 /*************************************************************************
00074  * High level xpm reading interface ;
00075  *************************************************************************/
00076 void            close_xpm_file( ASXpmFile **xpm_file );
00077 ASXpmFile  *open_xpm_file( const char *realfilename );
00078 Bool            parse_xpm_header( ASXpmFile *xpm_file );
00079 ASXpmStatus get_xpm_string( ASXpmFile *xpm_file );
00080 ASImage    *create_xpm_image( ASXpmFile *xpm_file, int compression );
00081 Bool            build_xpm_colormap( ASXpmFile *xpm_file );
00082 Bool            convert_xpm_scanline( ASXpmFile *xpm_file, unsigned int line );
00083 
00084 ASXpmCharmap *build_xpm_charmap( struct ASColormap *cmap, Bool has_alpha,
00085                                      ASXpmCharmap *reusable_memory );
00086 void destroy_xpm_charmap( ASXpmCharmap *xpm_cmap, Bool reusable );
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #endif /* AFTERSTEP_XPM_H_HEADER_INCLUDED */

Generated on Tue Jul 5 14:13:33 2011 for ROOT_528-00b_version by  doxygen 1.5.1