L_AddPageNumbersToBitmapList

#include "l_bitmap.h"

L_LTEFX_API L_INT L_AddPageNumbersToBitmapList(hBitmapList, pBitmap, pOptions, uFlags)

HBITMAPLIST hBitmapList;

handle to a bitmap list

pBITMAPHANDLE pBitmap;

pointer to a bitmap handle

pPAGENUMBEROPTIONS pOptions;

pointer to a structure

L_UINT32 uFlags;

flags

Applies page numbering to the bitmaps in a bitmap list.

Parameter

Description

hBitmapList Handle to the list of bitmaps that are having page numbers added.
pBitmap Pointer to the bitmap handle that will have page number added.
pOptions Pointer to a PAGENUMBEROPTIONS structure that contains font and formatting information for the page numbers.
uFlags Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Adds page numbers to the bitmaps contained within a bitmaplist or to a specified bitmap. The affected pixels are permanently changed. Either hBitmapList or pBitmap must not be NULL but not both, if both are null, function will fail and return an error.

Note:

For WIN32 applications, this function ensures that the bitmap's view perspective is BOTTOM_LEFT, flipping the bitmap if necessary. This can affect functions that use bitmap coordinates. For more information, refer to Accounting for View Perspective.

If a region is defined for the bitmap, GDI functions act only on the region, not on the entire bitmap.

The DIB driver supports only 1, 4, 8, 16, 24 and 32 bit images. If you are using an image that has some other number of bits per pixel, you must use L_ColorResBitmap to change the image to a bits per pixel value supported by the DIB driver.

Required DLLs and Libraries

LTEFX

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

Win32, x64, Linux.

See Also

Functions:

L_LoadBitmapList, L_SaveBitmapList,

 

L_DestroyBitmapList, L_GetBitmapListCount,

 

L_CopyBitmapListItems, L_InsertBitmapListItem,

 

L_RemoveBitmapListItem, L_DeleteBitmapListItems,

 

L_GetBitmapListItem, L_SetBitmapListItem,

 

L_ColorResBitmapList, L_TranslateBitmapColor,

 

L_CreateBitmapList

Topics:

Raster Image Functions: Playing Animated Images

 

Raster Image Functions: Creating and Maintaining Lists of Images

 

Implementing Animation

Example

This example loads a bitmaplist and numbers all of the pages.

L_INT AddPageNumbersToBitmapListExample(L_VOID) 
{ 
   L_INT nRet; 
   HBITMAPLIST hList; 
   FILEINFO fInfo; 
   LOADFILEOPTION oOption; 
   L_TCHAR* pszInputFile; 
   L_TCHAR* pszOutputFile; 
   PAGENUMBEROPTIONS oNumOptions; 
 
   pszInputFile = MAKE_IMAGE_PATH(TEXT("Leadtools.pdf")); 
   pszOutputFile = MAKE_IMAGE_PATH(TEXT("LeadtoolsNumbered.tif")); 
 
   // Get the file info for the image, as well as the total number of pages to load. 
   nRet = L_FileInfo(pszInputFile, &fInfo, sizeof(FILEINFO), FILEINFO_TOTALPAGES, NULL); 
   if (nRet != SUCCESS)     
      return nRet;    
 
   nRet = L_GetDefaultLoadFileOption(&oOption, sizeof(LOADFILEOPTION)); 
   if (nRet != SUCCESS)        
      return nRet;    
 
   // Load the image into the bitmaplist. 
   nRet = L_LoadBitmapList(pszInputFile, &hList, 0, ORDER_BGR, &oOption, &fInfo); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   // Set the options for numbering the pages. 
   oNumOptions.pszPageFormat = NULL; // Show the total number of pages (i.e. Page 1 of 5). 
   oNumOptions.nLocation = PAGENUMBERLOCATION_TOPRIGHT; // Set the location of the page numbering. 
   oNumOptions.nPadding[0] = 0; // Distance from the top/bottom of the page. 
   oNumOptions.nPadding[1] = 0; // Distance from the side of the page. 
   // Create the font for the page numbering. 
   oNumOptions.hFont = CreateFont(24, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, TEXT("Arial"));  
   oNumOptions.crFontColor = RGB(255, 0, 0); 
   oNumOptions.uStartPageNumber = 0; 
   oNumOptions.uPageCount = 0; 
 
   // Add the page numbers to the images in the bitmaplist. 
   nRet = L_AddPageNumbersToBitmapList(hList, NULL, &oNumOptions, 0); 
   if (nRet != SUCCESS) 
   { 
      // Clean up. 
      DeleteObject(oNumOptions.hFont); 
      L_DestroyBitmapList(hList); 
      return nRet; 
   } 
 
   // Save the resulting numbered images to a file. 
   nRet = L_SaveBitmapList(pszOutputFile, hList, FILE_TIF, 24, 0, NULL); 
   if (nRet != SUCCESS) 
   { 
      // Clean up. 
      DeleteObject(oNumOptions.hFont); 
      L_DestroyBitmapList(hList); 
      return nRet; 
   } 
 
   // Clean up. 
   DeleteObject(oNumOptions.hFont); 
   L_DestroyBitmapList(hList); 
 
   return SUCCESS; 
} 

Help Version 20.0.2018.2.25
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help