EncodeCcittImageTo

#include "BITIFF.H"

 

BOOL CALLBACK EncodeCcittImageTo( int                  nFile,
                                                                       UINT             wWidth,
                                                                       UINT             wHeight,
                                                                       int                  nFillOrder,
                                                                       UINT             wByteOrder,
                                                                       DWORD       dwCompression,
                                                                       INT_PTR      lUserData,
                                                                       FILLPROC   lpLineFn)

Description

Encodes a monochrome image into a file. The user can set byte order to Intel or Motorola type, and the byte fill order. The raw image data must be passed to the function through the user defined callback function line by line. The file pointer must be positioned before calling this function. The function supports all the standard CCITT compression types and can create uncompressed monochrome images as well.

Parameters

int

nFile

Image file handle.

UINT

wWidth

Width of the image in pixels.

UINT

wHeight

Height of the image in pixels.

int

nFillOrder

The byte fill order.

UINT

wByteOrder

The byte order.

DWORD

dwCompression

Compression type. The low order word contains the main type and the high order word contains the additional info.

INT_PTR

lUserData

User defined info. It is passed to the callback function as a third parameter unchanged.

FILLPROC

lpLineFn

Callback function that will pass the raw DIB lines to the function.

Return values

TRUE on success, FALSE if failed. It sets the error flag to TUNKNOWNCOMPRESSION if the compression type of the image is not supported, or to TCOMPRESSIONFAILED if the compression has failed.

 Programming notes

The wByteOrder field may be either LH_BYTE_ORDER or HL_BYTE_ORDER. LH_BYTE_ORDER means that byte order is always from least significant to most significant, for both 16-bit and 32-bit integers. HL_BYTE_ORDER means that byte order is always from most significant to least significant. LH_BYTE_ORDER is used by computers with Intel processors (IBM compatible computers). HL_BYTE_ORDER is used with computers with Motorola processors (Macintosh computers).

Bit order defines in the "BITIFF.H" file:        NORM_BIT_ORDER // default

                                                                        REV_BIT_ORDER

 

Byte order defines in the "BITIFF.H" file:     LH_BYTE_ORDER              // default

                                                                        HL_BYTE_ORDER

Requirements

Header :     Declared in BiTiff.h; include BiTiff.h.

Library :    Use BiTIFF.lib.

DLLs :       BiTiff.dll.

References to related functions

See EncodeTiffImage(), EncodeCcittImage() and DecodeCcittImageFrom().

Code example

See example at DecodeCcittImage().