#ifndef	FRAMEBUF_H
#define	FRAMEBUF_H

#include <v_lib.h>

typedef struct framebuf_s
{
	u32_t	orig_width, orig_height;
	u32_t	width, height, row_offset;
	u8_p	*scanlines;
}	framebuf_t, *framebuf_p;

framebuf_p fbAlloc(u32_t width,u32_t height);
framebuf_p fbLoad(char *image_name);
framebuf_p fbLoadEx(char *image_name,
	u32_t target_width, u32_t target_height,
	vboolean force_powers2,vboolean force_square,vboolean magnify_at_resize);
framebuf_p fbDuplicate(framebuf_p ref);
void fbSave(framebuf_p fb,char *image_name);
void fbSaveEx(framebuf_p fb,char *image_name,vboolean restore_orig_dims);

void fbClear(framebuf_p fb,vec_t r,vec_t g,vec_t b,vec_t a);
void fbDrawPixel4v(framebuf_p fb,u32_t x,u32_t y,vec4_t rgba);
void fbDrawPixel4(framebuf_p fb,u32_t x,u32_t y,vec_t r,vec_t g,vec_t b,vec_t a);
void fbDrawPixel3(framebuf_p fb,u32_t x,u32_t y,vec_t r,vec_t g,vec_t b);
void fbDrawPixel3v(framebuf_p fb,u32_t x,u32_t y,vec3_t rgb);
void fbReadPixel4v(framebuf_p fb,u32_t x,u32_t y,vec4_t rgba_ret);
void fbReadPixel3v(framebuf_p fb,u32_t x,u32_t y,vec3_t rgb_ret);
void fbDrawPixel4ubv(framebuf_p fb,u32_t x,u32_t y,u8_p rgba);
void fbReadPixel4ubv(framebuf_p fb,u32_t x,u32_t y,u8_p rgba_ret);

#endif	/* FRAMEBUF_H */

