aalib.h | aalib.h | |||
---|---|---|---|---|
#ifndef __AALIB_INCLUDED__ | #ifndef __AALIB_INCLUDED__ | |||
#define __AALIB_INCLUDED__ | #define __AALIB_INCLUDED__ | |||
#include <stdio.h> | #include <stdio.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#define AA_LIB_VERSION 1 | #define AA_LIB_VERSION 1 | |||
#define AA_LIB_MINNOR 0 | #define AA_LIB_MINNOR 1 | |||
#define AA_NATTRS 5 | #define AA_NATTRS 5 | |||
#define AA_NPARAMS 5 | #define AA_NPARAMS 5 | |||
#define AA_NONE 0 /*special keycodes */ | #define AA_NONE 0 /*special keycodes */ | |||
#define AA_RESIZE 258 | #define AA_RESIZE 258 | |||
#define AA_MOUSE 259 | #define AA_MOUSE 259 | |||
#define AA_UP 300 | #define AA_UP 300 | |||
#define AA_DOWN 301 | #define AA_DOWN 301 | |||
#define AA_LEFT 302 | #define AA_LEFT 302 | |||
skipping to change at line 50 | skipping to change at line 50 | |||
#define AA_ERRORDISTRIB 1 /*dithering types + AA_NONE */ | #define AA_ERRORDISTRIB 1 /*dithering types + AA_NONE */ | |||
#define AA_FLOYD_S 2 | #define AA_FLOYD_S 2 | |||
#define AA_DITHERTYPES 3 | #define AA_DITHERTYPES 3 | |||
#define AA_BUTTON1 1 /*mouse */ | #define AA_BUTTON1 1 /*mouse */ | |||
#define AA_BUTTON2 2 | #define AA_BUTTON2 2 | |||
#define AA_BUTTON3 4 | #define AA_BUTTON3 4 | |||
#define AA_MOUSEMOVEMASK 1 | #define AA_MOUSEMOVEMASK 1 | |||
#define AA_MOUSEPRESSMASK 2 | #define AA_MOUSEPRESSMASK 2 | |||
#define AA_PRESSEDMOVEMAKS 4 | #define AA_PRESSEDMOVEMASK 4 | |||
#define AA_MOUSEALLMASK 7 | #define AA_MOUSEALLMASK 7 | |||
#define AA_HIDECURSOR 8 | ||||
#define AA_SENDRELEASE 1 | #define AA_SENDRELEASE 1 | |||
#define AA_KBDALLMASK 1 | #define AA_KBDALLMASK 1 | |||
#define AA_USE_PAGES 1 /*save format flags */ | #define AA_USE_PAGES 1 /*save format flags */ | |||
#define AA_HTML_ESCAPED 2 | ||||
#define AA_C_ESCAPED 4 | ||||
#define AA_NORMAL_SPACES 8 | #define AA_NORMAL_SPACES 8 | |||
struct aa_hardware_params { | struct aa_hardware_params { | |||
struct aa_font *font; | struct aa_font *font; | |||
int supported; | int supported; | |||
int minwidth, minheight; | int minwidth, minheight; | |||
int maxwidth, maxheight; | int maxwidth, maxheight; | |||
int recwidth, recheight; | int recwidth, recheight; | |||
int mmwidth, mmheight; | int mmwidth, mmheight; | |||
int width, height; | int width, height; | |||
double dimmul, boldmul; | double dimmul, boldmul; | |||
}; | }; | |||
struct aa_context { | struct aa_context { | |||
struct aa_driver *driver; | struct aa_driver *driver; | |||
struct aa_kbddriver *kbddriver; | struct aa_kbddriver *kbddriver; | |||
struct aa_mousedriver *mousedriver; | struct aa_mousedriver *mousedriver; | |||
struct aa_hardware_params params; | struct aa_hardware_params params,driverparams; | |||
int mulx, muly; | int mulx, muly; | |||
int imgwidth, imgheight; | int imgwidth, imgheight; | |||
unsigned char *imagebuffer; | unsigned char *imagebuffer; | |||
unsigned char *textbuffer; | unsigned char *textbuffer; | |||
unsigned char *attrbuffer; | unsigned char *attrbuffer; | |||
unsigned short *table; | unsigned short *table; | |||
unsigned short *filltable; | unsigned short *filltable; | |||
struct parameters *parameters; | struct parameters *parameters; | |||
int cursorx, cursory, cursorstate; | int cursorx, cursory, cursorstate; | |||
int mousex, mousey, buttons; | int mousex, mousey, buttons,mousemode; | |||
void (*resizehandler) (struct aa_context *); | void (*resizehandler) (struct aa_context *); | |||
void *driverdata; | void *driverdata; | |||
void *kbddriverdata; | ||||
void *mousedriverdata; | ||||
}; | }; | |||
struct aa_driver { | struct aa_driver { | |||
char *shortname, *name; | char *shortname, *name; | |||
struct aa_hardware_params params; | int (*init) (struct aa_hardware_params *, void *, struct aa_hardware_pa | |||
int (*init) (struct aa_hardware_params *, void *); | rams *,void **); | |||
void (*uninit) (struct aa_context *); | void (*uninit) (struct aa_context *); | |||
void (*getsize) (struct aa_context *, int *, int *); | void (*getsize) (struct aa_context *, int *, int *); | |||
void (*setattr) (struct aa_context *, int); | void (*setattr) (struct aa_context *, int); | |||
void (*print) (struct aa_context *, char *); | void (*print) (struct aa_context *, char *); | |||
void (*update) (struct aa_context *, int, int, int, int); | ||||
void (*gotoxy) (struct aa_context *, int, int); | void (*gotoxy) (struct aa_context *, int, int); | |||
void (*flush) (struct aa_context *); | void (*flush) (struct aa_context *); | |||
void (*cursormode) (struct aa_context *, int); | void (*cursormode) (struct aa_context *, int); | |||
}; | }; | |||
struct aa_kbddriver { | struct aa_kbddriver { | |||
char *shortname, *name; | char *shortname, *name; | |||
int flags; | int flags; | |||
int (*init) (struct aa_context *, int mode); | int (*init) (struct aa_context *, int mode); | |||
void (*uninit) (struct aa_context *); | void (*uninit) (struct aa_context *); | |||
int (*getkey) (struct aa_context *, int); | int (*getkey) (struct aa_context *, int); | |||
}; | }; | |||
struct aa_mousedriver { | struct aa_mousedriver { | |||
char *shortname, *name; | char *shortname, *name; | |||
int flags; | int flags; | |||
int (*init) (struct aa_context *, int mode); | int (*init) (struct aa_context *, int mode); | |||
void (*uninit) (struct aa_context *); | void (*uninit) (struct aa_context *); | |||
void (*getmouse) (struct aa_context *, int *, int *, int *); | void (*getmouse) (struct aa_context *, int *, int *, int *); | |||
void (*cursormode) (struct aa_context *,int); | ||||
}; | }; | |||
struct aa_renderparams { | struct aa_renderparams { | |||
int bright, contrast; | int bright, contrast; | |||
float gamma; | float gamma; | |||
int dither; | int dither; | |||
int inversion; | int inversion; | |||
int randomval; | int randomval; | |||
}; | }; | |||
skipping to change at line 158 | skipping to change at line 158 | |||
}; | }; | |||
struct aa_format { | struct aa_format { | |||
int width, height; | int width, height; | |||
int pagewidth, pageheight; | int pagewidth, pageheight; | |||
int flags; | int flags; | |||
int supported; | int supported; | |||
struct aa_font *font; | struct aa_font *font; | |||
char *formatname; | char *formatname; | |||
char *extension; | char *extension; | |||
/*fields after this line may change in future versions*/ | ||||
char *head; | char *head; | |||
char *end; | char *end; | |||
char *newline; | char *newline; | |||
char *prints[AA_NATTRS]; | char *prints[AA_NATTRS]; | |||
char *begin[AA_NATTRS]; | char *begin[AA_NATTRS]; | |||
char *ends[AA_NATTRS]; | char *ends[AA_NATTRS]; | |||
char **conversions; | ||||
}; | }; | |||
struct aa_savedata { | struct aa_savedata { | |||
char *name; | char *name; | |||
struct aa_format *format; | struct aa_format *format; | |||
FILE *file; /*You might specify filename by this way too, in case name is NULL*/ | ||||
}; | }; | |||
struct aa_linkedlist { | struct aa_linkedlist { | |||
char *text; | char *text; | |||
struct aa_linkedlist *next, *previous; | struct aa_linkedlist *next, *previous; | |||
}; | }; | |||
typedef struct aa_context aa_context; | typedef struct aa_context aa_context; | |||
typedef struct aa_linkedlist aa_linkedlist; | typedef struct aa_linkedlist aa_linkedlist; | |||
typedef struct aa_linkedlist aa_reclist; | typedef struct aa_linkedlist aa_reclist; | |||
skipping to change at line 190 | skipping to change at line 193 | |||
//typedef struct aa_hardwareparams aa_hardware_params; | //typedef struct aa_hardwareparams aa_hardware_params; | |||
typedef struct aa_driver aa_driver; | typedef struct aa_driver aa_driver; | |||
typedef struct aa_font aa_font; | typedef struct aa_font aa_font; | |||
typedef struct aa_format aa_format; | typedef struct aa_format aa_format; | |||
typedef struct aa_savedata aa_savedata; | typedef struct aa_savedata aa_savedata; | |||
typedef int aa_palette[256]; | typedef int aa_palette[256]; | |||
extern struct aa_driver save_d, mem_d; | extern struct aa_driver save_d, mem_d; | |||
extern char *aa_help; | extern char *aa_help; | |||
extern struct aa_format aa_htmlk_format, *aa_formats[]; | extern struct aa_format aa_htmlk_format, *aa_formats[]; | |||
extern struct aa_format aa_nhtml_format, aa_html_format, aa_ansi_format, | extern struct aa_format aa_nhtml_format, aa_html_format, aa_html_alt_format | |||
aa_text_format, aa_more_format, aa_hp_format, aa_hp2_format; | , | |||
aa_ansi_format, aa_text_format, aa_more_format, aa_hp_format, | ||||
aa_hp2_format, aa_irc_format, aa_zephyr_format; | ||||
extern struct aa_font *aa_fonts[]; | extern struct aa_font *aa_fonts[]; | |||
extern int nfonts; | extern int nfonts; | |||
extern struct aa_font font8, font14, font16, font9, fontline, fontgl, | extern struct aa_font aa_font8, aa_font14, aa_font16, aa_font9, aa_fontline | |||
fontX13, fontX16, fontX13B, fontcourier; | , aa_fontgl, | |||
aa_fontX13, aa_fontX16, aa_fontX13B, aa_fontcourier; | ||||
extern char *aa_dithernames[]; | extern char *aa_dithernames[]; | |||
extern struct aa_hardware_params aa_defparams; | extern struct aa_hardware_params aa_defparams; | |||
extern struct aa_renderparams aa_defrenderparams; | extern struct aa_renderparams aa_defrenderparams; | |||
extern struct aa_driver *aa_drivers[], curses_d, dos_d, linux_d, slang_d, | extern struct aa_driver *aa_drivers[], curses_d, dos_d, linux_d, slang_d, | |||
stdout_d, stderr_d, X11_d; | stdout_d, stderr_d, X11_d, os2vio_d; | |||
extern struct aa_kbddriver *aa_kbddrivers[], kbd_curses_d, kbd_slang_d, | extern struct aa_kbddriver *aa_kbddrivers[], kbd_curses_d, kbd_slang_d, | |||
kbd_stdin_d, kbd_dos_d, kbd_X11_d; | kbd_stdin_d, kbd_dos_d, kbd_X11_d, kbd_os2_d; | |||
extern struct aa_mousedriver *aa_mousedrivers[], mouse_curses_d, mouse_gpm_ d, | extern struct aa_mousedriver *aa_mousedrivers[], mouse_curses_d, mouse_gpm_ d, | |||
mouse_X11_d; | mouse_X11_d, mouse_dos_d, mouse_os2_d; | |||
extern aa_linkedlist *aa_kbdrecommended, *aa_mouserecommended, *aa_displayr ecommended; | extern aa_linkedlist *aa_kbdrecommended, *aa_mouserecommended, *aa_displayr ecommended; | |||
#define aa_callnonull(c,x) ((x)!=NULL?((x)(c)):0) | #define aa_callnonull(c,x) ((x)!=NULL?((x)(c)):0) | |||
#define aa_scrwidth(a) ((a)->params.width) | #define aa_scrwidth(a) ((a)->params.width) | |||
#define aa_scrheight(a) ((a)->params.height) | #define aa_scrheight(a) ((a)->params.height) | |||
#define aa_mmwidth(a) ((a)->params.mmwidth) | #define aa_mmwidth(a) ((a)->params.mmwidth) | |||
#define aa_mmheight(a) ((a)->params.mmheight) | #define aa_mmheight(a) ((a)->params.mmheight) | |||
#define aa_imgwidth(a) ((a)->imgwidth) | #define aa_imgwidth(a) ((a)->imgwidth) | |||
#define aa_imgheight(a) ((a)->imgheight) | #define aa_imgheight(a) ((a)->imgheight) | |||
#define aa_putpixel(c,x,y,color) ((c)->imagebuffer[(x)+(y)*(aa_imgwidth(c)) ]=(color)) | #define aa_putpixel(c,x,y,color) ((c)->imagebuffer[(x)+(y)*(aa_imgwidth(c)) ]=(color)) | |||
skipping to change at line 253 | skipping to change at line 257 | |||
/*rendering functions */ | /*rendering functions */ | |||
void aa_fastrender(aa_context * c, int x1, int y1, int x2, int y2); | void aa_fastrender(aa_context * c, int x1, int y1, int x2, int y2); | |||
void aa_render(aa_context * c, aa_renderparams * p, int x1, int y1, int x2, int y2); | void aa_render(aa_context * c, aa_renderparams * p, int x1, int y1, int x2, int y2); | |||
void aa_renderpalette(aa_context * c, aa_palette table, aa_renderparams * p , int x1, int y1, int x2, int y2); | void aa_renderpalette(aa_context * c, aa_palette table, aa_renderparams * p , int x1, int y1, int x2, int y2); | |||
aa_renderparams *aa_getrenderparams(void); | aa_renderparams *aa_getrenderparams(void); | |||
void aa_flush(aa_context * c); | void aa_flush(aa_context * c); | |||
/*text i/o functions */ | /*text i/o functions */ | |||
void aa_puts(aa_context * c, int x, int y, int attr, char *s); | void aa_puts(aa_context * c, int x, int y, int attr, char *s); | |||
int aa_printf(aa_context *c, int x, int y, int attr, char *fmt, ...); | ||||
void aa_gotoxy(aa_context * c, int x, int y); | void aa_gotoxy(aa_context * c, int x, int y); | |||
void aa_hidecursor(aa_context * c); | void aa_hidecursor(aa_context * c); | |||
void aa_showcursor(aa_context * c); | void aa_showcursor(aa_context * c); | |||
void aa_getmouse(aa_context * c, int *x, int *y, int *b); | void aa_getmouse(aa_context * c, int *x, int *y, int *b); | |||
void aa_hidemouse(aa_context *c); | ||||
void aa_showmouse(aa_context *c); | ||||
/*hardware parameters control */ | /*hardware parameters control */ | |||
int aa_registerfont(struct aa_font *f); | int aa_registerfont(struct aa_font *f); | |||
void aa_setsupported(aa_context * c, int supported); | void aa_setsupported(aa_context * c, int supported); | |||
void aa_setfont(aa_context * c, struct aa_font *font); | void aa_setfont(aa_context * c, struct aa_font *font); | |||
/*keyboard functions */ | /*keyboard functions */ | |||
int aa_getevent(aa_context * c, int wait); | int aa_getevent(aa_context * c, int wait); | |||
int aa_getkey(aa_context * c, int wait); | int aa_getkey(aa_context * c, int wait); | |||
End of changes. 20 change blocks. | ||||
16 lines changed or deleted | 26 lines changed or added | |||