home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <hdf/df.h>
- #include <hdf/dfproto.h>
- #include <proto/exec.h>
- #include "viewprotos.h"
-
- extern char *image;
-
- extern int width, height;
- extern BOOL isscale;
- extern char hdffile[81];
- extern float32 min, max;
- extern struct Window *gWindow;
-
-
- /* get the HDF image and (de)/allocate memory for the image*/
- int
- getHDF()
- {
- int ret;
- int ispalette;
- int oldwidth, oldheight;
-
- oldwidth = width;
- oldheight = height;
- ret = getDataSize(hdffile,&width,&height,&min,&max);
- if(ret==-1) return(-1);
- ispalette = ret;
-
- if(image) FreeMem(image,oldwidth*oldheight*sizeof(char));
- image=NULL;
-
- image = (char *)AllocMem(width*height*sizeof(char),
- MEMF_PUBLIC | MEMF_CLEAR);
- if(image == NULL) return(-2);
-
- ret = getData(image, width, height, ispalette, hdffile);
- if( ret == -1) return(-3);
-
- return(1);
- }
-
-