NAME

RputCell - write one cell to a CSF raster file

SYNOPSIS

#include "csf.h"

size_t RputCell
(
	MAP *map,
	size_t rowNr,
	size_t colNr,
	void *cellValue
);

PARAMETERS

MAP *map
map handle
size_t rowNr
Row number of cell
size_t colNr
Column number of cell
void *cellValue
read-write. Buffer large enough to hold one cell in the in-file cell representation or the in-app cell representation. If these types are not equal then the buffer is converted from the in-app to the in-file cell representation.

DESCRIPTION

RputCell writes one cell value to a file.

RETURNS

1 if cell is successfully written, not 1 if not.

EXAMPLE


#include 
#include "csf.h"

/* a simple raw binary to csf
 * program, with minimal checking
 * for example 512*512 b/w image
 * stored in byte format
 */

void main(int argc, char *argv[] )
{

  FILE *in;
  MAP  *out;                      
  size_t r,c;
  UINT1 val;

  if (argc != 2)
  {
   fprintf(stderr,"%s: no file specified\n",argv[0]);
   exit(1);
  }

  in = fopen(argv[1], "rb");
  out = Rcreate(argv[2], 512, 512, CR_UINT1, VS_BOOLEAN, 
                 PT_YINCT2B, 0.0, 0.0, 0.0, 100.0);

  for(r=0; r < 512; r++)
   for(c=0; c < 512; c++)
   {
       fread(&val, 1, 1, in);
       val = (val != 0);
       RputCell(out,r,c,&val); 
   }

  fclose(in);
  Mclose(out);

  exit(0);
}