当前位置: 首页>>代码示例>>C++>>正文


C++ DGifCloseFile函数代码示例

本文整理汇总了C++中DGifCloseFile函数的典型用法代码示例。如果您正苦于以下问题:C++ DGifCloseFile函数的具体用法?C++ DGifCloseFile怎么用?C++ DGifCloseFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DGifCloseFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: T2A

PixRectArray::PixRectArray(const StringArray &fileNames, StringArray &errors) {
  USES_CONVERSION;
  m_updateCounter = 0;
  for(size_t i = 0; i < fileNames.size(); i++) {
    const String &name = fileNames[i];
    try {
      if(FileNameSplitter(name).getExtension().equalsIgnoreCase(_T(".gif"))) {
        int error;
        const char *namea = T2A(name.cstr());
        GifFileType *gifFile = DGifOpenFileName(namea, &error);
        if(gifFile == NULL) {
          throwException(_T("%s"), GifErrorString(error));
        }
        if(DGifSlurp(gifFile) != GIF_OK) {
          const String msg = GifErrorString(gifFile->Error);
          DGifCloseFile(gifFile, &error);
          throwException(_T("%s"), msg.cstr());
        }
        const int imageCount   = gifFile->ImageCount;

        for(int k = 0; k < imageCount; k++) {
          add(new GifPixRect(gifFile, k));
        }
        DGifCloseFile(gifFile, &error);
      } else {
        add(GifPixRect::load(name));
      }
    } catch(Exception e) {
      errors.add(e.what());
    }
  }
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:32,代码来源:PixRectArray.cpp

示例2: DGifCloseFile

/*
 * This function cleans up the gif object after the decode completes
 * It is used in a SkAutoTCallIProc template
 */
void SkGifCodec::CloseGif(GifFileType* gif) {
#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
    DGifCloseFile(gif);
#else
    DGifCloseFile(gif, nullptr);
#endif
}
开发者ID:crabfang,项目名称:skia,代码行数:11,代码来源:SkGifCodec.cpp

示例3: defined

int GIFAbstractDataset::myDGifCloseFile( GifFileType *hGifFile )
{
#if defined(GIFLIB_MAJOR) && ((GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) || GIFLIB_MAJOR > 5)
    int nErrorCode;
    return DGifCloseFile( hGifFile, &nErrorCode );
#else
    return DGifCloseFile( hGifFile );
#endif
}
开发者ID:hdfeos,项目名称:gdal,代码行数:9,代码来源:gifabstractdataset.cpp

示例4: compress_custom

bool compress_custom(void* input_data, InputFunc input_func,
    void* output_data, OutputFunc output_func, int sample_size)
{
  GifFileType* input_gif = NULL;
  GifFileType* output_gif = NULL;
  int result = GIF_ERROR;

  // Check sample
  if (sample_size <= 0) {
    return false;
  }

  input_gif = DGifOpen(input_data, input_func, &error_code);
  if (input_gif == NULL) {
    LOGE(EMSG("Can't open input gif"));
    return false;
  }

  DGifSlurp(input_gif);

  if (input_gif->ImageCount == 0) {
    LOGE(EMSG("Gif frame count is 0"));
    DGifCloseFile(input_gif, &error_code);
    return false;
  }

  // Save gif
  output_gif = EGifOpen(output_data, output_func, &error_code);
  if (output_gif == NULL) {
    LOGE(EMSG("Can't open output gif"));
    DGifCloseFile(input_gif, &error_code);
    return false;
  }

  if (do_compress(input_gif, output_gif, sample_size)) {
    result = EGifSpew(output_gif);
  }

  // Free
  GifFreeExtensions(&output_gif->ExtensionBlockCount, &output_gif->ExtensionBlocks);
  if (output_gif->SavedImages) {
    GifFreeSavedImages(output_gif);
    output_gif->SavedImages = NULL;
  }

  // Close gif
  DGifCloseFile(input_gif, &error_code);

  return result == GIF_OK;
}
开发者ID:younghang,项目名称:Nimingban,代码行数:50,代码来源:gif_downsize.c

示例5: dGifCloseFile

value dGifCloseFile( value hdl )
{
  CAMLparam1(hdl);

  /* For the bug libungif/giflib 4.1.0 */
  /* This may add a new memory leak, but it is better than having 
     segmentation faults */
  ((GifFileType *)hdl)->Image.ColorMap = NULL; 

#if (GIFLIB_MAJOR <= 4)
  DGifCloseFile( (GifFileType *) hdl);
#else
  DGifCloseFile( (GifFileType *) hdl, NULL );
#endif
  CAMLreturn0;
}
开发者ID:philipdexter,项目名称:camlimages,代码行数:16,代码来源:gifread.c

示例6: readGifFile

Image*
readGifFile ( int infile )
{
  Image          *img = 0;

#if defined(INCLUDE_GIF)

  /*
   * we don't use DGifOpenFile because file io might be intercepted
   * (because of threading)
   */
  FileSource     fileSrc;
  GifFileType    *gf;

  fileSrc.fd = infile;

  if ( !(gf = DGifOpen( &fileSrc, readGifFileSource)) )
	return 0;

  img = readGif( gf);

  DGifCloseFile( gf);
#endif

  return img;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:26,代码来源:imggif.c

示例7: QuitGifError

/******************************************************************************
* Close both input and output file (if open), and exit.			      *
******************************************************************************/
static void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut)
{
    PrintGifError();
    if (GifFileIn != NULL) DGifCloseFile(GifFileIn);
    if (GifFileOut != NULL) EGifCloseFile(GifFileOut);
    exit(EXIT_FAILURE);
}
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:10,代码来源:gifclrmp.c

示例8: cleanUp

static void cleanUp(GifInfo* info) {
	free(info->backupPtr);
	info->backupPtr = NULL;
	free(info->infos);
	info->infos = NULL;
	free(info->rasterBits);
	info->rasterBits = NULL;
	free(info->comment);
	info->comment = NULL;

	GifFileType* GifFile = info->gifFilePtr;
	if (GifFile->SavedImages != NULL) {
		SavedImage *sp;
		for (sp = GifFile->SavedImages;
				sp < GifFile->SavedImages + GifFile->ImageCount; sp++) {
			if (sp->ImageDesc.ColorMap != NULL) {
				GifFreeMapObject(sp->ImageDesc.ColorMap);
				sp->ImageDesc.ColorMap = NULL;
			}
		}
		free(GifFile->SavedImages);
		GifFile->SavedImages = NULL;
	}
	DGifCloseFile(GifFile);
	free(info);
}
开发者ID:kyze8439690,项目名称:Qingbo,代码行数:26,代码来源:gif.c

示例9: main

int main(int argc, char **argv) {
  argv++;
  if(!*argv) usage();

  int errorCode;
  GifFileType *gifFile = DGifOpenFileName(*argv, &errorCode);
  if(gifFile == NULL) {
    printf("Error:%s\n", GifErrorString(errorCode));
    exit(-1);
  }
  CHECKGIFOK(DGifSlurp(gifFile));

  _tprintf(_T("GifFile:Size:(%d,%d)\n"), gifFile->SWidth, gifFile->SHeight);
  _tprintf(_T("GifFile:BackgroundColor:%d, AspectByte:%d, ColorResultion:%d\n"), gifFile->SBackGroundColor, gifFile->AspectByte, gifFile->SColorResolution);
  _tprintf(_T("GifFile ")); dumpImageDesc(gifFile->Image);
  _tprintf(_T("GifFile:")); dumpColorMap(gifFile->SColorMap);
  _tprintf(_T("GifFile.ExtentionBlocks:\n"));
  dumpExtensionBlocks(gifFile->ExtensionBlocks, gifFile->ExtensionBlockCount);

  for(int i = 0; i < gifFile->ImageCount; i++) {
    dumpSavedImage(i, gifFile->SavedImages[i]);
  }

  if(DGifCloseFile(gifFile, &errorCode) != GIF_OK) {
    CHECKGIFOK(errorCode);
  }

  return 0;
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:29,代码来源:dumpGif.cpp

示例10: DGifOpen

void AnimatedImage::load(CWnd *parent, ByteInputStream &in) {
  int error;
  GifFileType *gifFile = DGifOpen(&in, readGifStreamFunction, &error);
  if(gifFile == NULL) {
    THROWGIFERROR(error);
  }
  try {
    if(DGifSlurp(gifFile) != GIF_OK) {
      THROWGIFERROR(gifFile->Error);
    }
    createFromGifFile(parent, gifFile);
    DGifCloseFile(gifFile, &error);
  } catch(...) {
    DGifCloseFile(gifFile, &error);
    throw;
  }
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:17,代码来源:AnimatedImage.cpp

示例11: DGifCloseFile

MCGIFImageLoader::~MCGIFImageLoader()
{
	if (m_gif != nil)
	{
		int t_error_code;
		DGifCloseFile(m_gif, &t_error_code);
		m_gif = nil;
	}
}
开发者ID:soapdog,项目名称:livecode,代码行数:9,代码来源:igif.cpp

示例12: QuitGifError

/******************************************************************************
* Close both input and output file (if open), and exit.			      *
******************************************************************************/
static int QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut)
{
	int ErrorCode;
//    PrintGifError(ErrorCode);
    if (GifFileIn != NULL) DGifCloseFile(GifFileIn, &ErrorCode);
    if (GifFileOut != NULL) EGifCloseFile(GifFileOut, &ErrorCode);
    //exit(1);
	return -1;
}
开发者ID:tok101,项目名称:tok101,代码行数:12,代码来源:resize_gif_img.c

示例13: DGifCloseMem

static int DGifCloseMem(GifFileType *gifFile)
{
	if (gifFile->UserData != NULL)
	{
		GifMemoryType *gifMemoryType = (GifMemoryType *) gifFile->UserData;
		gif_free(gifMemoryType);
	}
	return DGifCloseFile(gifFile);
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:9,代码来源:giflib.c

示例14: decode_gif_pixels

static int decode_gif_pixels(struct gps_map *map,
			     unsigned char *out, int x, int y, int width,
			     int height, int bpp, int row_stride)
{
	struct raster_map *raster_map = map->data;
	GifFileType *gf;
	GifRecordType record_type;
	int r;

	if (bpp != 24)
		return -1;
	gf = DGifOpenFileName(raster_map->bitmap_filename);
	if (gf == NULL) {
		gps_error("%s: %s", raster_map->bitmap_filename, strerror(errno));
		return -1;
	}
	r = -1;
	do {
		if (DGifGetRecordType(gf, &record_type) == GIF_ERROR) {
			PrintGifError();
			goto fail;
		}
		switch (record_type) {
		case IMAGE_DESC_RECORD_TYPE:
			if (DGifGetImageDesc(gf) == GIF_ERROR) {
				PrintGifError();
				goto fail;
			}
			if (gf->Image.Width != map->width ||
			    gf->Image.Height != map->height) {
				gps_error("%s: GIF subimages not supported",
					  raster_map->bitmap_filename);
				goto fail;
			}
			if (gf->Image.Interlace) {
				gps_error("%s: interlaced GIFs not supported",
					  raster_map->bitmap_filename);
				goto fail;
			}
			output_gif_pixels(map, gf, x, y, width, height, row_stride, out);
			break;
		case EXTENSION_RECORD_TYPE:
			gps_error("%s: GIF extensions not supported",
				  raster_map->bitmap_filename);
			goto fail;
		case UNDEFINED_RECORD_TYPE:
		case SCREEN_DESC_RECORD_TYPE:
		case TERMINATE_RECORD_TYPE:
			break;
		}
	} while (record_type != IMAGE_DESC_RECORD_TYPE);
	r = 0;
fail:
	DGifCloseFile(gf);
	return r;
}
开发者ID:vtervo,项目名称:gropes,代码行数:56,代码来源:map-raster.c

示例15: DGifCloseFile

GifFilesCloser::~GifFilesCloser() {
    if (mGifIn) {
        DGifCloseFile(mGifIn);
        mGifIn = NULL;
    }
    if (mGifOut) {
        EGifCloseFile(mGifOut);
        mGifOut = NULL;
    }
}
开发者ID:b-project,项目名称:Messaging,代码行数:10,代码来源:GifTranscoder.cpp


注:本文中的DGifCloseFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。