Dialogic 6.2 Manuale Utente

Pagina di 441
Developing a Fax Application
November 2009
87
BT_ZERO(args_strip);
 
args_strip.fmt = DATA_G3;
 
args_strip.resolution = RES_200H_100V;
 
args_strip.width = WIDTH_A4;
 
BfvFaxStripParams(lp,&args_strip);
 
BT_ZERO(args_fax);
 
args_fax.fname = "g3_file";
 
args_fax.fmt = DATA_G3;
 
BfvFaxSendFile(lp, &args_fax);
 
BfvFaxEndOfDocument(lp, &args_fax);
Accessing a TIFF-F File from an Application
Although applications can directly read and write TIFF-F files with 
a set of Bfv library functions, some knowledge of TIFF-F file format 
is useful.
The BfvTiffOpen and BfvTiffClose functions open and close 
TIFF-F files, respectively.
The BfvTiffReadIFD and BfvTiffReadImage functions read an 
opened TIFF file. BfvTiffReadIFD calls a user-supplied function 
repeatedly with IFD entry information stored in an IFD (Image File 
Directory) for a particular page. The application can use fseek to 
move to locations in the TIFF file as directed by the tags (using the 
TIFF_FP(tp)
 macro to get the file pointer) and BfvTiffReadRes to 
help determine the resolution, as is often needed. The 
BfvTiffReadImage function puts data into a user-supplied buffer 
until the end of the page is reached.
A sample program to read a TIFF-F file follows:
main()
 
{
 
    int my_ifd_func();
 
    TFILE *tp;
 
    unsigned char buf[1024];
 
    int n;
 
    struct args_tiff args_tiff;
 
    BT_ZERO(args_tiff);
 
    args_tiff.fname = "filename";
 
    args_tiff.fmode = "r";
 
    tp = BfvTiffOpen(&args_tiff);
 
    for (;;)
 
    {
 
    args_tiff.tp = tp;
 
    args_tiff.func = my_ifd_func;
 
    args_tiff.arg = NULL;
 
    if (BfvTiffReadIFD(&args_tiff) <= 0)
 
        break;
 
    args_tiff.buf = buf;
 
    args_tiff.size = sizeof(buf);