L_ChangeBitmapHeight

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ChangeBitmapHeight(pBitmap, nHeight)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nHeight;

/* new height in pixels */

Increases or decreases the allocated height of a bitmap. You can use this function in a callback routine to adjust the allocation when loading an image of unknown height.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be adjusted.

nHeight

New height in pixels.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function updates the fields in the bitmap handle to reflect the change.

Required DLLs and Libraries

LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_StartFeedLoad, L_FeedLoad, L_StopFeedLoad

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Redirecting Input and Output

 

Raster Image Functions: Input and Output

 

Loading and Saving Images

Example

/* This FILEREADCALLBACK example uses L_ChangeBitmapHeight to ensure that the
final bitmap height is the same as the total number of loaded lines. 
This can be especially useful when you are loading fax files and you don’t know how many 
lines are in the file. Normally, you know the width of the raw fax files but not the height. So 
you can start by allocating a small bitmap and increase its height while decoding the file. */
L_UINT TotalLines; /* Total number of loaded lines */
L_INT L_EXPORT EXT_CALLBACK LoadImageCB( pFILEINFO pFileInfo, pBITMAPHANDLE pBitmap,
              L_UCHAR L_FAR *pBuffer,
              L_UINT uFlags, L_INT nRow, L_INT nLines, IMAGECBPARM L_FAR* pUserData )
{
   UNREFERENCED_PARAMETER(pFileInfo);
   UNREFERENCED_PARAMETER(pBuffer);
   UNREFERENCED_PARAMETER(uFlags);
   UNREFERENCED_PARAMETER(nRow);
   UNREFERENCED_PARAMETER(pUserData);
   /* Increment the current row by the number of lines in the buffer */
   TotalLines += nLines;
   /* Set the bitmap height to the total number of lines */
   L_AccessBitmap(pBitmap);
   if( TotalLines > (L_UINT)pBitmap->Height )
   {
      L_ReleaseBitmap(pBitmap);
      L_ChangeBitmapHeight(pBitmap, TotalLines );
      L_AccessBitmap(pBitmap);
   }
   L_PutBitmapRow(pBitmap, pBuffer, nRow, pBitmap->BytesPerLine * nLines);
   L_ReleaseBitmap(pBitmap);
   return( SUCCESS );
}