Lines Matching refs:GifFile
35 static int EGifPutWord(int Word, GifFileType * GifFile);
36 static int EGifSetupCompress(GifFileType * GifFile);
37 static int EGifCompressLine(GifFileType * GifFile, GifPixelType * Line,
39 static int EGifCompressOutput(GifFileType * GifFile, int Code);
40 static int EGifBufferedOutput(GifFileType * GifFile, GifByteType * Buf,
58 GifFileType *GifFile; in EGifOpenFileName() local
74 GifFile = EGifOpenFileHandle(FileHandle, Error); in EGifOpenFileName()
75 if (GifFile == (GifFileType *) NULL) in EGifOpenFileName()
77 return GifFile; in EGifOpenFileName()
90 GifFileType *GifFile; in EGifOpenFileHandle() local
94 GifFile = (GifFileType *) malloc(sizeof(GifFileType)); in EGifOpenFileHandle()
95 if (GifFile == NULL) { in EGifOpenFileHandle()
99 memset(GifFile, '\0', sizeof(GifFileType)); in EGifOpenFileHandle()
103 free(GifFile); in EGifOpenFileHandle()
110 free(GifFile); in EGifOpenFileHandle()
123 GifFile->Private = (void *)Private; in EGifOpenFileHandle()
130 GifFile->UserData = (void *)NULL; /* No user write handle (MRB) */ in EGifOpenFileHandle()
132 GifFile->Error = 0; in EGifOpenFileHandle()
134 return GifFile; in EGifOpenFileHandle()
144 GifFileType *GifFile; in EGifOpen() local
147 GifFile = (GifFileType *)malloc(sizeof(GifFileType)); in EGifOpen()
148 if (GifFile == NULL) { in EGifOpen()
154 memset(GifFile, '\0', sizeof(GifFileType)); in EGifOpen()
158 free(GifFile); in EGifOpen()
168 free (GifFile); in EGifOpen()
175 GifFile->Private = (void *)Private; in EGifOpen()
181 GifFile->UserData = userData; /* User write handle (MRB) */ in EGifOpen()
185 GifFile->Error = 0; in EGifOpen()
187 return GifFile; in EGifOpen()
194 EGifGetGifVersion(GifFileType *GifFile) in EGifGetGifVersion() argument
196 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifGetGifVersion()
205 for (i = 0; i < GifFile->ImageCount; i++) { in EGifGetGifVersion()
206 for (j = 0; j < GifFile->SavedImages[i].ExtensionBlockCount; j++) { in EGifGetGifVersion()
208 GifFile->SavedImages[i].ExtensionBlocks[j].Function; in EGifGetGifVersion()
217 for (i = 0; i < GifFile->ExtensionBlockCount; i++) { in EGifGetGifVersion()
218 int function = GifFile->ExtensionBlocks[i].Function; in EGifGetGifVersion()
240 void EGifSetGifVersion(GifFileType *GifFile, const bool gif89) in EGifSetGifVersion() argument
242 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifSetGifVersion()
265 EGifPutScreenDesc(GifFileType *GifFile, in EGifPutScreenDesc() argument
273 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifPutScreenDesc()
278 GifFile->Error = E_GIF_ERR_HAS_SCRN_DSCR; in EGifPutScreenDesc()
283 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutScreenDesc()
287 write_version = EGifGetGifVersion(GifFile); in EGifPutScreenDesc()
290 if (InternalWrite(GifFile, (unsigned char *)write_version, in EGifPutScreenDesc()
292 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifPutScreenDesc()
296 GifFile->SWidth = Width; in EGifPutScreenDesc()
297 GifFile->SHeight = Height; in EGifPutScreenDesc()
298 GifFile->SColorResolution = ColorRes; in EGifPutScreenDesc()
299 GifFile->SBackGroundColor = BackGround; in EGifPutScreenDesc()
301 GifFile->SColorMap = GifMakeMapObject(ColorMap->ColorCount, in EGifPutScreenDesc()
303 if (GifFile->SColorMap == NULL) { in EGifPutScreenDesc()
304 GifFile->Error = E_GIF_ERR_NOT_ENOUGH_MEM; in EGifPutScreenDesc()
308 GifFile->SColorMap = NULL; in EGifPutScreenDesc()
314 (void)EGifPutWord(Width, GifFile); in EGifPutScreenDesc()
315 (void)EGifPutWord(Height, GifFile); in EGifPutScreenDesc()
329 Buf[2] = GifFile->AspectByte; /* Pixel Aspect Ratio */ in EGifPutScreenDesc()
330 InternalWrite(GifFile, Buf, 3); in EGifPutScreenDesc()
340 if (InternalWrite(GifFile, Buf, 3) != 3) { in EGifPutScreenDesc()
341 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifPutScreenDesc()
358 EGifPutImageDesc(GifFileType *GifFile, in EGifPutImageDesc() argument
367 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutImageDesc()
372 GifFile->Error = E_GIF_ERR_HAS_IMAG_DSCR; in EGifPutImageDesc()
377 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutImageDesc()
380 GifFile->Image.Left = Left; in EGifPutImageDesc()
381 GifFile->Image.Top = Top; in EGifPutImageDesc()
382 GifFile->Image.Width = Width; in EGifPutImageDesc()
383 GifFile->Image.Height = Height; in EGifPutImageDesc()
384 GifFile->Image.Interlace = Interlace; in EGifPutImageDesc()
386 if (GifFile->Image.ColorMap != NULL) { in EGifPutImageDesc()
387 GifFreeMapObject(GifFile->Image.ColorMap); in EGifPutImageDesc()
388 GifFile->Image.ColorMap = NULL; in EGifPutImageDesc()
390 GifFile->Image.ColorMap = GifMakeMapObject(ColorMap->ColorCount, in EGifPutImageDesc()
392 if (GifFile->Image.ColorMap == NULL) { in EGifPutImageDesc()
393 GifFile->Error = E_GIF_ERR_NOT_ENOUGH_MEM; in EGifPutImageDesc()
397 GifFile->Image.ColorMap = NULL; in EGifPutImageDesc()
402 InternalWrite(GifFile, Buf, 1); in EGifPutImageDesc()
403 (void)EGifPutWord(Left, GifFile); in EGifPutImageDesc()
404 (void)EGifPutWord(Top, GifFile); in EGifPutImageDesc()
405 (void)EGifPutWord(Width, GifFile); in EGifPutImageDesc()
406 (void)EGifPutWord(Height, GifFile); in EGifPutImageDesc()
410 InternalWrite(GifFile, Buf, 1); in EGifPutImageDesc()
420 if (InternalWrite(GifFile, Buf, 3) != 3) { in EGifPutImageDesc()
421 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifPutImageDesc()
426 if (GifFile->SColorMap == NULL && GifFile->Image.ColorMap == NULL) { in EGifPutImageDesc()
427 GifFile->Error = E_GIF_ERR_NO_COLOR_MAP; in EGifPutImageDesc()
436 (void)EGifSetupCompress(GifFile); in EGifPutImageDesc()
445 EGifPutLine(GifFileType * GifFile, GifPixelType *Line, int LineLen) in EGifPutLine() argument
449 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifPutLine()
453 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutLine()
458 LineLen = GifFile->Image.Width; in EGifPutLine()
460 GifFile->Error = E_GIF_ERR_DATA_TOO_BIG; in EGifPutLine()
471 return EGifCompressLine(GifFile, Line, LineLen); in EGifPutLine()
478 EGifPutPixel(GifFileType *GifFile, GifPixelType Pixel) in EGifPutPixel() argument
480 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutPixel()
484 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutPixel()
489 GifFile->Error = E_GIF_ERR_DATA_TOO_BIG; in EGifPutPixel()
498 return EGifCompressLine(GifFile, &Pixel, 1); in EGifPutPixel()
505 EGifPutComment(GifFileType *GifFile, const char *Comment) in EGifPutComment() argument
512 return EGifPutExtension(GifFile, COMMENT_EXT_FUNC_CODE, in EGifPutComment()
516 if (EGifPutExtensionLeader(GifFile, COMMENT_EXT_FUNC_CODE) in EGifPutComment()
523 if (EGifPutExtensionBlock(GifFile, 255, buf) == GIF_ERROR) { in EGifPutComment()
531 if (EGifPutExtensionBlock(GifFile, length, buf) == GIF_ERROR) { in EGifPutComment()
535 if (EGifPutExtensionTrailer(GifFile) == GIF_ERROR) { in EGifPutComment()
548 EGifPutExtensionLeader(GifFileType *GifFile, const int ExtCode) in EGifPutExtensionLeader() argument
551 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutExtensionLeader()
555 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutExtensionLeader()
561 InternalWrite(GifFile, Buf, 2); in EGifPutExtensionLeader()
570 EGifPutExtensionBlock(GifFileType *GifFile, in EGifPutExtensionBlock() argument
575 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutExtensionBlock()
579 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutExtensionBlock()
584 InternalWrite(GifFile, &Buf, 1); in EGifPutExtensionBlock()
585 InternalWrite(GifFile, Extension, ExtLen); in EGifPutExtensionBlock()
594 EGifPutExtensionTrailer(GifFileType *GifFile) { in EGifPutExtensionTrailer() argument
597 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutExtensionTrailer()
601 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutExtensionTrailer()
607 InternalWrite(GifFile, &Buf, 1); in EGifPutExtensionTrailer()
619 EGifPutExtension(GifFileType *GifFile, in EGifPutExtension() argument
625 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutExtension()
629 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutExtension()
634 InternalWrite(GifFile, (GifByteType *)&ExtLen, 1); in EGifPutExtension()
639 InternalWrite(GifFile, Buf, 3); in EGifPutExtension()
641 InternalWrite(GifFile, Extension, ExtLen); in EGifPutExtension()
643 InternalWrite(GifFile, Buf, 1); in EGifPutExtension()
670 GifFileType *GifFile, int ImageIndex) in EGifGCBToSavedExtension() argument
676 if (ImageIndex < 0 || ImageIndex > GifFile->ImageCount - 1) in EGifGCBToSavedExtension()
679 for (i = 0; i < GifFile->SavedImages[ImageIndex].ExtensionBlockCount; i++) { in EGifGCBToSavedExtension()
680 ExtensionBlock *ep = &GifFile->SavedImages[ImageIndex].ExtensionBlocks[i]; in EGifGCBToSavedExtension()
688 if (GifAddExtensionBlock(&GifFile->SavedImages[ImageIndex].ExtensionBlockCount, in EGifGCBToSavedExtension()
689 &GifFile->SavedImages[ImageIndex].ExtensionBlocks, in EGifGCBToSavedExtension()
706 EGifPutCode(GifFileType *GifFile, int CodeSize, const GifByteType *CodeBlock) in EGifPutCode() argument
708 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutCode()
712 GifFile->Error = E_GIF_ERR_NOT_WRITEABLE; in EGifPutCode()
725 return EGifPutCodeNext(GifFile, CodeBlock); in EGifPutCode()
734 EGifPutCodeNext(GifFileType *GifFile, const GifByteType *CodeBlock) in EGifPutCodeNext() argument
737 GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; in EGifPutCodeNext()
740 if (InternalWrite(GifFile, CodeBlock, CodeBlock[0] + 1) in EGifPutCodeNext()
742 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifPutCodeNext()
747 if (InternalWrite(GifFile, &Buf, 1) != 1) { in EGifPutCodeNext()
748 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifPutCodeNext()
761 EGifCloseFile(GifFileType *GifFile, int *ErrorCode) in EGifCloseFile() argument
767 if (GifFile == NULL) in EGifCloseFile()
770 Private = (GifFilePrivateType *) GifFile->Private; in EGifCloseFile()
777 free(GifFile); in EGifCloseFile()
784 InternalWrite(GifFile, &Buf, 1); in EGifCloseFile()
786 if (GifFile->Image.ColorMap) { in EGifCloseFile()
787 GifFreeMapObject(GifFile->Image.ColorMap); in EGifCloseFile()
788 GifFile->Image.ColorMap = NULL; in EGifCloseFile()
790 if (GifFile->SColorMap) { in EGifCloseFile()
791 GifFreeMapObject(GifFile->SColorMap); in EGifCloseFile()
792 GifFile->SColorMap = NULL; in EGifCloseFile()
804 free(GifFile); in EGifCloseFile()
808 free(GifFile); in EGifCloseFile()
818 EGifPutWord(int Word, GifFileType *GifFile) in EGifPutWord() argument
824 if (InternalWrite(GifFile, c, 2) == 2) in EGifPutWord()
834 EGifSetupCompress(GifFileType *GifFile) in EGifSetupCompress() argument
838 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifSetupCompress()
841 if (GifFile->Image.ColorMap) in EGifSetupCompress()
842 BitsPerPixel = GifFile->Image.ColorMap->BitsPerPixel; in EGifSetupCompress()
843 else if (GifFile->SColorMap) in EGifSetupCompress()
844 BitsPerPixel = GifFile->SColorMap->BitsPerPixel; in EGifSetupCompress()
846 GifFile->Error = E_GIF_ERR_NO_COLOR_MAP; in EGifSetupCompress()
851 InternalWrite(GifFile, &Buf, 1); /* Write the Code size to file. */ in EGifSetupCompress()
867 if (EGifCompressOutput(GifFile, Private->ClearCode) == GIF_ERROR) { in EGifSetupCompress()
868 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifSetupCompress()
881 EGifCompressLine(GifFileType *GifFile, in EGifCompressLine() argument
889 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifCompressLine()
913 if (EGifCompressOutput(GifFile, CrntCode) == GIF_ERROR) { in EGifCompressLine()
914 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifCompressLine()
924 if (EGifCompressOutput(GifFile, Private->ClearCode) in EGifCompressLine()
926 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifCompressLine()
946 if (EGifCompressOutput(GifFile, CrntCode) == GIF_ERROR) { in EGifCompressLine()
947 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifCompressLine()
950 if (EGifCompressOutput(GifFile, Private->EOFCode) == GIF_ERROR) { in EGifCompressLine()
951 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifCompressLine()
954 if (EGifCompressOutput(GifFile, FLUSH_OUTPUT) == GIF_ERROR) { in EGifCompressLine()
955 GifFile->Error = E_GIF_ERR_DISK_IS_FULL; in EGifCompressLine()
970 EGifCompressOutput(GifFileType *GifFile, in EGifCompressOutput() argument
973 GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; in EGifCompressOutput()
979 if (EGifBufferedOutput(GifFile, Private->Buf, in EGifCompressOutput()
986 if (EGifBufferedOutput(GifFile, Private->Buf, in EGifCompressOutput()
994 if (EGifBufferedOutput(GifFile, Private->Buf, in EGifCompressOutput()
1018 EGifBufferedOutput(GifFileType *GifFile, in EGifBufferedOutput() argument
1025 && InternalWrite(GifFile, Buf, Buf[0] + 1) != (unsigned)(Buf[0] + 1)) { in EGifBufferedOutput()
1026 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifBufferedOutput()
1031 if (InternalWrite(GifFile, Buf, 1) != 1) { in EGifBufferedOutput()
1032 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifBufferedOutput()
1038 if (InternalWrite(GifFile, Buf, Buf[0] + 1) != (unsigned)(Buf[0] + 1)) { in EGifBufferedOutput()
1039 GifFile->Error = E_GIF_ERR_WRITE_FAILED; in EGifBufferedOutput()