#ifndef GFD_GRIFO_H_
#define GFD_GRIFO_H_

/*
 * A Grifo Graphic Device is a special case of gfd device with a "relaxed" clipping test to obtain fast
 * occlusion drawing.
 * The grifo device is obtained from a normal gfd, by offseting the origin at (8, 8).
 * The original device must be GFD_GRIFO_EXTEND2*GFD_GRIFO_EXTEND2 greater then the reguired
 * dimension.
 * Some operation will draw outside of the grifo device, in the outermost rectangle that enclose the grifo device.
 * The clipping operation can test only for the "central pixel", without care of the occlusion pixel or extra
 * pixel pedenting on the width of the operation.
 * WARNING: If the extra pixel have a distance grater then GFD_GRIFO_EXTEND/2, the operation will dirty the memory
 *
 */

#include "gfd.h"

#ifdef __cplusplus
extern "C" {
#endif


#define GFD_GRIFO_EXTEND  8
#define GFD_GRIFO_EXTEND2 (GFD_GRIFO_EXTEND*2)

#define gfd_grifo_fb(fb_) ((fb_).fb)

#define gfd_grifo_extend(x_)  ((x_)+GFD_GRIFO_EXTEND2)

typedef gfd_framebuffer_t gfd_grifo_framebuffer_t;

extern int gfd_grifo_fb_init(gfd_grifo_framebuffer_t* const g_fb, const gfd_framebuffer_t* const fb);

extern void gfd_grifo_draw_hline_w(gfd_grifo_framebuffer_t* const fb, int sx, int sy, int ey, int color, int width, int occlusion);
extern void gfd_grifo_draw_vline_w(gfd_grifo_framebuffer_t* const fb, int sx, int sy, int ey, int color, int width, int occlusion);

extern void gfd_grifo_draw_line_w2(gfd_grifo_framebuffer_t* const fb, int x1, int y1, int x2, int y2, int color, int occlusion);
extern void LineDraw_W2O(gfd_grifo_framebuffer_t* const fb, int XStart, int YStart, int XEnd, int YEnd, int Color);

extern void gfd_grifo_draw_arc179_w2o(gfd_framebuffer_t* const fb, int x, int y, int radius, double angle_start, double angle_len, int color);

#ifdef __cplusplus
}
#endif

#endif /*GFD_GRIFO_H_*/
