/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	<time.h>
#include	<fcntl.h>
#include	<math.h>
#include	<stdlib.h>
#include	"gbview.h"


int
cache_image(
	WF_ID wfid,
	RESOURCE * c,
	GB_POINT * pt_list,
	REAL1 * pt_reso,
	unsigned long * buf,
	int size,
	GB_RECT * r,
	MAP_HISTORY * mh,
	SURP_SET * surp,
	int method,
	int flags)
{
DRAW_WORK dw;
int i;
int er;
int j;
int x,y,w,h;


	if ( buf ) 
		for ( i = 0 ; i < size ; i ++ )
			buf[i] = C_TRANSPARENT;

	dw.pt_list = pt_list;
	dw.pt_reso = pt_reso,
	dw.pixels = buf;
	dw.size = size;
	dw.rectondisp = r;
	dw.mh = mh;
	dw.method = method;
	dw.ses = open_session();
	dw.wfid = wfid;
	dw.surp = *surp;
	dw.flags = flags;

	draw_resource(c,&dw);
	close_session(dw.ses);

	return dw.flags;
}


