diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/jpeg2eps_8c_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/jpeg2eps_8c_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,90 @@ + + + + +TB9.2 Example Applications: examples/PIPS/antiword/src/jpeg2eps.c Source File + + + + + +

examples/PIPS/antiword/src/jpeg2eps.c

00001 /*
+00002  * jpeg2eps.c
+00003  * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+00004  *
+00005  * Description:
+00006  * Functions to translate jpeg pictures into eps
+00007  *
+00008  */
+00009 
+00010 #include <stdio.h>
+00011 #include "antiword.h"
+00012 
+00013 #if defined(DEBUG)
+00014 static int      iPicCounter = 0;
+00015 #endif /* DEBUG */
+00016 
+00017 
+00018 #if defined(DEBUG)
+00019 /*
+00020  * vCopy2File
+00021  */
+00022 static void
+00023 vCopy2File(FILE *pFile, ULONG ulFileOffset, size_t tPictureLen)
+00024 {
+00025         FILE    *pOutFile;
+00026         size_t  tIndex;
+00027         int     iTmp;
+00028         char    szFilename[30];
+00029 
+00030         if (!bSetDataOffset(pFile, ulFileOffset)) {
+00031                 return;
+00032         }
+00033 
+00034         sprintf(szFilename, "/tmp/pic/pic%04d.jpg", ++iPicCounter);
+00035         pOutFile = fopen(szFilename, "wb");
+00036         if (pOutFile == NULL) {
+00037                 return;
+00038         }
+00039         for (tIndex = 0; tIndex < tPictureLen; tIndex++) {
+00040                 iTmp = iNextByte(pFile);
+00041                 if (putc(iTmp, pOutFile) == EOF) {
+00042                         break;
+00043                 }
+00044         }
+00045         (void)fclose(pOutFile);
+00046 } /* end of vCopy2File */
+00047 #endif /* DEBUG */
+00048 
+00049 /*
+00050  * bTranslateJPEG - translate a JPEG picture
+00051  *
+00052  * This function translates a picture from jpeg to eps
+00053  *
+00054  * return TRUE when sucessful, otherwise FALSE
+00055  */
+00056 BOOL
+00057 bTranslateJPEG(diagram_type *pDiag, FILE *pFile,
+00058         ULONG ulFileOffset, size_t tPictureLen, const imagedata_type *pImg)
+00059 {
+00060 #if defined(DEBUG)
+00061         vCopy2File(pFile, ulFileOffset, tPictureLen);
+00062 #endif /* DEBUG */
+00063 
+00064         /* Seek to start position of JPEG data */
+00065         if (!bSetDataOffset(pFile, ulFileOffset)) {
+00066                 return FALSE;
+00067         }
+00068 
+00069         vImagePrologue(pDiag, pImg);
+00070         vASCII85EncodeFile(pFile, pDiag->pOutFile, tPictureLen);
+00071         vImageEpilogue(pDiag);
+00072 
+00073         return TRUE;
+00074 } /* end of bTranslateJPEG */
+
+
Generated by  + +doxygen 1.6.2
+ +