3 * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
6 * Functions to translate jpeg pictures into eps
14 static int iPicCounter
= 0;
23 vCopy2File(FILE *pFile
, ULONG ulFileOffset
, size_t tPictureLen
)
30 if (!bSetDataOffset(pFile
, ulFileOffset
)) {
34 sprintf(szFilename
, "/tmp/pic/pic%04d.jpg", ++iPicCounter
);
35 pOutFile
= fopen(szFilename
, "wb");
36 if (pOutFile
== NULL
) {
39 for (tIndex
= 0; tIndex
< tPictureLen
; tIndex
++) {
40 iTmp
= iNextByte(pFile
);
41 if (putc(iTmp
, pOutFile
) == EOF
) {
45 (void)fclose(pOutFile
);
46 } /* end of vCopy2File */
50 * bTranslateJPEG - translate a JPEG picture
52 * This function translates a picture from jpeg to eps
54 * return TRUE when sucessful, otherwise FALSE
57 bTranslateJPEG(diagram_type
*pDiag
, FILE *pFile
,
58 ULONG ulFileOffset
, size_t tPictureLen
, const imagedata_type
*pImg
)
61 vCopy2File(pFile
, ulFileOffset
, tPictureLen
);
64 /* Seek to start position of JPEG data */
65 if (!bSetDataOffset(pFile
, ulFileOffset
)) {
69 vImagePrologue(pDiag
, pImg
);
70 vASCII85EncodeFile(pFile
, pDiag
->pOutFile
, tPictureLen
);
71 vImageEpilogue(pDiag
);
74 } /* end of bTranslateJPEG */