/*---------------------------------------------------------------------------
 * BMPSaver スタティックライブラリ版
 * bmpsaver.h (2000/07/19 - 2000/12/26) ver 2.01
 * Copyright (c) 2000, Kazuhide Hatsuyama, All rights reserved.
 *   mail    : hat@lares.dti.ne.jp
 *   HomePage: http://www.lares.dti.ne.jp/~hat/
 *---------------------------------------------------------------------------*/

#ifndef _KH_BMPSAVER_
#define _KH_BMPSAVER_

/* 出力対象 bs_set_target() の引数 */
#define KH_BS_SCREEN1	1
#define KH_BS_SCREEN2	2
#define KH_BS_SPRITE	4

/* Error Code */
#define KH_BS_OK		-1
#define KH_BS_ERROR		0

/*----------------------------------------------------------*/
/* public 関数 */
/*----------------------------------------------------------*/

void bs_set_target(int target);
void bs_sprite_set_range(int start, int count);

/*----- ram0 へ出力 -----*/
int bs_save_bmp(const char far *fn, int x, int y, int w, int h); /* 旧バージョンとの互換用 */
int bs_save_screen(const char far *fn, int x, int y, int w, int h);
int bsc_save_screen(const char far *fn, int x, int y, int w, int h);

/*----- XMODEM で出力 -----*/
int bs_save_screen_xmodem(const char far *fn, int x, int y, int w, int h);
int bsc_save_screen_xmodem(const char far *fn, int x, int y, int w, int h);

/*----------------------------------------------------------*/
/* 下位モジュール */
/*----------------------------------------------------------*/
/* ----- 使用法 -----
	bs_open("test.bmp");
	for(y=h-1;y>=0;y--) {
		for(x=0;x<w;x++) {
			// y:下->上 x:左->右 に１画素づつ
			bs_putcolor(color); 
		}
	}
	bs_close();
*/

typedef struct tagBMPFILEINFO
{
	const char far *fn;
	int w, h;
	int bpp;	/* 4 or 8 */
} BMPFILEINFO;

/*----- ram0 -----*/
int bs_open(BMPFILEINFO far *bfi);
int bs_putcolor(unsigned char color);
int bs_close();

/*----- XMODEM ----*/
int bs_open_xmodem(BMPFILEINFO far *bfi);
int bs_putcolor_xmodem(unsigned char color);
int bs_close_xmodem();

#endif
