LBitmap::GetOverlay

#include "ltwrappr.h"

virtual L_INT LBitmap::GetOverlay(nIndex, pOverlayBitmap, uStructSize, uFlags)

virtual L_INT LBitmap::GetOverlay(nIndex, pBitmap, uStructSize, uFlags)

L_INT nIndex;

/* the overlay index */

pBITMAPHANDLE pOverlayBitmap;

/* pointer to the overlay bitmap handle */

L_UINT uStructSize;

/* the size of the BITMAPHANDLE structure */

L_UINT uFlags;

/* flags that determine setting options */

LBitmapBase* pBitmap;

/* pointer to the overlay bitmap Object */

Gets the overlay bitmap for a certain index.

Parameter

Description

nIndex

The index of the overlay being retrieved. This index is zero-based.

pOverlayBitmap

Pointer to the overlay bitmap handle which will be filled with the new overlay bitmap. Cannot be NULL.

uStructSize

Size of the BITMAPHANDLE structure pointed to by pOverlayBitmap. Pass sizeof(BITMAPHANDLE).

uFlags

Flags that determine retrieving options. Values cannot be combined. Possible values are:

 

Value

Meaning

 

OVERLAY_COPY

[0x0000] Retrieve a copy of the overlay bitmap from the overlay list.

 

OVERLAY_NOCOPY

[0x0001] Retrieve the actual overlay bitmap. No copy is made. You should be careful when modifying the overlay bitmap because you can modify/invalidate the entry in the overlay bitmap list.

 

OVERLAY_MOVE

[0x0003] Retrieve the actual overlay bitmap, and also remove the bitmap from the overlay list. This is recommended over OVERLAY_NOCOPY.

pBitmap

Pointer to the overlay bitmap object which will be filled with the new overlay bitmap. Cannot be NULL.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will get the overlay bitmap. You can get a copy of the overlay bitmap (OVERLAY_COPY) or you can get the bitmap without making a copy (OVERLAY_NOCOPY or OVERLAY_MOVE).

The quickest way to get the overlay bitmap is to avoid making a copy. See the comments from LBitmap::SetOverlay for more information about how to use OVERLAY_NOCOPY.

If you use OVERLAY_MOVE, the overlay bitmap from the corresponding index will be invalidated.

pOverlayBitmap is assumed to be unallocated an uninitialized. It will be filled without freeing the existing data.

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

Win32, x64.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, Class Members

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Resizing Considerations, Overlay Overview

Example

This example will get the overlay bitmaps and save them to separate files.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmap__GetOverlayExample(HWND hWnd, LBitmap *plBitmap) 
{
   L_INT nRet; 
   LBitmap OverlayBitmap; 
   L_INT    i; 
   L_TCHAR   s[100]; 
   for(i = 0; i < MAX_OVERLAYS; i++)
   {
      // note that I am using OVERLAY_NOCOPY, so I should not free the overlay bitmap! 
      nRet = plBitmap->GetOverlay(i, &OverlayBitmap, sizeof(BITMAPHANDLE), OVERLAY_NOCOPY); 
      if(nRet == SUCCESS) 
      {
         wsprintf(s,MAKE_IMAGE_PATH(TEXT("overlay%d_copy.cmp")), i); 
         nRet = OverlayBitmap.Save(s , FILE_LEAD1BIT, 1, 1, NULL); 
         if(nRet != SUCCESS) 
            MessageBox(hWnd, TEXT("Error saving file!"), s, MB_OK); 
      }
      else
         return nRet;
   }
   return SUCCESS;
}