LBitmapBase::Allocate

#include "ltwrappr.h"

virtual L_INT LBitmapBase::Allocate(nMemoryType=TYPE_CONV)

L_INT nMemoryType;

/* type of memory */

Allocates memory for the bitmap data.

Parameter

Description

nMemoryType

The type of memory to be used when allocating memory for the bitmap data. Possible values are:

 

Value

Meaning

 

TYPE_CONV

[0x0001] Use conventional memory if the image will fit, otherwise swap to disk.

 

TYPE_USER

[0x0002] Create a bitmap where the user maintains the data pointer.

 

TYPE_TILED

[0x0004] Create tiled bitmaps.

 

TYPE_NOTILED

[0x0008] Do not create tiled bitmaps, even if the conventional memory has failed.

 

TYPE_DISK

[0x0080] Do not use conventional memory. Swap to disk only.

 

TYPE_NODISK

[0x0100] Do not swap to disk using LEAD's virtual memory. Windows virtual memory is not affected.

 

TYPE_COMPRESSED

[0x0200] (Document/Medical only) Allocate an RLE-compressed bitmap. This flag can be used with TYPE_CONV or TYPE_NODISK. For more information, refer to Speeding Up 1-Bit Documents.

 

TYPE_SUPERCOMPRESSED

[0x0400] (Document/Medical only) Keep images compressed in memory. This option causes slow access, but very low memory usage. This option is available only for 1-bit, 8-bit grayscale and 24-bit images.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The amount of memory allocated depends on the size of the image indicated in the internal bitmap handle (Width, Height, and BitsPerPixel). LBitmapBase::Initialize must be called prior to calling this function.

This is a low-level function that is used only when you create a bitmap from scratch using LBitmapBase::Initialize. Normally, the functions that load or create a bitmap allocate the required memory for you. (In that case, calling Allocate() causes your application to lose memory.)

Required DLLs and Libraries

LTDIS
LTFIL

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

See Also

Functions:

LBitmapBase::Free, LBitmapBase::Create, LBitmapBase::Initialize, Class Members

Topics:

Raster Image Functions: Creating and Deleting Images

Example

L_INT LBitmapBase__AllocateExample()
{
   L_INT nRet;
   LBitmapBase MyBitmap;
   nRet =MyBitmap.Initialize(100,200,24);
   if(nRet !=SUCCESS)
      return nRet;
   nRet =MyBitmap.Allocate(TYPE_CONV);
   if(nRet !=SUCCESS)
      return nRet;
   if(MyBitmap.IsAllocated())
      nRet = MyBitmap.Free();
   return nRet;
}