/* * bSave2Draw - save the JPEG picture to the Draw file * * This function puts a JPEG picture in a Draw file * * return TRUE when sucessful, otherwise FALSE */ BOOL bSave2Draw(diagram_type *pDiag, FILE *pFile, size_t tJpegSize, const imagedata_type *pImg) { UCHAR *pucJpeg, *pucTmp; size_t tLen; int iByte; pucJpeg = xmalloc(tJpegSize); for (pucTmp = pucJpeg, tLen = 0; tLen < tJpegSize; pucTmp++, tLen++) { iByte = iNextByte(pFile); if (iByte == EOF) { return FALSE; } *pucTmp = (UCHAR)iByte; } #if 0 /* defined(DEBUG) */ vCopy2File(pucJpeg, tJpegSize); #endif /* DEBUG */ /* Add the JPEG to the Draw file */ vImage2Diagram(pDiag, pImg, pucJpeg, tJpegSize); xfree(pucJpeg); return TRUE; } /* end of bSave2Draw */
/* * bTranslateDIB - translate a DIB picture * * This function translates a picture from dib to eps * * return TRUE when sucessful, otherwise FALSE */ BOOL bTranslateDIB(diagram_type *pDiag, FILE *pInFile, ULONG ulFileOffset, const imagedata_type *pImg) { #if defined(DEBUG) fail(pImg->tPosition > pImg->tLength); vCopy2File(pInFile, ulFileOffset, pImg->tLength - pImg->tPosition); #endif /* DEBUG */ /* Seek to start position of DIB data */ if (!bSetDataOffset(pInFile, ulFileOffset)) { return FALSE; } vImagePrologue(pDiag, pImg); vDecodeDIB(pInFile, pDiag->pOutFile, pImg); vImageEpilogue(pDiag); return TRUE; } /* end of bTranslateDIB */