Example #1
0
File: gifdbl.c Project: cran/R2SWF
SWFDBLBitmapData newSWFDBLBitmapData_fromGifFile(const char *fileName)
{	GifFileType *file;
	SWFDBLBitmapData ret;
	struct dbl_data gifdata;

	if((file = DGifOpenFileName(fileName)) == NULL)
		return NULL;
	if(!readGif(file, &gifdata))
		return NULL;
	ret = newSWFDBLBitmapData_fromData(&gifdata);
	/* ret->input = NULL; */
	return ret;
}
Example #2
0
SWFDBLBitmapData newSWFDBLBitmapData_fromGifInput(SWFInput input)
{   GifFileType *file;
    SWFDBLBitmapData ret;
    struct dbl_data gifdata;

#if GIFLIB_MAJOR >= 5
    if((file = DGifOpen(input, (InputFunc) gifReadFunc, NULL)) == NULL)
#else
    if((file = DGifOpen(input, (InputFunc) gifReadFunc)) == NULL)
#endif
        return NULL;
    if(!readGif(file, &gifdata))
        return NULL;
    ret = newSWFDBLBitmapData_fromData(&gifdata);
    // ret->input = NULL;
    return ret;
}
Example #3
0
SWFDBLBitmapData newSWFDBLBitmapData_fromGifFile(const char *fileName)
{   GifFileType *file;
    SWFDBLBitmapData ret;
    struct dbl_data gifdata;

#if GIFLIB_MAJOR >= 5
    if((file = DGifOpenFileName(fileName, NULL)) == NULL)
#else
    if((file = DGifOpenFileName(fileName)) == NULL)
#endif
        return NULL;
    if(!readGif(file, &gifdata))
        return NULL;
    ret = newSWFDBLBitmapData_fromData(&gifdata);
    // ret->input = NULL;
    return ret;
}
Image*
readGifData ( unsigned char* buf, long len )
{
  Image          *img = 0;
#if defined(INCLUDE_GIF)
  BufferSource   bufSrc;
  GifFileType    *gf;

  bufSrc.buf = bufSrc.p = buf;
  bufSrc.remain = len;

  if ( !(gf = DGifOpen( &bufSrc, readGifBuffer)) )
	return 0;

  img = readGif( gf);

  DGifCloseFile( gf);
  
#endif /* INCLUDE_GIF */

  return img;
}