Draws the specified vector into the specified LEAD bitmap handle.
#include "ltwrappr.h"
virtual L_INT LVectorBase::Realize(pBitmap, bEraseBkgnd=TRUE)
virtual L_INT LVectorBase::Realize(&BitmapBase, bEraseBkgnd=TRUE)
Pointer to a bitmap handle, into which the vector will be drawn.
Pointer to an LBitmapBase object that references the vector to be drawn into pBitmap.
Flag that indicates whether or not to erase the background rectangle when realizing the vector to the bitmap. Possible values are:
Value | Meaning |
---|---|
TRUE | The background rectangle will be erased when the vector image is realized to the bitmap. |
FALSE | The background rectangle will not be erased. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function draws the specified vector into the specified bitmap handle.
The bitmap handle should be allocated before calling this function.
If hDC is NULL, this function will assume that the vector is already attached to a window, and will draw it to the window DC.
The background color used to erase the rectangle where the vector image is to be rendered can be set with LVectorBase::SetBackgroundColor.
This function will use the current camera and current view port of the vector handle to do the necessary projection onto the surface of the DC.
// This is an example for LVectorBase::Realize(pBitmap, bEraseBkgnd=TRUE)
//LVectorBase::Realize( pBITMAPHANDLE pBitmap, L_BOOL bEraseBkgnd = TRUE);
L_INT LVectorBase__RealizeExample_1(HWND hWnd)
{
L_INT nRet;
BITMAPHANDLE bitmapHandle;
RECT rect;
LVectorBase Vector;
nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
if(nRet != SUCCESS)
return nRet;
nRet = Vector.AttachToWindow(hWnd);
if(nRet != SUCCESS)
return nRet;
L_WRPINITBITMAP(&bitmapHandle, sizeof(BITMAPHANDLE), 400,400,24);
L_WRPALLOCATEBITMAP(&bitmapHandle, TYPE_CONV);
GetClientRect(hWnd, &rect);
nRet = Vector.SetViewport(&rect);
if(nRet != SUCCESS)
return nRet;
nRet = Vector.Realize(&bitmapHandle,TRUE);
if(nRet != SUCCESS)
return nRet;
L_WRPSAVEBITMAP(MAKE_IMAGE_PATH(TEXT("erase.cmp")), &bitmapHandle, FILE_CMP, 24, 2, NULL);
return SUCCESS;
}
// This is an example for LVectorBase::Realize(&BitmapBase, bEraseBkgnd=TRUE):
//Example22
L_INT LVectorBase__RealizeExample_2(HWND hWnd)
{
L_INT nRet;
RECT rect;
LBitmapBase BitmapBase(400,400,24);
LVectorBase Vector;
nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
if(nRet != SUCCESS)
return nRet;
nRet = Vector.AttachToWindow(hWnd);
if(nRet != SUCCESS)
return nRet;
GetClientRect(hWnd, &rect);
nRet = Vector.SetViewport(&rect);
if(nRet != SUCCESS)
return nRet;
nRet = Vector.Realize(BitmapBase,TRUE);
if(nRet != SUCCESS)
return nRet;
BitmapBase.SetFileName(MAKE_IMAGE_PATH(TEXT("erase.cmp")));
if(nRet != SUCCESS)
return nRet;
nRet = BitmapBase.Save(FILE_CMP,24,2,NULL);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}