LVectorBase::Realize

#include "ltwrappr.h"

virtual L_INT LVectorBase::Realize(pBitmap, bEraseBkgnd=TRUE)

virtual L_INT LVectorBase::Realize(&BitmapBase, bEraseBkgnd=TRUE)

pBITMAPHANDLE pBitmap;

/* pointer to a bitmap handle */

LBitmapBase &BitmapBase;

/* pointer to an LBitmapBase object */

L_BOOL bEraseBkgnd;

/* flag that indicates whether to erase the background */

Draws the specified vector into the specified LEAD bitmap handle.

Parameter

Description

pBitmap

Pointer to a bitmap handle, into which the vector will be drawn.

BitmapBase

Pointer to an LBitmapBase object that references the vector to be drawn into pBitmap.

bEraseBkgnd

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LVKRN

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:

LVectorBase::Paint, LVectorBase::AttachToWindow, LVectorBase::SetCamera, LVectorBase::SetViewport, LVectorBase::SetBackgroundColor

Topics:

Vector Images: Realizing a Vector to a Bitmap

Example

// 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(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 16\\Images\\test.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(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 16\\Images\\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(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 16\\Images\\test.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(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 16\\Images\\erase.cmp"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = BitmapBase.Save(FILE_CMP,24,2,NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}