當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。