diff options
author | James Laird <jlaird@hdfgroup.org> | 2006-03-03 21:49:10 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2006-03-03 21:49:10 (GMT) |
commit | ea9f792cd794024f766fc844b49f9eda73e9bc14 (patch) | |
tree | a6f32669a2272b7f87e5af94aceebef50639f9e5 /tools/gifconv/writehdf.c | |
parent | 142705d983f9ac719ad7e64fa66b4f0aa25fad70 (diff) | |
download | hdf5-ea9f792cd794024f766fc844b49f9eda73e9bc14.zip hdf5-ea9f792cd794024f766fc844b49f9eda73e9bc14.tar.gz hdf5-ea9f792cd794024f766fc844b49f9eda73e9bc14.tar.bz2 |
[svn-r12001] Purpose:
Moved gif2h5 tool to hl directory
Description:
Added a tools directory under the hl directory and moved the gif2h5 tool
to that directory.
Solution:
The gif2h5 tool was originally built in the tools directory, but this
introduced dependency issues that required special checks in the
Makefiles.am and required the top-level build order to be changed
because it depended on the HL library.
For simplicity in the Makefiles now and in the future, the gif2h5 tool
was moved to be underneath the hl library.
Platforms tested:
mir, copper, modi4, shanti
Diffstat (limited to 'tools/gifconv/writehdf.c')
-rw-r--r-- | tools/gifconv/writehdf.c | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c deleted file mode 100644 index 7313d2e..0000000 --- a/tools/gifconv/writehdf.c +++ /dev/null @@ -1,117 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <string.h> -#include <stdlib.h> -#include <string.h> - -#include "gif.h" -#include "H5IM.h" - -/*------------------------------------------------------------------------- - * Function: WriteHDF - * - * Purpose: Write the GIF image with the HDF5 Image API - * - * Programmer: Unknown - * - * Modifications: pvn - * Use the HDF5 IMAGE API to write the HDF5 image and pallete - * - * Date: January, 31, 2006 - * - *------------------------------------------------------------------------- - */ - -int -WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) -{ - GIFHEAD gifHead; /* GIF Header structure */ - GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */ - - long ImageCount; /* number of images */ -#ifdef UNUSED - long CommentCount, /* number of comments */ - ApplicationCount, /* number of application extensions */ - PlainTextCount; /* number of plain text extensions */ -#endif /* UNUSED */ - - char ImageName[256]; /* Image name for the Image */ - - /* H5 variables */ - hid_t file_id; /* H5 file id */ - - /* temp counter */ - int i; - - /* get the GIFMem stuff */ - gifHead = *(GifMemoryStruct.GifHeader); - - /* get some data from gifHead */ - ImageCount = gifHead.ImageCount; -#ifdef UNUSED - CommentCount = (WORD)gifHead.CommentCount; - ApplicationCount = (WORD)gifHead.ApplicationCount; - PlainTextCount = (WORD)gifHead.PlainTextCount; -#endif /* UNUSED */ - - if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) { - /* error occured opening the HDF File for write */ - fprintf(stderr , "HDF file could not be opened for writing\n"); - fprintf(stderr , "NOTE: GIF file must be present in the same directory as the binary on UNIX systems.\n"); - exit(1); - } - - /* first create the global palette if there is one */ - if (gifHead.PackedField & 0x80) { /* global palette exists */ - hsize_t dims[2]; /* specify the dimensions of the palette */ - - /* size of the palette is tablesize (rows) X 3 (columns) */ - dims[0] = gifHead.TableSize; - dims[1] = 3; - - /* make a palette */ - if (H5IMmake_palette(file_id,"Global Palette",dims,(unsigned char *)gifHead.HDFPalette)<0) - return -1; - } - - for(i = 0; i < ImageCount; i++) { - hsize_t dims[2]; /* dimensions for the dataset */ - /* get the gifImageDesc */ - gifImageDesc = GifMemoryStruct.GifImageDesc[i]; - - /* set the dimensions */ - dims[0] = gifImageDesc->ImageHeight; - dims[1] = gifImageDesc->ImageWidth; - - /* create the image name */ - sprintf(ImageName , "Image%d" , i); - - /* write image */ - if (H5IMmake_image_8bit(file_id,ImageName,dims[1],dims[0],(gifImageDesc->Image))<0) - return -1; - - /* attach the palette to the image dataset */ - if (H5IMlink_palette(file_id,ImageName,"Global Palette")<0) - return -1; - } - - /* close the H5 file */ - if (H5Fclose(file_id) < 0) { - fprintf(stderr , "Could not close HDF5 file. Aborting...\n"); - return -1; - } - - return 0; -} - |