I changed the code to get it working. Here's the modified version:
LBase::LoadLibraries(LV_KRN);
int iRet;
RECT rect;
rect.top = rect.left = 0;
rect.right = rect.bottom = 400;
if( LSettings::IsSupportLocked(L_SUPPORT_VECTOR) )
printf("Vector support is locked!!\n");
LVectorBase Vector;
Vector.SetViewport(&rect);
VECTORPOINT point1={0,0,0,0}, point2={400,400,0,0};
Vector.SetParallelogram(&point1, &point2);
VECTORLAYERDESC VectorLayerDesc={0};
VectorLayerDesc.nSize = sizeof(VECTORLAYERDESC);
lstrcpy(VectorLayerDesc.szName, TEXT("First Layer"));
VectorLayerDesc.bVisible = TRUE;
VectorLayerDesc.bLocked = FALSE;
VectorLayerDesc.dwTag = 0;
LVectorLayer layer(&VectorLayerDesc);
// add layer
iRet = Vector.AddLayer(&layer);
if( iRet != 1 )
printf("Error adding layer error[%i]\n", iRet);
iRet = Vector.SetActiveLayer(&layer);
if( iRet != 1 )
printf("Error setting active layer error[%i]\n", iRet);
VECTORTEXT Text = {0};
// VectorText.LockObject(&Text);
Text.Point.x = 50;
Text.Point.y = 50;
Text.Point.z = 0;
Text.pszText = "LEAD Test";
Text.Pen.LogPen.lopnColor = RGB(255,255,0);
Text.Brush.LogBrush.lbColor = RGB(0,255,0);
Text.CharHeight = 8;
Text.CharWidth = 0;
LVectorText VectorText(&Text);
// add text object
iRet = layer.AddObject(&VectorText);
if( iRet != 1 )
printf("Error adding object error[%i]\n", iRet);
// render to bitmap
LBitmapBase BitmapBase(400,400,24);
iRet = Vector.Realize(BitmapBase,TRUE);
if( iRet != 1 )
printf("Error realizing object error[%i]\n", iRet);
iRet = BitmapBase.Save("vector_test.bmp", FILE_BMP, 24, 2);
if( iRet != 1 )
printf("Error saving bitmap error[%i]\n", iRet);
Amin Dodin
LEADTOOLS Technical Support