1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
10 #ifndef VIDEOLIB_POLYMOD_H
11 #define VIDEOLIB_POLYMOD_H
12 #ifdef VIDEOLIB_ENABLE_POLYMOD
15 /* note that polygons can be concave, but verticies MUST be in clockwise order */
16 /* rasterizer WILL omit 'right' and 'bottom' points */
18 /* x, y and x+len-1 will never be offscreen; len will always be positive */
19 typedef void (*vl_polymod_hline_fn
) (int x
, int y
, int len
);
21 extern vl_polymod_hline_fn vl_polymod_hline
;
22 extern int vl_polymod_screen_width
;
23 extern int vl_polymod_screen_height
;
25 /* filled by vl_polymod_end() */
26 /* clipped to (0,0)-(vl_polymod_screen_width-1,vl_polymod_screen_height-1) */
27 extern int vl_polymod_minx
;
28 extern int vl_polymod_miny
;
29 extern int vl_polymod_maxx
;
30 extern int vl_polymod_maxy
;
32 extern void vl_polymod_init (void); /* called once in program startup sequence */
33 extern void vl_polymod_deinit (void); /* called once in program shutdown sequence */
35 extern void vl_polymod_start (void); /* called for each new poly */
36 extern void vl_polymod_add_vertex (int x
, int y
); /* will ignore duplicate verticies */
37 extern void vl_polymod_end (void); /* called after the last vertex was added; note that you MUST not specify starting vertex twice! */
39 extern void vl_polymod_fill (void); /* called after vl_polymod_end() to fill resulting poly with vl_polymod_hline() callback */