#include "ltwrappr.h"
LBitmapBase::LBitmapBase()
LBitmapBase::LBitmapBase(uWidth, uHeight, uBitsPerPixel=24, uOrder=ORDER_BGR, pPalette=NULL, uViewPerspective=TOP_LEFT, crFill=0, uMemory=TYPE_CONV, pData=NULL, dwSize=0)
LBitmapBase::LBitmapBase(pInfo, pBits)
LBitmapBase::LBitmapBase(hDC, hBitmap, hPalette)
LBitmapBase::LBitmapBase(pBitmapHandle)
L_UINT uWidth; |
initial bitmap width |
L_UINT uHeight; |
initial bitmap height |
L_UINT uBitsPerPixel; |
the number of bits per pixel |
L_UINT uOrder; |
color order |
LPRGBQUAD pPalette; |
pointer to a palette |
L_UINT uViewPerspective; |
bitmaps view perspective |
COLORREF crFill; |
fill color value |
L_UINT uMemory; |
type of memory |
BITMAPINFO * pInfo; |
pointer to a bitmap info structure |
L_UCHAR * pBits; |
pointer to the bitmap data |
HDC hDC; |
handle to a windows DC |
HBITMAP hBitmap; |
handle to a device dependent bitmap |
HPALETTE hPalette; |
handle of the palette |
pBITMAPHANDLE pBitmapHandle; |
pointer to a LEAD bitmap handle |
L_UCHAR *pData; |
data pointer |
L_UINT32 dwSize; |
size of the data buffer pointed to by pData |
Constructs and initializes the member variables of the class object.
Parameter | Description | |
uWidth | The desired initial bitmap width. | |
uHeight | The desired initial bitmap height. | |
uBitsPerPixel | The number of bits per pixel. Valid values are 0, 1, 4, 8, 12, 16, 24, and 32. Use 0 to create an 8-bit grayscale bitmap. If uBitsPerPixel is 0, the function ignores the uOrder and pPalette parameters. | |
uOrder | Color order for 16-, 24-, and 32-bit bitmaps. If the resultant bitmap is less than 16 bits per pixel, this will have no effect since palletized images have no order. Possible values are: | |
Value | Meaning | |
ORDER_RGB | [0] Red, green, and blue color order in memory | |
ORDER_BGR | [1] Blue, green, and red color order in memory | |
ORDER_GRAY | [2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical toolkits. | |
ORDER_RGBORGRAY | [3] Load the image as red, green, blue OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only. | |
ORDER_BGRORGRAY | [4] Load the image as blue, green, red OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only. | |
pPalette | Pointer to the palette that the bitmap will use. You can specify your own palette, or use NULL to use LEAD's fixed palette. | |
uViewPerspective | The desired view perspective for the bitmap. Possible values are: | |
Value | Meaning | |
TOP_LEFT | [0] Top-left of image is first in memory. | |
BOTTOM_LEFT | [2] Bottom-left of image is first in memory. | |
RIGHT_TOP | [4] (Document/Medical only) First row is the right side, first column is top side. | |
TOP_LEFT90 | [4] (Document/Medical only) Same as RIGHT_TOP, which is TOP_LEFT rotated clockwise by 90 degrees. | |
LEFT_BOTTOM | [8] (Document/Medical only) First row is the left side, first column is top side. | |
TOP_LEFT270 | [8] (Document/Medical only) Same as LEFT_BOTTOM, which is TOP_LEFT rotated clockwise by 270 degrees. | |
crFill | The color value to use to fill the bitmap after creating it. |
uMemory | Flag that indicates the type of memory to allocate. Possible values are: | |
Value | Meaning | |
TYPE_CONV | [0x0001] Use conventional memory if the image will fit, otherwise swap to disk. | |
TYPE_COMPRESSED | [0x0200] (Document/Medical only) Allocate an RLE-compressed bitmap. You can use this flag 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. | |
pInfo | Pointer to a BITMAPINFO structure that describes the bitmap data. | |
pBits | Pointer to the bitmap data to be used in initializing the bitmap. | |
hDC | Handle to a windows DC. | |
hBitmap | Handle to a device dependent bitmap (DDB) of type HBITMAP. | |
hPalette | Handle of the palette to be used for the bitmap or NULL if the bitmap does not have a palette. | |
pBitmapHandle | Pointer to a LEAD bitmap handle that describes an allocated bitmap. | |
pData | Data pointer that will contain the bitmap data when uMemory is TYPE_USER. If pData is NULL, the data pointer must be passed later, by calling LBitmapBase::SetDataPointer, before the bitmap can be used. | |
dwSize | Size of the data buffer pointed to by pData. This should be at least pBitmap->Size. This parameter is only valid when uMemory is set to TYPE_USER. |
None.
These are the constructors for the LBitmapBase class. They construct and initialize the member variables of the class object.
LBitmapBase::LBitmapBase(void) will initialize the bitmap width, height, and bits per pixel to 0.
LBitmapBase::LBitmapBase(uWidth, uHeight, uBitsPerPixel, uOrder, pPalette, uViewPerspective, crFill, uMemory) constructs an LBitmapBase object and allocates a bitmap with the desired width, height, bits per pixel, color order, view perspective and memory type. You can check for successful allocation by calling the LBitmapBase::IsAllocated() member function. Even if the allocation fails, the class object is still constructed.
LBitmapBase::LBitmapBase(pInfo, pBits) constructs an LBitmapBase object and allocates a bitmap using the passed bitmap info and data (DIB). You can check for successful allocation by calling the LBitmapBase::IsAllocated() member function. Even if the allocation fails, the class object is still constructed.
LBitmapBase::LBitmapBase(hDC, hBitmap, hPalette) constructs an LBitmapBase object and allocates a bitmap using the passed hBitmap (DDB). You can check for successful allocation by calling the LBitmapBase::IsAllocated() member function. Even if the allocation fails, the class object is still constructed.
LBitmapBase::LBitmapBase(pBitmapHandle) constructs an LBitmapBase object and allocates a bitmap from another LEAD bitmap handle. You can check for successful allocation by calling the LBitmapBase::IsAllocated() member function. Even if the allocation fails, the class object is still constructed.
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
LBitmapBase::~LBitmapBase, LBitmapBase::IsAllocated, Class Members |
Topics: |
This is the example for LBitmapBase::LBitmapBase():
// this will call the default constructor and destructor when it is out of scope
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapBase__LBitmapBaseFirstExample()
{
LBitmapBase MyBitmap;
return SUCCESS;
}
/*This is the example for LBitmapBase::LBitmapBase(uWidth, uHeight, uBitsPerPixel, uOrde, pPalette, uViewPerspective, crFill, uMemory, pData, dwSize):*/
L_INT LBitmapBase__LBitmapBaseSecondExample()
{
LBitmapBase MyBitmap(100, 200, 24, ORDER_BGR, NULL, TOP_LEFT, 0, TYPE_CONV);
if(MyBitmap.IsAllocated())
{
// Do something.
}
return SUCCESS;
}
/*This is the example for LBitmapBase::LBitmapBase(pInfo, pBits):*/
L_INT LBitmapBase__LBitmapBaseThirdExample()
{
LBitmapBase TmpBitmap;
HGLOBAL hDIB;
BITMAPINFO *pInfo;
L_UCHAR *pBits;
L_INT nColorData;
L_INT nRet;
// Load a bitmap at 8 bits per pixel so that we can demonstrate palette handling
nRet =TmpBitmap.Load (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 8, ORDER_BGR);
if(nRet !=SUCCESS)
return nRet;
hDIB = TmpBitmap.ConvertToDIB(DIB_BITMAPV5HEADER);
pInfo = (BITMAPINFO *) GlobalLock( hDIB );
if(pInfo->bmiHeader.biBitCount <= 8)
nColorData = 1 << pInfo->bmiHeader.biBitCount;
else
nColorData = 0;
pBits = (L_UCHAR *) pInfo + sizeof(BITMAPINFOHEADER) + (nColorData * sizeof(RGBQUAD));
LBitmapBase MyBitmap(pInfo, pBits);
GlobalUnlock(hDIB) ;
GlobalFree(hDIB);
nRet =TmpBitmap.Free();
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
/*This is the example for LBitmapBase::LBitmapBase(hDC, hBitmap, hPalette):*/
L_INT LBitmapBase__LBitmapBaseForthExample(HINSTANCE hAppInstance)
{
HBITMAP hBitmap=LoadBitmap(hAppInstance,MAKE_IMAGE_PATH(TEXT("ULAY1.BMP")));
HDC hDC=GetDC(0);
LBitmapBase MyBitmap(hDC, hBitmap, 0);
ReleaseDC(0,hDC);
return SUCCESS;
}
/*This is the example for LBitmapBase::LBitmapBase(pBitmapHandle):*/
L_INT LBitmapBase__LBitmapBaseFifthExample()
{
L_INT nRet;
BITMAPHANDLE hBitmap;
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("image1.cmp")), &hBitmap,sizeof(hBitmap), 0, ORDER_RGB,NULL,NULL);
if(nRet !=SUCCESS)
return nRet;
LBitmapBase MyBitmap(&hBitmap);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET