AddressLib/vopio.c
MomImage *initimg(TCoor x, TCoor y, MomImageType type)

{
  MomImage *newimg;
  ulong size;

  newimg=(MomImage *)malloc(sizeof(MomImage));
  if (!newimg) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }

  size=x*y;
  newimg->version=0L;
  newimg->x=x;
  newimg->y=y;
  newimg->upperodd=0;
  newimg->grid='s';
  newimg->type=type;


/*  newimg->data=(MomImageData *)malloc(sizeof(MomImageData));
  if (!newimg->data) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }*/
  newimg->data=(MomImageData*)&newimg->f;

  newimg->data->u=(unsigned char *)malloc(size*typesize(type));
  if (!newimg->data->u) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }

  memset(newimg->data->u,0,size*typesize(type));

  return(newimg);
}
/**********************************************************************/
/*  initimg  initializes memory for an image, single band, sets data to 0
/**********************************************************************/
initimg  initializes memory for an image, single band, sets data to 0
initimg initializes memory for an image single band sets data to 0
MomImage *initimg(TCoor x, TCoor y, MomImageType type)
{
  MomImage *newimg;
  ulong size;
  newimg=(MomImage *)malloc(sizeof(MomImage));
  if (!newimg) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }
  size=x*y;
  newimg->version=0L;
  newimg->x=x;
  newimg->y=y;
  newimg->upperodd=0;
  newimg->grid='s';
  newimg->type=type;
  newimg->data=(MomImageData*)&newimg->f;
  newimg->data->u=(unsigned char *)malloc(size*typesize(type));
  if (!newimg->data->u) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }
  memset(newimg->data->u,0,size*typesize(type));
  return(newimg);
}
MomImage * initimg ( TCoor x , TCoor y , MomImageType type ) { MomImage * newimg ; ulong size ; newimg = ( MomImage * ) malloc ( sizeof ( MomImage ) ) ; if ( ! newimg ) { fprintf ( stderr , " " ) ; exit ( errno ) ; } size = x * y ; newimg -> version = 0L ; newimg -> x = x ; newimg -> y = y ; newimg -> upperodd = 0 ; newimg -> grid = ' ' ; newimg -> type = type ; newimg -> data = ( MomImageData * ) & newimg -> f ; newimg -> data -> u = ( unsigned char * ) malloc ( size * typesize ( type ) ) ; if ( ! newimg -> data -> u ) { fprintf ( stderr , " " ) ; exit ( errno ) ; } memset ( newimg -> data -> u , 0 , size * typesize ( type ) ) ; return ( newimg ) ; }
initimg  initializes memory for an image, single band, sets data to 0
initimg initializes memory for an image single band sets data to 0
/*  newimg->data=(MomImageData *)malloc(sizeof(MomImageData));
  if (!newimg->data) {
    fprintf(stderr,"ERROR : Out of memory");
    exit(errno);
  }*/