PICTools Programmer's Reference
D2F_STRUC

D2F_STRUC: OP_D2F, OP_D2FPLUS

The D2F_STRUC supplies parameters to the OP_D2F opcode used to convert DIBs to supported file formats (e.g., GIF, TIFF, etc.).

 
Copy Code
typedef struct {
   DWORD                        Reserved0;
   BYTE PICHUGE*                AuxSpace;
   BYTE PICHUGE*                Reserved2;
   BYTE PICHUGE*                Reserved3;
   BYTE PICHUGE*                Reserved4;
   BYTE PICHUGE*                MaskBuffer;
   BYTE PICHUGE*                Reserved6;
   BYTE PICHUGE*                Reserved7;
   BYTE PICHUGE*                Reserved8;
   PICFLAGS                     PicFlags;
   PICFLAGS                     PicFlags2;
   DWORD                        AllocType;
   DWORD                        AuxSize;
   DWORD                        ImageType;
   DWORD                        Compression;
   DWORD                        PNG_Progressive;
   DWORD                        PNG_Filter;
   DWORD                        ApplyAux;
   DWORD                        OutBpp;
   DWORD                        Expansion1;
   DWORD                        Expansion2;
   DWORD                        MultiImageSize;
   BYTE                         TransparentColorIndex;
   BYTE                         NegateImage;
   BYTE                         Dimension;
   BYTE                         DisposalMethod;
   DWORD                        RowsPerStrip;
   LONG                         LumFactor;
   LONG                         ChromFactor;
   SUBSAMPLING                  SubSampling;
   LONG                         Predictor;
   WORD                         DelayTime;
   BYTE                         BackgroundColor;
   BYTE                         AspectRatio;
   DWORD                        WidthPad;
   WORD                         LogicalScreenWidth;
   WORD                         LogicalScreenHeight;
   WORD                         ImageLeftPosition;
   WORD                         ImageTopPosition;
   DWORD                        YieldEvery;
   DWORD                        IFDOffset;
   DWORD                        InsertAfterIFDOffset;
   DWORD                        TIFFFirstByte;
} D2F_STRUC;

Fields:

Name Description

Reserved0

This field is not currently used and must be set to 0.

AuxSpace

AuxSpace may be set to point to a block of memory whose size is AuxSize. This block of memory must be organized as a sequential series of one or more 'chunks'.  Each chunk consists of a DWORD Tag, followed by a DWORD Length, followed by Length bytes of data. Thus the total length of each chunk is Length + 8. AuxSize is the sum of all the chunk(s) total lengths. If ApplyAux is not 0, then chunks whose type is recognized as appropriate by OP_D2F will be embedded into the output image. AuxSpace is currently ignored except for BMP output. AUX_BMP_EXTRABI is currently the only appropriate Tag. See the OP_D2F BMP Output section for additional information.

Reserved2

Reserved3

Reserved4

These fields are not currently used and must be set to 0.

MaskBuffer

If PF2_UseAlphaMask is set in PicFlags2, MaskBuffer must point to a buffer with which to blend.

Reserved6

Reserved7

Reserved8

These fields are not currently used and must be set to 0.

PicFlags

Flags that control the OP_D2F operation.

Value

Meaning

PF_IncludeBMPHead

If set, then the Get queue contains a BMP file image following the BITMAPFILEHEADER. If clear, then the Get queue contains a DIB.

PF_IsGray

Set by OP_D2F on completion if the input image is not 24-bits-per-pixel and the input image color table consists entirely of shades of gray.

PF_MultiImage

For TIFF output, if set, then this TIFF output image is to be appended to an existing TIFF file to create or add to a multi-image TIFF file. The existing TIFF file is input to OP_D2F using the Put queue (see also RES_PUTQ_GET_NEED_DATA).

For GIF output, if set, then multiple input GIF images are combined into a single output file.

PF_OptimizeHuff

If set, and JPEG compression is selected for the TIFF output file (Compression is 6 or 7), then optimized Huffman codes will be used. If clear, ISO standard Huffman codes will be used.

PF_ApplyTransparency

If set, the GIF output image will have the transparent color specified by TransparentColorIndex.

PF_UserInput

If set, the GIF output image displayer will expect user input before continuing processing of data.

PF_WidthPadKnown

If set, the value specified in WidthPad will override the DIB padding in an output GIF image.

PF_YieldGet

If set, OP_D2F will periodically return RES_GET_DATA_YIELD as it packs the image.

PicFlags2

Flags that control the OP_D2F operation.

Value

Meaning

PF2_MakeCorrectTiffJPEG

If set, and JPEG compression is selected for the TIFF output file (Compression is 6 or 7), then the output image will conform to the TIFF specification.

PF2_OmitGIFTrailer

Should be set for all frames except the last frame of a multi-image GIF.

PF2_LocalGIFColors

If set, input colors are written to output as a local color table.

PF2_RGBAIsPremultiplied

If set, RGB values in the get queue are premultiplied by alpha.

PF2_UseAlphaMask

If set, then MaskBuffer must point to a mask with which to blend.

PF2_InputJPEG If set, then the Get queue contains a JPEG-compressed image to insert, unaltered, into the TIFF output image. All input data must be present in the Get queue before REQ_EXEC. The output ImageType must be set to BI_TIF.

AllocType

If non-zero, all input data must be present in the Get queue before REQ_EXEC. OP_D2F may advance the Get.Front pointer as it processes the input data. If so, the input data preceding Get.Front should not be considered to have been consumed by OP_D2F and that data must not be modified. Even though the entire input image is present, OP_D2F may issue RES_SEEK events. If so, these events can be handled as:

 
Copy Code

case RES_SEEK:

     if ( ( PicParm.SeekInfo & SEEK_FILE ) == 0 )

       {

       PicParm.Get.Front =

         PicParm.Get.Start +

         ( PicParm.SeekInfo & SEEK_OFFSET );

       }

     else

       {

       /* if the Put queue is also large enough to hold

              the entire output image */

       PicParm.Put.Front = PicParm.Put.Rear =

         PicParm.Put.Start +

         ( PicParm.SeekInfo & SEEK_OFFSET );

       }

     break;

If AllocType is 0, then a smaller input queue may be used which does not contain all the input image data. In that case, OP_D2F may issue RES_SEEK events to access non-sequential locations in the input image. Assuming that the input image data resides in an open file, these RES_SEEK events might be handled as:

 
Copy Code

case RES_SEEK:

     if ( ( PicParm.SeekInfo & SEEK_FILE ) == 0 )

       {

       PicParm.Get.Front = PicParm.Get.Rear =

         PicParm.Get.Start;

       lseek(infile, PicParm.SeekInfo & SEEK_OFFSET, 0);

       }

     else

       {

       /* if the Put queue is also too small to hold

            entire output image */

       PicParm.Put.Front = PicParm.Put.Rear =

         PicParm.Put.Start;

       lseek(outfile, PicParm.SeekInfo & SEEK_OFFSET, 0);

       }

     break;

AuxSize

The total length of all chunks pointed to by AuxSpace.

ImageType

Specifies the desired type of output file to create.

Value

Meaning

BI_RGB

BMP

BI_BMPR

BMP RLE compressed

BI_DCX

DCX multi-image

BI_GIFI

GIF interlaced

BI_GIFN

GIF non-interlaced

BI_ICON

Icon image

BI_PBM

Portable Bit Map (1 bpp)

BI_PCX

PCX

BI_PDF

PDF wrapper around G4 image

BI_PGM

Portable Bit Map (up to 8bpp, gray)

BI_PNM

Portable Anymap

BI_PPM

Portable Bit Map (24bpp, RGB)

BI_TIF

TIFF

BI_TGA

Targa

BI_WBMP  Wireless Bit Map

Compression (TIFF output only)

Compression allows the TIFF output image to use one of several of compression algorithms.

Value

Meaning

0

Uncompressed

1

Uncompressed

2

Modified G3

3

G3

4

G4

5

LZW

6

JPEG (old style)

7

JPEG (new style)

8

Deflate (ZLIB)

32946

Deflate (ZLIB)

32773

Packbits

Dimension (TIFF output only)

If G3 compression is selected (Compression is 3), the compression will be 2-D if Dimension is 2, otherwise it will be 1-D.

PNG_Progressive

PNG_Filter

These fields are not currently used and must be set to 0.

ApplyAux

Non-zero to apply any data pointed to by AuxSpace.

OutBpp

If ImageType is BI_TGA, and the input image is 24 bits-per-pixel, then OutBpp may be 16 or 24 to specify the Targa output image bits-per-pixel. In all other cases, OutBpp is ignored.

Expansion1 (TIFF output only)

Byte ordering:

  • D2F.Expansion1[3] == 0 for Intel byte ordering.
  • D2F.Expansion1[3] != 0 for Motorola byte ordering.

CMYK output (32 bits-per-pixel input image only):

  • D2F.Expansion1[0] == 0 for CMYK output.
    • D2F.Expansion1[1] == DotRange[0].
    • D2F.Expansion1[2] == DotRange[1].
  • D2F.Expansion1[0] == 1 for K output only from CMYK input.
  • D2F.Expansion1[0] >= 2 not CMYK output.

Expansion2 (TIFF output only)

X/Y resolution tags:

  • D2F.Expansion2[0] == 0 if no X/Y resolution tags are to be output.
  • D2F.Expansion2[0] == 1 if X/Y resolution tags are to be output in inches.
  • D2F.Expansion2[0] == 2 if X/Y resolution tags are to be output in centimeters.

MultiImageSize (TIFF output only)

If PF_MultiImage is set in PicFlags, then MultiImageSize can be set to the size of the existing TIFF file to which this output image is to be appended. This is an optimization which relieves OP_D2F of having to determine the existing TIFF file size by reading to the end of the existing file.

TransparentColorIndex (GIF output only)

If PF_ApplyTransparency is set in PicFlags, then a GIF89a Graphics Extension block is output using this value for the transparent color index.

NegateImage (TIFF output only)

If NegateImage is not 0 for a TIFF output image compressed with G3 or G4, then the negative of the input image is saved. Otherwise, the input color with the greater luminance is saved as white and the other input color is saved as black.

Predictor (TIFF output only)

If LZW or Deflate compression is selected (Compression is 5 or 8, respectively), TIFF horizontal differencing will be used if Predictor is 2, otherwise there will be no prediction.

LumFactor (TIFF output only)

If JPEG compression is selected (Compression is 6 or 7), LumFactor should specify the luminance compression factor between 0 and 255.

ChromFactor (TIFF output only)

If JPEG compression is selected (Compression is 6 or 7), ChromFactor should specify the luminance compression factor between 0 and 255.

SubSampling (TIFF output only)

If JPEG compression is selected (Compression is 6 or 7), SubSampling should specify the subsampling method.

Value

Meaning

0

111

1

211

2

411

3

211v

DisposalMethod (GIF output only)

DisposalMethod will be output within a GIF89a Graphics Extension block to indicate what should occur after the graphic is displayed.

RowsPerStrip (TIFF output only)

If not zero, RowsPerStrip will be the number of rows per strip.

DelayTime (GIF output only)

DelayTime will be output within a GIF89a Graphics Extension block specifying the time (in hundredths of a second) to wait before continuing processing the data stream, between 0 and 65535.

BackgroundColor (GIF output only)

BackgroundColor specifies the background color index.

AspectRatio (GIF output only)

If not zero, AspectRatio is a value specifying the a pixel aspect ratio related to actual pixel aspect ratio by

                PixelAspectRatio = PixelWidth/PixelHeight = (AspectRatio+ 15) / 64

WidthPad (GIF output only)

If PF_WidthPadKnown is set in PicFlags, the WidthPad will be the byte width of one row, overriding DIB padding.

LogicalScreenWidth (GIF output only)

If not zero, LogicalScreenWidth will be the logical screen width placed into the GIF header.

LogicalScreenHeight (GIF output only)

If not zero, LogicalScreenHeight will be the logical screen height placed into the GIF header.

ImageLeftPosition (GIF output only)

ImageLeftPosition will be image left position (column number of left edge of the image) placed into the GIF image descriptor, with 0 being the left-most column.

ImageTopPosition (GIF output only)

ImageTopPosition will be image top position (row number of top edge of the image) placed into the GIF image descriptor, with 0 being the top-most row.

YieldEvery

If PF_YieldGet is set in PicFlags, then OP_D2F returns a RES_PUT_DATA_YIELD response after every YieldEvery lines have been output to the Put queue.

IFDOffset (TIFF output only)

IFDOffset is set by OP_D2F to the file offset of the TIFF IFD written.

InsertAfterIFDOffset (TIFF output only)

InsertAfterIFDOffset should be set to the file offset of the start of the IFD after which the new image should be inserted. If the value is TIFF_INSERT_AS_FIRST, the image will be inserted as the first in the file. If the value is TIFF_INSERT_AS_LAST, the image will be appended to the file.

TIFFFirstByte (TIFF output only)

When adding a new image to an existing TIFF file, TIFFFirstByte may be set to the first byte of the file (either 'I' or 'M' for little- or big-endian byte order) for more efficient operation.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback