1 /*         ______   ___    ___
2  *        /\  _  \ /\_ \  /\_ \
3  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
4  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
5  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
6  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8  *                                           /\____/
9  *                                           \_/__/
10  *
11  *      Some definitions for internal use by the library code.
12  *
13  *      By Shawn Hargreaves.
14  *
15  *      See readme.txt for copyright information.
16  */
17 
18 
19 #ifndef AINTERN_H
20 #define AINTERN_H
21 
22 #ifndef ALLEGRO_H
23    #error must include allegro.h first
24 #endif
25 
26 #ifdef __cplusplus
27    extern "C" {
28 #endif
29 
30 
31 /* length in bytes of the cpu_vendor string */
32 #define _AL_CPU_VENDOR_SIZE 32
33 
34 
35 /* flag for how many times we have been initialised */
36 AL_VAR(int, _allegro_count);
37 
38 
39 /* flag to know whether we are being called by the exit mechanism */
40 AL_VAR(int, _allegro_in_exit);
41 
42 
43 /* flag to decide whether to disable the screensaver */
44 enum {
45   NEVER_DISABLED,
46   FULLSCREEN_DISABLED,
47   ALWAYS_DISABLED
48 };
49 
50 AL_VAR(int, _screensaver_policy);
51 
52 
53 AL_FUNCPTR(int, _al_trace_handler, (AL_CONST char *msg));
54 
55 
56 /* malloc wrappers */
57 /* The 4.3 branch uses the following macro names to allow the user to customise
58  * the memory management routines.  We don't have that feature in 4.2, but we
59  * use the same macros names in order to reduce divergence of the codebases.
60  */
61 #define _AL_MALLOC(SIZE)         (_al_malloc(SIZE))
62 #define _AL_MALLOC_ATOMIC(SIZE)  (_al_malloc(SIZE))
63 #define _AL_FREE(PTR)            (_al_free(PTR))
64 #define _AL_REALLOC(PTR, SIZE)   (_al_realloc(PTR, SIZE))
65 
66 AL_FUNC(void *, _al_malloc, (size_t size));
67 AL_FUNC(void, _al_free, (void *mem));
68 AL_FUNC(void *, _al_realloc, (void *mem, size_t size));
69 AL_FUNC(char *, _al_strdup, (AL_CONST char *string));
70 AL_FUNC(char *, _al_ustrdup, (AL_CONST char *string));
71 
72 
73 
74 /* some Allegro functions need a block of scratch memory */
75 AL_VAR(void *, _scratch_mem);
76 AL_VAR(int, _scratch_mem_size);
77 
78 
79 AL_INLINE(void, _grow_scratch_mem, (int size),
80 {
81    if (size > _scratch_mem_size) {
82       size = (size+1023) & 0xFFFFFC00;
83       _scratch_mem = _AL_REALLOC(_scratch_mem, size);
84       _scratch_mem_size = size;
85    }
86 })
87 
88 
89 /* list of functions to call at program cleanup */
90 AL_FUNC(void, _add_exit_func, (AL_METHOD(void, func, (void)), AL_CONST char *desc));
91 AL_FUNC(void, _remove_exit_func, (AL_METHOD(void, func, (void))));
92 
93 
94 /* helper structure for talking to Unicode strings */
95 typedef struct UTYPE_INFO
96 {
97    int id;
98    AL_METHOD(int, u_getc, (AL_CONST char *s));
99    AL_METHOD(int, u_getx, (char **s));
100    AL_METHOD(int, u_setc, (char *s, int c));
101    AL_METHOD(int, u_width, (AL_CONST char *s));
102    AL_METHOD(int, u_cwidth, (int c));
103    AL_METHOD(int, u_isok, (int c));
104    int u_width_max;
105 } UTYPE_INFO;
106 
107 AL_FUNC(UTYPE_INFO *, _find_utype, (int type));
108 
109 
110 /* message stuff */
111 #define ALLEGRO_MESSAGE_SIZE  4096
112 
113 
114 /* wrappers for implementing disk I/O on different platforms */
115 AL_FUNC(int, _al_file_isok, (AL_CONST char *filename));
116 AL_FUNC(uint64_t, _al_file_size_ex, (AL_CONST char *filename));
117 AL_FUNC(time_t, _al_file_time, (AL_CONST char *filename));
118 AL_FUNC(int, _al_drive_exists, (int drive));
119 AL_FUNC(int, _al_getdrive, (void));
120 AL_FUNC(void, _al_getdcwd, (int drive, char *buf, int size));
121 
122 AL_FUNC(void, _al_detect_filename_encoding, (void));
123 
124 /* obsolete; only exists for binary compatibility with 4.2.0 */
125 AL_FUNC(long, _al_file_size, (AL_CONST char *filename));
126 
127 
128 /* packfile stuff */
129 AL_VAR(int, _packfile_filesize);
130 AL_VAR(int, _packfile_datasize);
131 AL_VAR(int, _packfile_type);
132 AL_FUNC(PACKFILE *, _pack_fdopen, (int fd, AL_CONST char *mode));
133 
134 AL_FUNC(int, _al_lzss_incomplete_state, (AL_CONST LZSS_UNPACK_DATA *dat));
135 
136 
137 /* config stuff */
138 void _reload_config(void);
139 
140 
141 /* various bits of mouse stuff */
142 AL_FUNC(void, _handle_mouse_input, (void));
143 
144 AL_VAR(int, _mouse_x);
145 AL_VAR(int, _mouse_y);
146 AL_VAR(int, _mouse_z);
147 AL_VAR(int, _mouse_w);
148 AL_VAR(int, _mouse_b);
149 AL_VAR(int, _mouse_on);
150 
151 AL_VAR(int, _mouse_installed);
152 
153 AL_VAR(int, _mouse_type);
154 AL_VAR(BITMAP *, _mouse_screen);
155 AL_VAR(BITMAP *, _mouse_pointer);
156 
157 
158 /* various bits of timer stuff */
159 AL_FUNC(long, _handle_timer_tick, (int interval));
160 
161 #define MAX_TIMERS      16
162 
163 /* list of active timer handlers */
164 typedef struct TIMER_QUEUE
165 {
166    AL_METHOD(void, proc, (void));      /* timer handler functions */
167    AL_METHOD(void, param_proc, (void *param));
168    void *param;                        /* param for param_proc if used */
169    long speed;                         /* timer speed */
170    long counter;                       /* counts down to zero=blastoff */
171 } TIMER_QUEUE;
172 
173 AL_ARRAY(TIMER_QUEUE, _timer_queue);
174 
175 AL_VAR(int, _timer_installed);
176 
177 AL_VAR(int, _timer_use_retrace);
178 AL_VAR(volatile int, _retrace_hpp_value);
179 
180 AL_VAR(long, _vsync_speed);
181 
182 
183 /* various bits of keyboard stuff */
184 AL_FUNC(void, _handle_key_press, (int keycode, int scancode));
185 AL_FUNC(void, _handle_key_release, (int scancode));
186 
187 AL_VAR(int, _keyboard_installed);
188 AL_ARRAY(AL_CONST char *, _keyboard_common_names);
189 AL_ARRAY(volatile char, _key);
190 AL_VAR(volatile int, _key_shifts);
191 
192 
193 #if (defined ALLEGRO_DOS) || (defined ALLEGRO_DJGPP) || (defined ALLEGRO_WATCOM) || \
194     (defined ALLEGRO_QNX) || (defined ALLEGRO_BEOS)  || (defined ALLEGRO_HAIKU)
195 
196 AL_ARRAY(char *, _pckeys_names);
197 
198 AL_FUNC(void, _pckeys_init, (void));
199 AL_FUNC(void, _handle_pckey, (int code));
200 AL_FUNC(int,  _pckey_scancode_to_ascii, (int scancode));
201 AL_FUNC(AL_CONST char *, _pckey_scancode_to_name, (int scancode));
202 
203 AL_VAR(unsigned short *, _key_ascii_table);
204 AL_VAR(unsigned short *, _key_capslock_table);
205 AL_VAR(unsigned short *, _key_shift_table);
206 AL_VAR(unsigned short *, _key_control_table);
207 AL_VAR(unsigned short *, _key_altgr_lower_table);
208 AL_VAR(unsigned short *, _key_altgr_upper_table);
209 AL_VAR(unsigned short *, _key_accent1_lower_table);
210 AL_VAR(unsigned short *, _key_accent1_upper_table);
211 AL_VAR(unsigned short *, _key_accent2_lower_table);
212 AL_VAR(unsigned short *, _key_accent2_upper_table);
213 AL_VAR(unsigned short *, _key_accent3_lower_table);
214 AL_VAR(unsigned short *, _key_accent3_upper_table);
215 AL_VAR(unsigned short *, _key_accent4_lower_table);
216 AL_VAR(unsigned short *, _key_accent4_upper_table);
217 
218 AL_VAR(int, _key_accent1);
219 AL_VAR(int, _key_accent2);
220 AL_VAR(int, _key_accent3);
221 AL_VAR(int, _key_accent4);
222 AL_VAR(int, _key_accent1_flag);
223 AL_VAR(int, _key_accent2_flag);
224 AL_VAR(int, _key_accent3_flag);
225 AL_VAR(int, _key_accent4_flag);
226 
227 AL_VAR(int, _key_standard_kb);
228 
229 AL_VAR(char *, _keyboard_layout);
230 
231 #endif
232 
233 #if (defined ALLEGRO_WINDOWS)
234 
235    AL_FUNC(int, _al_win_open, (const char *filename, int mode, int perm));
236    AL_FUNC(int, _al_win_unlink, (const char *filename));
237 
238 
239    #define _al_open(filename, mode, perm)   _al_win_open(filename, mode, perm)
240    #define _al_unlink(filename)             _al_win_unlink(filename)
241 
242 #else
243 
244    #define _al_open(filename, mode, perm)   open(filename, mode, perm)
245    #define _al_unlink(filename)             unlink(filename)
246 
247 #endif
248 
249 
250 /* various bits of joystick stuff */
251 AL_VAR(int, _joy_type);
252 
253 AL_VAR(int, _joystick_installed);
254 
255 
256 /* some GUI innards that other people need to use */
257 AL_FUNC(int, _gui_shadow_box_proc, (int msg, DIALOG *d, int c));
258 AL_FUNC(int, _gui_ctext_proc, (int msg, DIALOG *d, int c));
259 AL_FUNC(int, _gui_button_proc, (int msg, DIALOG *d, int c));
260 AL_FUNC(int, _gui_edit_proc, (int msg, DIALOG *d, int c));
261 AL_FUNC(int, _gui_list_proc, (int msg, DIALOG *d, int c));
262 AL_FUNC(int, _gui_text_list_proc, (int msg, DIALOG *d, int c));
263 
264 AL_FUNC(void, _handle_scrollable_scroll_click, (DIALOG *d, int listsize, int *offset, int height));
265 AL_FUNC(void, _handle_scrollable_scroll, (DIALOG *d, int listsize, int *idx, int *offset));
266 AL_FUNC(void, _handle_listbox_click, (DIALOG *d));
267 AL_FUNC(void, _draw_scrollable_frame, (DIALOG *d, int listsize, int offset, int height, int fg_color, int bg));
268 AL_FUNC(void, _draw_listbox, (DIALOG *d));
269 AL_FUNC(void, _draw_textbox, (char *thetext, int *listsize, int draw, int offset, int wword, int tabsize, int x, int y, int w, int h, int disabled, int fore, int deselect, int disable));
270 
271 
272 /* text- and font-related stuff */
273 typedef struct FONT_VTABLE
274 {
275    AL_METHOD(int, font_height, (AL_CONST FONT *f));
276    AL_METHOD(int, char_length, (AL_CONST FONT *f, int ch));
277    AL_METHOD(int, text_length, (AL_CONST FONT *f, AL_CONST char *text));
278    AL_METHOD(int, render_char, (AL_CONST FONT *f, int ch, int fg, int bg, BITMAP *bmp, int x, int y));
279    AL_METHOD(void, render, (AL_CONST FONT *f, AL_CONST char *text, int fg, int bg, BITMAP *bmp, int x, int y));
280    AL_METHOD(void, destroy, (FONT *f));
281 
282    AL_METHOD(int, get_font_ranges, (FONT *f));
283    AL_METHOD(int, get_font_range_begin, (FONT *f, int range));
284    AL_METHOD(int, get_font_range_end, (FONT *f, int range));
285    AL_METHOD(FONT *, extract_font_range, (FONT *f, int begin, int end));
286    AL_METHOD(FONT *, merge_fonts, (FONT *f1, FONT *f2));
287    AL_METHOD(int, transpose_font, (FONT *f, int drange));
288 } FONT_VTABLE;
289 
290 AL_VAR(FONT_VTABLE, _font_vtable_mono);
291 AL_VAR(FONT_VTABLE *, font_vtable_mono);
292 AL_VAR(FONT_VTABLE, _font_vtable_color);
293 AL_VAR(FONT_VTABLE *, font_vtable_color);
294 AL_VAR(FONT_VTABLE, _font_vtable_trans);
295 AL_VAR(FONT_VTABLE *, font_vtable_trans);
296 
297 AL_FUNC(FONT_GLYPH *, _mono_find_glyph, (AL_CONST FONT *f, int ch));
298 AL_FUNC(BITMAP *, _color_find_glyph, (AL_CONST FONT *f, int ch));
299 
300 typedef struct FONT_MONO_DATA
301 {
302    int begin, end;                  /* first char and one-past-the-end char */
303    FONT_GLYPH **glyphs;             /* our glyphs */
304    struct FONT_MONO_DATA *next;     /* linked list structure */
305 } FONT_MONO_DATA;
306 
307 typedef struct FONT_COLOR_DATA
308 {
309    int begin, end;                  /* first char and one-past-the-end char */
310    BITMAP **bitmaps;                /* our glyphs */
311    struct FONT_COLOR_DATA *next;    /* linked list structure */
312 } FONT_COLOR_DATA;
313 
314 
315 /* caches and tables for svga bank switching */
316 AL_VAR(int, _last_bank_1);
317 AL_VAR(int, _last_bank_2);
318 
319 AL_VAR(int *, _gfx_bank);
320 
321 /* bank switching routines (these use a non-C calling convention on i386!) */
322 AL_FUNC(uintptr_t, _stub_bank_switch, (BITMAP *bmp, int lyne));
323 AL_FUNC(void, _stub_unbank_switch, (BITMAP *bmp));
324 AL_FUNC(void, _stub_bank_switch_end, (void));
325 
326 #ifdef ALLEGRO_GFX_HAS_VGA
327 
328 AL_FUNC(uintptr_t, _x_bank_switch, (BITMAP *bmp, int lyne));
329 AL_FUNC(void, _x_unbank_switch, (BITMAP *bmp));
330 AL_FUNC(void, _x_bank_switch_end, (void));
331 
332 #endif
333 
334 #ifdef ALLEGRO_GFX_HAS_VBEAF
335 
336 AL_FUNC(void, _accel_bank_stub, (void));
337 AL_FUNC(void, _accel_bank_stub_end, (void));
338 AL_FUNC(void, _accel_bank_switch, (void));
339 AL_FUNC(void, _accel_bank_switch_end, (void));
340 
341 AL_VAR(void *, _accel_driver);
342 
343 AL_VAR(int, _accel_active);
344 
345 AL_VAR(void *, _accel_set_bank);
346 AL_VAR(void *, _accel_idle);
347 
348 AL_FUNC(void, _fill_vbeaf_libc_exports, (void *ptr));
349 AL_FUNC(void, _fill_vbeaf_pmode_exports, (void *ptr));
350 
351 #endif
352 
353 
354 /* stuff for setting up bitmaps */
355 AL_FUNC(BITMAP *, _make_bitmap, (int w, int h, uintptr_t addr, GFX_DRIVER *driver, int color_depth, int bpl));
356 AL_FUNC(void, _sort_out_virtual_width, (int *width, GFX_DRIVER *driver));
357 
358 AL_FUNC(GFX_VTABLE *, _get_vtable, (int color_depth));
359 
360 AL_VAR(GFX_VTABLE, _screen_vtable);
361 
362 AL_VAR(int, _gfx_mode_set_count);
363 
364 AL_VAR(int, _refresh_rate_request);
365 AL_FUNC(void, _set_current_refresh_rate, (int rate));
366 
367 AL_VAR(int, _wait_for_vsync);
368 
369 AL_VAR(int, _sub_bitmap_id_count);
370 
371 AL_VAR(int, _screen_split_position);
372 
373 AL_VAR(int, _safe_gfx_mode_change);
374 
375 #ifdef ALLEGRO_I386
376    #define BYTES_PER_PIXEL(bpp)     (((int)(bpp) + 7) / 8)
377 #else
378    #ifdef ALLEGRO_MPW
379       /* in Mac 24 bit is a unsigned long */
380       #define BYTES_PER_PIXEL(bpp)  (((bpp) <= 8) ? 1					\
381 				     : (((bpp) <= 16) ? 2		\
382 					: 4))
383    #else
384       #define BYTES_PER_PIXEL(bpp)  (((bpp) <= 8) ? 1					\
385 				     : (((bpp) <= 16) ? 2		\
386 					: (((bpp) <= 24) ? 3 : 4)))
387    #endif
388 #endif
389 
390 AL_FUNC(int, _color_load_depth, (int depth, int hasalpha));
391 
392 AL_VAR(int, _color_conv);
393 
394 AL_FUNC(BITMAP *, _fixup_loaded_bitmap, (BITMAP *bmp, PALETTE pal, int bpp));
395 
396 AL_FUNC(int, _bitmap_has_alpha, (BITMAP *bmp));
397 
398 /* default truecolor pixel format */
399 #define DEFAULT_RGB_R_SHIFT_15  0
400 #define DEFAULT_RGB_G_SHIFT_15  5
401 #define DEFAULT_RGB_B_SHIFT_15  10
402 #define DEFAULT_RGB_R_SHIFT_16  0
403 #define DEFAULT_RGB_G_SHIFT_16  5
404 #define DEFAULT_RGB_B_SHIFT_16  11
405 #define DEFAULT_RGB_R_SHIFT_24  0
406 #define DEFAULT_RGB_G_SHIFT_24  8
407 #define DEFAULT_RGB_B_SHIFT_24  16
408 #define DEFAULT_RGB_R_SHIFT_32  0
409 #define DEFAULT_RGB_G_SHIFT_32  8
410 #define DEFAULT_RGB_B_SHIFT_32  16
411 #define DEFAULT_RGB_A_SHIFT_32  24
412 
413 
414 /* display switching support */
415 AL_FUNC(void, _switch_in, (void));
416 AL_FUNC(void, _switch_out, (void));
417 
418 AL_FUNC(void, _register_switch_bitmap, (BITMAP *bmp, BITMAP *parent));
419 AL_FUNC(void, _unregister_switch_bitmap, (BITMAP *bmp));
420 AL_FUNC(void, _save_switch_state, (int switch_mode));
421 AL_FUNC(void, _restore_switch_state, (void));
422 
423 AL_VAR(int, _dispsw_status);
424 
425 
426 /* current drawing mode */
427 AL_VAR(int, _drawing_mode);
428 AL_VAR(BITMAP *, _drawing_pattern);
429 AL_VAR(int, _drawing_x_anchor);
430 AL_VAR(int, _drawing_y_anchor);
431 AL_VAR(unsigned int, _drawing_x_mask);
432 AL_VAR(unsigned int, _drawing_y_mask);
433 
434 AL_FUNCPTR(int *, _palette_expansion_table, (int bpp));
435 
436 AL_VAR(int, _color_depth);
437 
438 AL_VAR(int, _current_palette_changed);
439 AL_VAR(PALETTE, _prev_current_palette);
440 AL_VAR(int, _got_prev_current_palette);
441 
442 AL_ARRAY(int, _palette_color8);
443 AL_ARRAY(int, _palette_color15);
444 AL_ARRAY(int, _palette_color16);
445 AL_ARRAY(int, _palette_color24);
446 AL_ARRAY(int, _palette_color32);
447 
448 /* truecolor blending functions */
449 AL_VAR(BLENDER_FUNC, _blender_func15);
450 AL_VAR(BLENDER_FUNC, _blender_func16);
451 AL_VAR(BLENDER_FUNC, _blender_func24);
452 AL_VAR(BLENDER_FUNC, _blender_func32);
453 
454 AL_VAR(BLENDER_FUNC, _blender_func15x);
455 AL_VAR(BLENDER_FUNC, _blender_func16x);
456 AL_VAR(BLENDER_FUNC, _blender_func24x);
457 
458 AL_VAR(int, _blender_col_15);
459 AL_VAR(int, _blender_col_16);
460 AL_VAR(int, _blender_col_24);
461 AL_VAR(int, _blender_col_32);
462 
463 AL_VAR(int, _blender_alpha);
464 
465 AL_FUNC(unsigned long, _blender_black, (unsigned long x, unsigned long y, unsigned long n));
466 
467 #ifdef ALLEGRO_COLOR16
468 
469 AL_FUNC(unsigned long, _blender_trans15, (unsigned long x, unsigned long y, unsigned long n));
470 AL_FUNC(unsigned long, _blender_add15, (unsigned long x, unsigned long y, unsigned long n));
471 AL_FUNC(unsigned long, _blender_burn15, (unsigned long x, unsigned long y, unsigned long n));
472 AL_FUNC(unsigned long, _blender_color15, (unsigned long x, unsigned long y, unsigned long n));
473 AL_FUNC(unsigned long, _blender_difference15, (unsigned long x, unsigned long y, unsigned long n));
474 AL_FUNC(unsigned long, _blender_dissolve15, (unsigned long x, unsigned long y, unsigned long n));
475 AL_FUNC(unsigned long, _blender_dodge15, (unsigned long x, unsigned long y, unsigned long n));
476 AL_FUNC(unsigned long, _blender_hue15, (unsigned long x, unsigned long y, unsigned long n));
477 AL_FUNC(unsigned long, _blender_invert15, (unsigned long x, unsigned long y, unsigned long n));
478 AL_FUNC(unsigned long, _blender_luminance15, (unsigned long x, unsigned long y, unsigned long n));
479 AL_FUNC(unsigned long, _blender_multiply15, (unsigned long x, unsigned long y, unsigned long n));
480 AL_FUNC(unsigned long, _blender_saturation15, (unsigned long x, unsigned long y, unsigned long n));
481 AL_FUNC(unsigned long, _blender_screen15, (unsigned long x, unsigned long y, unsigned long n));
482 
483 AL_FUNC(unsigned long, _blender_trans16, (unsigned long x, unsigned long y, unsigned long n));
484 AL_FUNC(unsigned long, _blender_add16, (unsigned long x, unsigned long y, unsigned long n));
485 AL_FUNC(unsigned long, _blender_burn16, (unsigned long x, unsigned long y, unsigned long n));
486 AL_FUNC(unsigned long, _blender_color16, (unsigned long x, unsigned long y, unsigned long n));
487 AL_FUNC(unsigned long, _blender_difference16, (unsigned long x, unsigned long y, unsigned long n));
488 AL_FUNC(unsigned long, _blender_dissolve16, (unsigned long x, unsigned long y, unsigned long n));
489 AL_FUNC(unsigned long, _blender_dodge16, (unsigned long x, unsigned long y, unsigned long n));
490 AL_FUNC(unsigned long, _blender_hue16, (unsigned long x, unsigned long y, unsigned long n));
491 AL_FUNC(unsigned long, _blender_invert16, (unsigned long x, unsigned long y, unsigned long n));
492 AL_FUNC(unsigned long, _blender_luminance16, (unsigned long x, unsigned long y, unsigned long n));
493 AL_FUNC(unsigned long, _blender_multiply16, (unsigned long x, unsigned long y, unsigned long n));
494 AL_FUNC(unsigned long, _blender_saturation16, (unsigned long x, unsigned long y, unsigned long n));
495 AL_FUNC(unsigned long, _blender_screen16, (unsigned long x, unsigned long y, unsigned long n));
496 
497 #endif
498 
499 #if (defined ALLEGRO_COLOR24) || (defined ALLEGRO_COLOR32)
500 
501 AL_FUNC(unsigned long, _blender_trans24, (unsigned long x, unsigned long y, unsigned long n));
502 AL_FUNC(unsigned long, _blender_add24, (unsigned long x, unsigned long y, unsigned long n));
503 AL_FUNC(unsigned long, _blender_burn24, (unsigned long x, unsigned long y, unsigned long n));
504 AL_FUNC(unsigned long, _blender_color24, (unsigned long x, unsigned long y, unsigned long n));
505 AL_FUNC(unsigned long, _blender_difference24, (unsigned long x, unsigned long y, unsigned long n));
506 AL_FUNC(unsigned long, _blender_dissolve24, (unsigned long x, unsigned long y, unsigned long n));
507 AL_FUNC(unsigned long, _blender_dodge24, (unsigned long x, unsigned long y, unsigned long n));
508 AL_FUNC(unsigned long, _blender_hue24, (unsigned long x, unsigned long y, unsigned long n));
509 AL_FUNC(unsigned long, _blender_invert24, (unsigned long x, unsigned long y, unsigned long n));
510 AL_FUNC(unsigned long, _blender_luminance24, (unsigned long x, unsigned long y, unsigned long n));
511 AL_FUNC(unsigned long, _blender_multiply24, (unsigned long x, unsigned long y, unsigned long n));
512 AL_FUNC(unsigned long, _blender_saturation24, (unsigned long x, unsigned long y, unsigned long n));
513 AL_FUNC(unsigned long, _blender_screen24, (unsigned long x, unsigned long y, unsigned long n));
514 
515 #endif
516 
517 AL_FUNC(unsigned long, _blender_alpha15, (unsigned long x, unsigned long y, unsigned long n));
518 AL_FUNC(unsigned long, _blender_alpha16, (unsigned long x, unsigned long y, unsigned long n));
519 AL_FUNC(unsigned long, _blender_alpha24, (unsigned long x, unsigned long y, unsigned long n));
520 AL_FUNC(unsigned long, _blender_alpha32, (unsigned long x, unsigned long y, unsigned long n));
521 
522 AL_FUNC(unsigned long, _blender_write_alpha, (unsigned long x, unsigned long y, unsigned long n));
523 
524 
525 /* graphics drawing routines */
526 AL_FUNC(void, _normal_line, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
527 AL_FUNC(void, _fast_line, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
528 AL_FUNC(void, _normal_rectfill, (BITMAP *bmp, int x1, int y_1, int x2, int y2, int color));
529 
530 #ifdef ALLEGRO_COLOR8
531 
532 AL_FUNC(int,  _linear_getpixel8, (BITMAP *bmp, int x, int y));
533 AL_FUNC(void, _linear_putpixel8, (BITMAP *bmp, int x, int y, int color));
534 AL_FUNC(void, _linear_vline8, (BITMAP *bmp, int x, int y_1, int y2, int color));
535 AL_FUNC(void, _linear_hline8, (BITMAP *bmp, int x1, int y, int x2, int color));
536 AL_FUNC(void, _linear_draw_sprite8, (BITMAP *bmp, BITMAP *sprite, int x, int y));
537 AL_FUNC(void, _linear_draw_sprite_ex8, (BITMAP *bmp, BITMAP *sprite, int x, int y, int mode, int flip));
538 AL_FUNC(void, _linear_draw_sprite_v_flip8, (BITMAP *bmp, BITMAP *sprite, int x, int y));
539 AL_FUNC(void, _linear_draw_sprite_h_flip8, (BITMAP *bmp, BITMAP *sprite, int x, int y));
540 AL_FUNC(void, _linear_draw_sprite_vh_flip8, (BITMAP *bmp, BITMAP *sprite, int x, int y));
541 AL_FUNC(void, _linear_draw_trans_sprite8, (BITMAP *bmp, BITMAP *sprite, int x, int y));
542 AL_FUNC(void, _linear_draw_lit_sprite8, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
543 AL_FUNC(void, _linear_draw_rle_sprite8, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
544 AL_FUNC(void, _linear_draw_trans_rle_sprite8, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
545 AL_FUNC(void, _linear_draw_lit_rle_sprite8, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
546 AL_FUNC(void, _linear_draw_character8, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg));
547 AL_FUNC(void, _linear_draw_glyph8, (BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg));
548 AL_FUNC(void, _linear_blit8, (BITMAP *source,BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
549 AL_FUNC(void, _linear_blit_backward8, (BITMAP *source,BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
550 AL_FUNC(void, _linear_masked_blit8, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
551 AL_FUNC(void, _linear_clear_to_color8, (BITMAP *bitmap, int color));
552 
553 #endif
554 
555 #ifdef ALLEGRO_COLOR16
556 
557 AL_FUNC(void, _linear_putpixel15, (BITMAP *bmp, int x, int y, int color));
558 AL_FUNC(void, _linear_vline15, (BITMAP *bmp, int x, int y_1, int y2, int color));
559 AL_FUNC(void, _linear_hline15, (BITMAP *bmp, int x1, int y, int x2, int color));
560 AL_FUNC(void, _linear_draw_trans_sprite15, (BITMAP *bmp, BITMAP *sprite, int x, int y));
561 AL_FUNC(void, _linear_draw_trans_rgba_sprite15, (BITMAP *bmp, BITMAP *sprite, int x, int y));
562 AL_FUNC(void, _linear_draw_lit_sprite15, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
563 AL_FUNC(void, _linear_draw_rle_sprite15, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
564 AL_FUNC(void, _linear_draw_trans_rle_sprite15, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
565 AL_FUNC(void, _linear_draw_trans_rgba_rle_sprite15, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
566 AL_FUNC(void, _linear_draw_lit_rle_sprite15, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
567 
568 AL_FUNC(int,  _linear_getpixel16, (BITMAP *bmp, int x, int y));
569 AL_FUNC(void, _linear_putpixel16, (BITMAP *bmp, int x, int y, int color));
570 AL_FUNC(void, _linear_vline16, (BITMAP *bmp, int x, int y_1, int y2, int color));
571 AL_FUNC(void, _linear_hline16, (BITMAP *bmp, int x1, int y, int x2, int color));
572 AL_FUNC(void, _linear_draw_sprite16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
573 AL_FUNC(void, _linear_draw_sprite_ex16, (BITMAP *bmp, BITMAP *sprite, int x, int y, int mode, int flip));
574 AL_FUNC(void, _linear_draw_256_sprite16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
575 AL_FUNC(void, _linear_draw_sprite_v_flip16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
576 AL_FUNC(void, _linear_draw_sprite_h_flip16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
577 AL_FUNC(void, _linear_draw_sprite_vh_flip16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
578 AL_FUNC(void, _linear_draw_trans_sprite16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
579 AL_FUNC(void, _linear_draw_trans_rgba_sprite16, (BITMAP *bmp, BITMAP *sprite, int x, int y));
580 AL_FUNC(void, _linear_draw_lit_sprite16, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
581 AL_FUNC(void, _linear_draw_rle_sprite16, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
582 AL_FUNC(void, _linear_draw_trans_rle_sprite16, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
583 AL_FUNC(void, _linear_draw_trans_rgba_rle_sprite16, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
584 AL_FUNC(void, _linear_draw_lit_rle_sprite16, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
585 AL_FUNC(void, _linear_draw_character16, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg));
586 AL_FUNC(void, _linear_draw_glyph16, (BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg));
587 AL_FUNC(void, _linear_blit16, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
588 AL_FUNC(void, _linear_blit_backward16, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
589 AL_FUNC(void, _linear_masked_blit16, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
590 AL_FUNC(void, _linear_clear_to_color16, (BITMAP *bitmap, int color));
591 
592 #endif
593 
594 #ifdef ALLEGRO_COLOR24
595 
596 AL_FUNC(int,  _linear_getpixel24, (BITMAP *bmp, int x, int y));
597 AL_FUNC(void, _linear_putpixel24, (BITMAP *bmp, int x, int y, int color));
598 AL_FUNC(void, _linear_vline24, (BITMAP *bmp, int x, int y_1, int y2, int color));
599 AL_FUNC(void, _linear_hline24, (BITMAP *bmp, int x1, int y, int x2, int color));
600 AL_FUNC(void, _linear_draw_sprite24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
601 AL_FUNC(void, _linear_draw_sprite_ex24, (BITMAP *bmp, BITMAP *sprite, int x, int y, int mode, int flip));
602 AL_FUNC(void, _linear_draw_256_sprite24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
603 AL_FUNC(void, _linear_draw_sprite_v_flip24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
604 AL_FUNC(void, _linear_draw_sprite_h_flip24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
605 AL_FUNC(void, _linear_draw_sprite_vh_flip24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
606 AL_FUNC(void, _linear_draw_trans_sprite24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
607 AL_FUNC(void, _linear_draw_trans_rgba_sprite24, (BITMAP *bmp, BITMAP *sprite, int x, int y));
608 AL_FUNC(void, _linear_draw_lit_sprite24, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
609 AL_FUNC(void, _linear_draw_rle_sprite24, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
610 AL_FUNC(void, _linear_draw_trans_rle_sprite24, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
611 AL_FUNC(void, _linear_draw_trans_rgba_rle_sprite24, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
612 AL_FUNC(void, _linear_draw_lit_rle_sprite24, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
613 AL_FUNC(void, _linear_draw_character24, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg));
614 AL_FUNC(void, _linear_draw_glyph24, (BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg));
615 AL_FUNC(void, _linear_blit24, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
616 AL_FUNC(void, _linear_blit_backward24, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
617 AL_FUNC(void, _linear_masked_blit24, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
618 AL_FUNC(void, _linear_clear_to_color24, (BITMAP *bitmap, int color));
619 
620 #endif
621 
622 #ifdef ALLEGRO_COLOR32
623 
624 AL_FUNC(int,  _linear_getpixel32, (BITMAP *bmp, int x, int y));
625 AL_FUNC(void, _linear_putpixel32, (BITMAP *bmp, int x, int y, int color));
626 AL_FUNC(void, _linear_vline32, (BITMAP *bmp, int x, int y_1, int y2, int color));
627 AL_FUNC(void, _linear_hline32, (BITMAP *bmp, int x1, int y, int x2, int color));
628 AL_FUNC(void, _linear_draw_sprite32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
629 AL_FUNC(void, _linear_draw_sprite_ex32, (BITMAP *bmp, BITMAP *sprite, int x, int y, int mode, int flip));
630 AL_FUNC(void, _linear_draw_256_sprite32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
631 AL_FUNC(void, _linear_draw_sprite_v_flip32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
632 AL_FUNC(void, _linear_draw_sprite_h_flip32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
633 AL_FUNC(void, _linear_draw_sprite_vh_flip32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
634 AL_FUNC(void, _linear_draw_trans_sprite32, (BITMAP *bmp, BITMAP *sprite, int x, int y));
635 AL_FUNC(void, _linear_draw_lit_sprite32, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
636 AL_FUNC(void, _linear_draw_rle_sprite32, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
637 AL_FUNC(void, _linear_draw_trans_rle_sprite32, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
638 AL_FUNC(void, _linear_draw_lit_rle_sprite32, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
639 AL_FUNC(void, _linear_draw_character32, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg));
640 AL_FUNC(void, _linear_draw_glyph32, (BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg));
641 AL_FUNC(void, _linear_blit32, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
642 AL_FUNC(void, _linear_blit_backward32, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
643 AL_FUNC(void, _linear_masked_blit32, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
644 AL_FUNC(void, _linear_clear_to_color32, (BITMAP *bitmap, int color));
645 
646 #endif
647 
648 #ifdef ALLEGRO_GFX_HAS_VGA
649 
650 AL_FUNC(int,  _x_getpixel, (BITMAP *bmp, int x, int y));
651 AL_FUNC(void, _x_putpixel, (BITMAP *bmp, int x, int y, int color));
652 AL_FUNC(void, _x_vline, (BITMAP *bmp, int x, int y_1, int y2, int color));
653 AL_FUNC(void, _x_hline, (BITMAP *bmp, int x1, int y, int x2, int color));
654 AL_FUNC(void, _x_draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y));
655 AL_FUNC(void, _x_draw_sprite_v_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y));
656 AL_FUNC(void, _x_draw_sprite_h_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y));
657 AL_FUNC(void, _x_draw_sprite_vh_flip, (BITMAP *bmp, BITMAP *sprite, int x, int y));
658 AL_FUNC(void, _x_draw_trans_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y));
659 AL_FUNC(void, _x_draw_lit_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color));
660 AL_FUNC(void, _x_draw_rle_sprite, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
661 AL_FUNC(void, _x_draw_trans_rle_sprite, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y));
662 AL_FUNC(void, _x_draw_lit_rle_sprite, (BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y, int color));
663 AL_FUNC(void, _x_draw_character, (BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int bg));
664 AL_FUNC(void, _x_draw_glyph, (BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg));
665 AL_FUNC(void, _x_blit_from_memory, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
666 AL_FUNC(void, _x_blit_to_memory, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
667 AL_FUNC(void, _x_blit, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
668 AL_FUNC(void, _x_blit_forward, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
669 AL_FUNC(void, _x_blit_backward, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
670 AL_FUNC(void, _x_masked_blit, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height));
671 AL_FUNC(void, _x_clear_to_color, (BITMAP *bitmap, int color));
672 
673 #endif
674 
675 
676 /* color conversion routines */
677 typedef struct GRAPHICS_RECT {
678    int width;
679    int height;
680    int pitch;
681    void *data;
682 } GRAPHICS_RECT;
683 
684 typedef void (COLORCONV_BLITTER_FUNC)(GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect);
685 
686 AL_FUNC(COLORCONV_BLITTER_FUNC *, _get_colorconv_blitter, (int from_depth, int to_depth));
687 AL_FUNC(void, _release_colorconv_blitter, (COLORCONV_BLITTER_FUNC *blitter));
688 AL_FUNC(void, _set_colorconv_palette, (AL_CONST struct RGB *p, int from, int to));
689 AL_FUNC(unsigned char *, _get_colorconv_map, (void));
690 
691 #ifdef ALLEGRO_COLOR8
692 
693 AL_FUNC(void, _colorconv_blit_8_to_8, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
694 AL_FUNC(void, _colorconv_blit_8_to_15, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
695 AL_FUNC(void, _colorconv_blit_8_to_16, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
696 AL_FUNC(void, _colorconv_blit_8_to_24, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
697 AL_FUNC(void, _colorconv_blit_8_to_32, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
698 
699 #endif
700 
701 #ifdef ALLEGRO_COLOR16
702 
703 AL_FUNC(void, _colorconv_blit_15_to_8, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
704 AL_FUNC(void, _colorconv_blit_15_to_16, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
705 AL_FUNC(void, _colorconv_blit_15_to_24, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
706 AL_FUNC(void, _colorconv_blit_15_to_32, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
707 
708 AL_FUNC(void, _colorconv_blit_16_to_8, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
709 AL_FUNC(void, _colorconv_blit_16_to_15, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
710 AL_FUNC(void, _colorconv_blit_16_to_24, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
711 AL_FUNC(void, _colorconv_blit_16_to_32, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
712 
713 #endif
714 
715 #ifdef ALLEGRO_COLOR24
716 
717 AL_FUNC(void, _colorconv_blit_24_to_8, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
718 AL_FUNC(void, _colorconv_blit_24_to_15, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
719 AL_FUNC(void, _colorconv_blit_24_to_16, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
720 AL_FUNC(void, _colorconv_blit_24_to_32, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
721 
722 #endif
723 
724 #ifdef ALLEGRO_COLOR32
725 
726 AL_FUNC(void, _colorconv_blit_32_to_8, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
727 AL_FUNC(void, _colorconv_blit_32_to_15, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
728 AL_FUNC(void, _colorconv_blit_32_to_16, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
729 AL_FUNC(void, _colorconv_blit_32_to_24, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
730 
731 #endif
732 
733 
734 /* color copy routines */
735 #ifndef ALLEGRO_NO_COLORCOPY
736 
737 #ifdef ALLEGRO_COLOR16
738 AL_FUNC(void, _colorcopy_blit_15_to_15, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
739 AL_FUNC(void, _colorcopy_blit_16_to_16, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
740 #endif
741 
742 #ifdef ALLEGRO_COLOR24
743 AL_FUNC(void, _colorcopy_blit_24_to_24, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
744 #endif
745 
746 #ifdef ALLEGRO_COLOR32
747 AL_FUNC(void, _colorcopy_blit_32_to_32, (GRAPHICS_RECT *src_rect, GRAPHICS_RECT *dest_rect));
748 #endif
749 
750 #endif
751 
752 
753 /* generic color conversion blitter */
754 AL_FUNC(void, _blit_between_formats, (BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h));
755 
756 
757 /* asm helper for stretch_blit() */
758 #ifndef SCAN_EXPORT
759 AL_FUNC(void, _do_stretch, (BITMAP *source, BITMAP *dest, void *drawer, int sx, fixed sy, fixed syd, int dx, int dy, int dh, int color_depth));
760 #endif
761 
762 
763 /* lower level functions for rotation */
764 AL_FUNC(void, _parallelogram_map, (BITMAP *bmp, BITMAP *spr, fixed xs[4], fixed ys[4], void (*draw_scanline)(BITMAP *bmp, BITMAP *spr, fixed l_bmp_x, int bmp_y, fixed r_bmp_x, fixed l_spr_x, fixed l_spr_y, fixed spr_dx, fixed spr_dy), int sub_pixel_accuracy));
765 AL_FUNC(void, _parallelogram_map_standard, (BITMAP *bmp, BITMAP *sprite, fixed xs[4], fixed ys[4]));
766 AL_FUNC(void, _rotate_scale_flip_coordinates, (fixed w, fixed h, fixed x, fixed y, fixed cx, fixed cy, fixed angle, fixed scale_x, fixed scale_y, int h_flip, int v_flip, fixed xs[4], fixed ys[4]));
767 AL_FUNC(void, _pivot_scaled_sprite_flip, (struct BITMAP *bmp, struct BITMAP *sprite, fixed x, fixed y, fixed cx, fixed cy, fixed angle, fixed scale, int v_flip));
768 
769 
770 /* number of fractional bits used by the polygon rasteriser */
771 #define POLYGON_FIX_SHIFT     18
772 
773 
774 /* bitfield specifying which polygon attributes need interpolating */
775 #define INTERP_FLAT           1      /* no interpolation */
776 #define INTERP_1COL           2      /* gcol or alpha */
777 #define INTERP_3COL           4      /* grgb */
778 #define INTERP_FIX_UV         8      /* atex */
779 #define INTERP_Z              16     /* always in scene3d */
780 #define INTERP_FLOAT_UV       32     /* ptex */
781 #define OPT_FLOAT_UV_TO_FIX   64     /* translate ptex to atex */
782 #define COLOR_TO_RGB          128    /* grgb to gcol for truecolor */
783 #define INTERP_ZBUF           256    /* z-buffered */
784 #define INTERP_THRU           512    /* any kind of transparent */
785 #define INTERP_NOSOLID        1024   /* non-solid modes for 8-bit flat */
786 #define INTERP_BLEND          2048   /* lit for truecolor */
787 #define INTERP_TRANS          4096   /* trans for truecolor */
788 
789 
790 /* information for polygon scanline fillers */
791 typedef struct POLYGON_SEGMENT
792 {
793    fixed u, v, du, dv;              /* fixed point u/v coordinates */
794    fixed c, dc;                     /* single color gouraud shade values */
795    fixed r, g, b, dr, dg, db;       /* RGB gouraud shade values */
796    float z, dz;                     /* polygon depth (1/z) */
797    float fu, fv, dfu, dfv;          /* floating point u/v coordinates */
798    unsigned char *texture;          /* the texture map */
799    int umask, vmask, vshift;        /* texture map size information */
800    int seg;                         /* destination bitmap selector */
801    uintptr_t zbuf_addr;		    /* Z-buffer address */
802    uintptr_t read_addr;		    /* reading address for transparency modes */
803 } POLYGON_SEGMENT;
804 
805 
806 /* prototype for the scanline filler functions */
807 typedef AL_METHOD(void, SCANLINE_FILLER, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
808 
809 
810 /* an active polygon edge */
811 typedef struct POLYGON_EDGE
812 {
813    int top;                         /* top y position */
814    int bottom;                      /* bottom y position */
815    fixed x, dx;                     /* fixed point x position and gradient */
816    fixed w;                         /* width of line segment */
817    POLYGON_SEGMENT dat;             /* texture/gouraud information */
818    struct POLYGON_EDGE *prev;       /* doubly linked list */
819    struct POLYGON_EDGE *next;
820    struct POLYGON_INFO *poly;	    /* father polygon */
821 } POLYGON_EDGE;
822 
823 
824 typedef struct POLYGON_INFO         /* a polygon waiting rendering */
825 {
826    struct POLYGON_INFO *next, *prev;/* double linked list */
827    int inside;                      /* flag for "scanlining" */
828    int flags;                       /* INTERP_* flags */
829    int color;                       /* vtx[0]->c */
830    float a, b, c;                   /* plane's coefficients -a/d, -b/d, -c/d */
831    int dmode;                       /* drawing mode */
832    BITMAP *dpat;                    /* drawing pattern */
833    int xanchor, yanchor;            /* for dpat */
834    int alpha;                       /* blender alpha */
835    int b15, b16, b24, b32;          /* blender colors */
836    COLOR_MAP *cmap;                 /* trans color map */
837    SCANLINE_FILLER drawer;	    /* scanline drawing functions */
838    SCANLINE_FILLER alt_drawer;
839    POLYGON_EDGE *left_edge;	    /* true edges used in interpolation */
840    POLYGON_EDGE *right_edge;
841    POLYGON_SEGMENT info;            /* base information for scanline functions */
842 } POLYGON_INFO;
843 
844 
845 /* global variable for z-buffer */
846 AL_VAR(BITMAP *, _zbuffer);
847 
848 
849 /* polygon helper functions */
850 AL_VAR(SCANLINE_FILLER, _optim_alternative_drawer);
851 AL_FUNC(POLYGON_EDGE *, _add_edge, (POLYGON_EDGE *list, POLYGON_EDGE *edge, int sort_by_x));
852 AL_FUNC(POLYGON_EDGE *, _remove_edge, (POLYGON_EDGE *list, POLYGON_EDGE *edge));
853 AL_FUNC(int, _fill_3d_edge_structure, (POLYGON_EDGE *edge, AL_CONST V3D *v1, AL_CONST V3D *v2, int flags, BITMAP *bmp));
854 AL_FUNC(int, _fill_3d_edge_structure_f, (POLYGON_EDGE *edge, AL_CONST V3D_f *v1, AL_CONST V3D_f *v2, int flags, BITMAP *bmp));
855 AL_FUNC(SCANLINE_FILLER, _get_scanline_filler, (int type, int *flags, POLYGON_SEGMENT *info, BITMAP *texture, BITMAP *bmp));
856 AL_FUNC(void, _clip_polygon_segment, (POLYGON_SEGMENT *info, fixed gap, int flags));
857 AL_FUNC(void, _clip_polygon_segment_f, (POLYGON_SEGMENT *info, int gap, int flags));
858 
859 
860 /* polygon scanline filler functions */
861 AL_FUNC(void, _poly_scanline_dummy, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
862 
863 #ifdef ALLEGRO_COLOR8
864 
865 AL_FUNC(void, _poly_scanline_gcol8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
866 AL_FUNC(void, _poly_scanline_grgb8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
867 AL_FUNC(void, _poly_scanline_atex8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
868 AL_FUNC(void, _poly_scanline_ptex8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
869 AL_FUNC(void, _poly_scanline_atex_mask8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
870 AL_FUNC(void, _poly_scanline_ptex_mask8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
871 AL_FUNC(void, _poly_scanline_atex_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
872 AL_FUNC(void, _poly_scanline_ptex_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
873 AL_FUNC(void, _poly_scanline_atex_mask_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
874 AL_FUNC(void, _poly_scanline_ptex_mask_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
875 AL_FUNC(void, _poly_scanline_atex_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
876 AL_FUNC(void, _poly_scanline_ptex_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
877 AL_FUNC(void, _poly_scanline_atex_mask_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
878 AL_FUNC(void, _poly_scanline_ptex_mask_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
879 
880 #ifndef SCAN_EXPORT
881 AL_FUNC(void, _poly_scanline_grgb8x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
882 #endif
883 
884 AL_FUNC(void, _poly_zbuf_flat8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
885 AL_FUNC(void, _poly_zbuf_gcol8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
886 AL_FUNC(void, _poly_zbuf_grgb8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
887 AL_FUNC(void, _poly_zbuf_atex8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
888 AL_FUNC(void, _poly_zbuf_ptex8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
889 AL_FUNC(void, _poly_zbuf_atex_mask8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
890 AL_FUNC(void, _poly_zbuf_ptex_mask8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
891 AL_FUNC(void, _poly_zbuf_atex_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
892 AL_FUNC(void, _poly_zbuf_ptex_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
893 AL_FUNC(void, _poly_zbuf_atex_mask_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
894 AL_FUNC(void, _poly_zbuf_ptex_mask_lit8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
895 AL_FUNC(void, _poly_zbuf_atex_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
896 AL_FUNC(void, _poly_zbuf_ptex_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
897 AL_FUNC(void, _poly_zbuf_atex_mask_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
898 AL_FUNC(void, _poly_zbuf_ptex_mask_trans8, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
899 
900 #endif
901 
902 #ifdef ALLEGRO_COLOR16
903 
904 AL_FUNC(void, _poly_scanline_grgb15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
905 AL_FUNC(void, _poly_scanline_atex_mask15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
906 AL_FUNC(void, _poly_scanline_ptex_mask15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
907 AL_FUNC(void, _poly_scanline_atex_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
908 AL_FUNC(void, _poly_scanline_ptex_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
909 AL_FUNC(void, _poly_scanline_atex_mask_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
910 AL_FUNC(void, _poly_scanline_ptex_mask_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
911 AL_FUNC(void, _poly_scanline_atex_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
912 AL_FUNC(void, _poly_scanline_ptex_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
913 AL_FUNC(void, _poly_scanline_atex_mask_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
914 AL_FUNC(void, _poly_scanline_ptex_mask_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
915 
916 #ifndef SCAN_EXPORT
917 AL_FUNC(void, _poly_scanline_grgb15x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
918 AL_FUNC(void, _poly_scanline_atex_lit15x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
919 AL_FUNC(void, _poly_scanline_ptex_lit15x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
920 AL_FUNC(void, _poly_scanline_atex_mask_lit15x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
921 AL_FUNC(void, _poly_scanline_ptex_mask_lit15x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
922 
923 AL_FUNC(void, _poly_scanline_ptex_lit15d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
924 AL_FUNC(void, _poly_scanline_ptex_mask_lit15d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
925 #endif
926 
927 AL_FUNC(void, _poly_zbuf_grgb15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
928 AL_FUNC(void, _poly_zbuf_atex_mask15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
929 AL_FUNC(void, _poly_zbuf_ptex_mask15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
930 AL_FUNC(void, _poly_zbuf_atex_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
931 AL_FUNC(void, _poly_zbuf_ptex_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
932 AL_FUNC(void, _poly_zbuf_atex_mask_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
933 AL_FUNC(void, _poly_zbuf_ptex_mask_lit15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
934 AL_FUNC(void, _poly_zbuf_atex_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
935 AL_FUNC(void, _poly_zbuf_ptex_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
936 AL_FUNC(void, _poly_zbuf_atex_mask_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
937 AL_FUNC(void, _poly_zbuf_ptex_mask_trans15, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
938 
939 AL_FUNC(void, _poly_scanline_grgb16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
940 AL_FUNC(void, _poly_scanline_atex16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
941 AL_FUNC(void, _poly_scanline_ptex16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
942 AL_FUNC(void, _poly_scanline_atex_mask16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
943 AL_FUNC(void, _poly_scanline_ptex_mask16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
944 AL_FUNC(void, _poly_scanline_atex_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
945 AL_FUNC(void, _poly_scanline_ptex_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
946 AL_FUNC(void, _poly_scanline_atex_mask_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
947 AL_FUNC(void, _poly_scanline_ptex_mask_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
948 AL_FUNC(void, _poly_scanline_atex_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
949 AL_FUNC(void, _poly_scanline_ptex_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
950 AL_FUNC(void, _poly_scanline_atex_mask_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
951 AL_FUNC(void, _poly_scanline_ptex_mask_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
952 
953 #ifndef SCAN_EXPORT
954 AL_FUNC(void, _poly_scanline_grgb16x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
955 AL_FUNC(void, _poly_scanline_atex_lit16x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
956 AL_FUNC(void, _poly_scanline_ptex_lit16x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
957 AL_FUNC(void, _poly_scanline_atex_mask_lit16x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
958 AL_FUNC(void, _poly_scanline_ptex_mask_lit16x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
959 
960 AL_FUNC(void, _poly_scanline_ptex_lit16d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
961 AL_FUNC(void, _poly_scanline_ptex_mask_lit16d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
962 #endif
963 
964 AL_FUNC(void, _poly_zbuf_flat16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
965 AL_FUNC(void, _poly_zbuf_grgb16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
966 AL_FUNC(void, _poly_zbuf_atex16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
967 AL_FUNC(void, _poly_zbuf_ptex16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
968 AL_FUNC(void, _poly_zbuf_atex_mask16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
969 AL_FUNC(void, _poly_zbuf_ptex_mask16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
970 AL_FUNC(void, _poly_zbuf_atex_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
971 AL_FUNC(void, _poly_zbuf_ptex_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
972 AL_FUNC(void, _poly_zbuf_atex_mask_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
973 AL_FUNC(void, _poly_zbuf_ptex_mask_lit16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
974 AL_FUNC(void, _poly_zbuf_atex_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
975 AL_FUNC(void, _poly_zbuf_ptex_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
976 AL_FUNC(void, _poly_zbuf_atex_mask_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
977 AL_FUNC(void, _poly_zbuf_ptex_mask_trans16, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
978 
979 #endif
980 
981 #ifdef ALLEGRO_COLOR24
982 
983 AL_FUNC(void, _poly_scanline_grgb24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
984 AL_FUNC(void, _poly_scanline_atex24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
985 AL_FUNC(void, _poly_scanline_ptex24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
986 AL_FUNC(void, _poly_scanline_atex_mask24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
987 AL_FUNC(void, _poly_scanline_ptex_mask24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
988 AL_FUNC(void, _poly_scanline_atex_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
989 AL_FUNC(void, _poly_scanline_ptex_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
990 AL_FUNC(void, _poly_scanline_atex_mask_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
991 AL_FUNC(void, _poly_scanline_ptex_mask_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
992 AL_FUNC(void, _poly_scanline_atex_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
993 AL_FUNC(void, _poly_scanline_ptex_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
994 AL_FUNC(void, _poly_scanline_atex_mask_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
995 AL_FUNC(void, _poly_scanline_ptex_mask_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
996 
997 #ifndef SCAN_EXPORT
998 AL_FUNC(void, _poly_scanline_grgb24x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
999 AL_FUNC(void, _poly_scanline_atex_lit24x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1000 AL_FUNC(void, _poly_scanline_ptex_lit24x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1001 AL_FUNC(void, _poly_scanline_atex_mask_lit24x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1002 AL_FUNC(void, _poly_scanline_ptex_mask_lit24x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1003 
1004 AL_FUNC(void, _poly_scanline_ptex_lit24d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1005 AL_FUNC(void, _poly_scanline_ptex_mask_lit24d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1006 #endif
1007 
1008 AL_FUNC(void, _poly_zbuf_flat24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1009 AL_FUNC(void, _poly_zbuf_grgb24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1010 AL_FUNC(void, _poly_zbuf_atex24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1011 AL_FUNC(void, _poly_zbuf_ptex24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1012 AL_FUNC(void, _poly_zbuf_atex_mask24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1013 AL_FUNC(void, _poly_zbuf_ptex_mask24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1014 AL_FUNC(void, _poly_zbuf_atex_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1015 AL_FUNC(void, _poly_zbuf_ptex_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1016 AL_FUNC(void, _poly_zbuf_atex_mask_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1017 AL_FUNC(void, _poly_zbuf_ptex_mask_lit24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1018 AL_FUNC(void, _poly_zbuf_atex_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1019 AL_FUNC(void, _poly_zbuf_ptex_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1020 AL_FUNC(void, _poly_zbuf_atex_mask_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1021 AL_FUNC(void, _poly_zbuf_ptex_mask_trans24, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1022 
1023 #endif
1024 
1025 #ifdef ALLEGRO_COLOR32
1026 
1027 AL_FUNC(void, _poly_scanline_grgb32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1028 AL_FUNC(void, _poly_scanline_atex32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1029 AL_FUNC(void, _poly_scanline_ptex32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1030 AL_FUNC(void, _poly_scanline_atex_mask32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1031 AL_FUNC(void, _poly_scanline_ptex_mask32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1032 AL_FUNC(void, _poly_scanline_atex_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1033 AL_FUNC(void, _poly_scanline_ptex_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1034 AL_FUNC(void, _poly_scanline_atex_mask_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1035 AL_FUNC(void, _poly_scanline_ptex_mask_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1036 AL_FUNC(void, _poly_scanline_atex_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1037 AL_FUNC(void, _poly_scanline_ptex_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1038 AL_FUNC(void, _poly_scanline_atex_mask_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1039 AL_FUNC(void, _poly_scanline_ptex_mask_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1040 
1041 #ifndef SCAN_EXPORT
1042 AL_FUNC(void, _poly_scanline_grgb32x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1043 AL_FUNC(void, _poly_scanline_atex_lit32x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1044 AL_FUNC(void, _poly_scanline_ptex_lit32x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1045 AL_FUNC(void, _poly_scanline_atex_mask_lit32x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1046 AL_FUNC(void, _poly_scanline_ptex_mask_lit32x, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1047 
1048 AL_FUNC(void, _poly_scanline_ptex_lit32d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1049 AL_FUNC(void, _poly_scanline_ptex_mask_lit32d, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1050 #endif
1051 
1052 AL_FUNC(void, _poly_zbuf_flat32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1053 AL_FUNC(void, _poly_zbuf_grgb32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1054 AL_FUNC(void, _poly_zbuf_atex32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1055 AL_FUNC(void, _poly_zbuf_ptex32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1056 AL_FUNC(void, _poly_zbuf_atex_mask32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1057 AL_FUNC(void, _poly_zbuf_ptex_mask32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1058 AL_FUNC(void, _poly_zbuf_atex_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1059 AL_FUNC(void, _poly_zbuf_ptex_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1060 AL_FUNC(void, _poly_zbuf_atex_mask_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1061 AL_FUNC(void, _poly_zbuf_ptex_mask_lit32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1062 AL_FUNC(void, _poly_zbuf_atex_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1063 AL_FUNC(void, _poly_zbuf_ptex_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1064 AL_FUNC(void, _poly_zbuf_atex_mask_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1065 AL_FUNC(void, _poly_zbuf_ptex_mask_trans32, (uintptr_t addr, int w, POLYGON_SEGMENT *info));
1066 
1067 #endif
1068 
1069 
1070 /* sound lib stuff */
1071 AL_VAR(MIDI_DRIVER, _midi_none);
1072 AL_VAR(int, _digi_volume);
1073 AL_VAR(int, _midi_volume);
1074 AL_VAR(int, _sound_flip_pan);
1075 AL_VAR(int, _sound_hq);
1076 AL_VAR(int, _sound_stereo);
1077 AL_VAR(int, _sound_bits);
1078 AL_VAR(int, _sound_freq);
1079 AL_VAR(int, _sound_port);
1080 AL_VAR(int, _sound_dma);
1081 AL_VAR(int, _sound_irq);
1082 
1083 AL_VAR(int, _sound_installed);
1084 AL_VAR(int, _sound_input_installed);
1085 
1086 AL_FUNC(int, _midi_allocate_voice, (int min, int max));
1087 
1088 AL_VAR(volatile long, _midi_tick);
1089 
1090 AL_FUNC(int, _digmid_find_patches, (char *dir, int dir_size, char *file, int size_of_file));
1091 
1092 #define VIRTUAL_VOICES  256
1093 
1094 
1095 typedef struct          /* a virtual (as seen by the user) soundcard voice */
1096 {
1097    AL_CONST SAMPLE *sample;      /* which sample are we playing? (NULL = free) */
1098    int num;             /* physical voice number (-1 = been killed off) */
1099    int autokill;        /* set to free the voice when the sample finishes */
1100    long time;           /* when we were started (for voice allocation) */
1101    int priority;        /* how important are we? */
1102 } VOICE;
1103 
1104 
1105 typedef struct          /* a physical (as used by hardware) soundcard voice */
1106 {
1107    int num;             /* the virtual voice currently using me (-1 = free) */
1108    int playmode;        /* are we looping? */
1109    int vol;             /* current volume (fixed point .12) */
1110    int dvol;            /* volume delta, for ramping */
1111    int target_vol;      /* target volume, for ramping */
1112    int pan;             /* current pan (fixed point .12) */
1113    int dpan;            /* pan delta, for sweeps */
1114    int target_pan;      /* target pan, for sweeps */
1115    int freq;            /* current frequency (fixed point .12) */
1116    int dfreq;           /* frequency delta, for sweeps */
1117    int target_freq;     /* target frequency, for sweeps */
1118 } PHYS_VOICE;
1119 
1120 AL_ARRAY(PHYS_VOICE, _phys_voice);
1121 
1122 
1123 #define MIXER_DEF_SFX               8
1124 #define MIXER_MAX_SFX               64
1125 
1126 AL_FUNC(int,  _mixer_init, (int bufsize, int freq, int stereo, int is16bit, int *voices));
1127 AL_FUNC(void, _mixer_exit, (void));
1128 AL_FUNC(void, _mix_some_samples, (uintptr_t buf, unsigned short seg, int issigned));
1129 AL_FUNC(void, _mixer_init_voice, (int voice, AL_CONST SAMPLE *sample));
1130 AL_FUNC(void, _mixer_release_voice, (int voice));
1131 AL_FUNC(void, _mixer_start_voice, (int voice));
1132 AL_FUNC(void, _mixer_stop_voice, (int voice));
1133 AL_FUNC(void, _mixer_loop_voice, (int voice, int loopmode));
1134 AL_FUNC(int,  _mixer_get_position, (int voice));
1135 AL_FUNC(void, _mixer_set_position, (int voice, int position));
1136 AL_FUNC(int,  _mixer_get_volume, (int voice));
1137 AL_FUNC(void, _mixer_set_volume, (int voice, int volume));
1138 AL_FUNC(void, _mixer_ramp_volume, (int voice, int tyme, int endvol));
1139 AL_FUNC(void, _mixer_stop_volume_ramp, (int voice));
1140 AL_FUNC(int,  _mixer_get_frequency, (int voice));
1141 AL_FUNC(void, _mixer_set_frequency, (int voice, int frequency));
1142 AL_FUNC(void, _mixer_sweep_frequency, (int voice, int tyme, int endfreq));
1143 AL_FUNC(void, _mixer_stop_frequency_sweep, (int voice));
1144 AL_FUNC(int,  _mixer_get_pan, (int voice));
1145 AL_FUNC(void, _mixer_set_pan, (int voice, int pan));
1146 AL_FUNC(void, _mixer_sweep_pan, (int voice, int tyme, int endpan));
1147 AL_FUNC(void, _mixer_stop_pan_sweep, (int voice));
1148 AL_FUNC(void, _mixer_set_echo, (int voice, int strength, int delay));
1149 AL_FUNC(void, _mixer_set_tremolo, (int voice, int rate, int depth));
1150 AL_FUNC(void, _mixer_set_vibrato, (int voice, int rate, int depth));
1151 
1152 AL_FUNC(void, _dummy_noop1, (int p));
1153 AL_FUNC(void, _dummy_noop2, (int p1, int p2));
1154 AL_FUNC(void, _dummy_noop3, (int p1, int p2, int p3));
1155 AL_FUNC(int,  _dummy_load_patches, (AL_CONST char *patches, AL_CONST char *drums));
1156 AL_FUNC(void, _dummy_adjust_patches, (AL_CONST char *patches, AL_CONST char *drums));
1157 AL_FUNC(void, _dummy_key_on, (int inst, int note, int bend, int vol, int pan));
1158 
1159 
1160 /* datafile ID's for compatibility with the old datafile format */
1161 #define V1_DAT_MAGIC             0x616C6C2EL
1162 
1163 #define V1_DAT_DATA              0
1164 #define V1_DAT_FONT              1
1165 #define V1_DAT_BITMAP_16         2
1166 #define V1_DAT_BITMAP_256        3
1167 #define V1_DAT_SPRITE_16         4
1168 #define V1_DAT_SPRITE_256        5
1169 #define V1_DAT_PALETTE_16        6
1170 #define V1_DAT_PALETTE_256       7
1171 #define V1_DAT_FONT_8x8          8
1172 #define V1_DAT_FONT_PROP         9
1173 #define V1_DAT_BITMAP            10
1174 #define V1_DAT_PALETTE           11
1175 #define V1_DAT_SAMPLE            12
1176 #define V1_DAT_MIDI              13
1177 #define V1_DAT_RLE_SPRITE        14
1178 #define V1_DAT_FLI               15
1179 #define V1_DAT_C_SPRITE          16
1180 #define V1_DAT_XC_SPRITE         17
1181 
1182 #define OLD_FONT_SIZE            95
1183 #define LESS_OLD_FONT_SIZE       224
1184 
1185 
1186 /* datafile object loading functions */
1187 AL_FUNC(void, _unload_datafile_object, (DATAFILE *dat));
1188 
1189 
1190 /* information about a datafile object */
1191 typedef struct DATAFILE_TYPE
1192 {
1193    int type;
1194    AL_METHOD(void *, load, (PACKFILE *f, long size));
1195    AL_METHOD(void, destroy, (void *));
1196 } DATAFILE_TYPE;
1197 
1198 
1199 #define MAX_DATAFILE_TYPES    32
1200 
1201 AL_ARRAY(DATAFILE_TYPE, _datafile_type);
1202 
1203 AL_VAR(int, _compile_sprites);
1204 
1205 AL_FUNC(void, _construct_datafile, (DATAFILE *data));
1206 
1207 
1208 /* for readbmp.c */
1209 AL_FUNC(void, _register_bitmap_file_type_init, (void));
1210 
1211 /* for readsmp.c */
1212 AL_FUNC(void, _register_sample_file_type_init, (void));
1213 
1214 /* for readfont.c */
1215 AL_FUNC(void, _register_font_file_type_init, (void));
1216 
1217 
1218 /* for module linking system; see comment in allegro.c */
1219 struct _AL_LINKER_MIDI
1220 {
1221    AL_METHOD(int, init, (void));
1222    AL_METHOD(void, exit, (void));
1223 };
1224 
1225 AL_VAR(struct _AL_LINKER_MIDI *, _al_linker_midi);
1226 
1227 struct _AL_LINKER_MOUSE
1228 {
1229    AL_METHOD(void, set_mouse_etc, (void));
1230    AL_METHOD(void, show_mouse, (BITMAP *));
1231    BITMAP **mouse_screen_ptr;
1232 };
1233 
1234 AL_VAR(struct _AL_LINKER_MOUSE *, _al_linker_mouse);
1235 
1236 
1237 /* dynamic driver lists */
1238 AL_FUNC(_DRIVER_INFO *, _create_driver_list, (void));
1239 AL_FUNC(void, _destroy_driver_list, (_DRIVER_INFO *drvlist));
1240 AL_FUNC(void, _driver_list_append_driver, (_DRIVER_INFO **drvlist, int id, void *driver, int autodetect));
1241 AL_FUNC(void, _driver_list_prepend_driver, (_DRIVER_INFO **drvlist, int id, void *driver, int autodetect));
1242 AL_FUNC(void, _driver_list_append_list, (_DRIVER_INFO **drvlist, _DRIVER_INFO *srclist));
1243 
1244 
1245 /* various libc stuff */
1246 AL_FUNC(void *, _al_sane_realloc, (void *ptr, size_t size));
1247 AL_FUNC(char *, _al_sane_strncpy, (char *dest, const char *src, size_t n));
1248 
1249 
1250 #define _AL_RAND_MAX  0xFFFF
1251 AL_FUNC(void, _al_srand, (int seed));
1252 AL_FUNC(int, _al_rand, (void));
1253 
1254 
1255 #ifdef __cplusplus
1256    }
1257 #endif
1258 
1259 #endif          /* ifndef AINTERN_H */
1260