Code sample Home

Create entities with semi-transparent filling
void DemoTranspFill (HANDLE hLcWnd)
{
  HANDLE hDrw, hBlock, hTStyle, hEnt;

  // get a drawing and a block, linked with CAD window
  hDrw = lcPropGetHandle( hLcWnd, LC_PROP_WND_DRW );
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );

  // get active text style
  hTStyle = lcPropGetHandle( hDrw, LC_PROP_DRW_TEXTSTYLE );
  // set font "Arial"
  lcPropPutStr( hTStyle, LC_PROP_TSTYLE_FONT, L"Arial" );
  lcPropPutBool( hTStyle, LC_PROP_TSTYLE_SOLID, true );

  // add bottom text (yellow)
  hEnt = lcBlockAddText2( hBlock, L"0123456789", 15.8, 36.9, LC_TA_CENTER, 5.0, 1.0, 45*LC_DEG_TO_RAD, false );
  lcPropPutStr( hEnt, LC_PROP_ENT_COLOR, L"255,255,0" );

  // add red rectangle
  hEnt = lcBlockAddRect( hBlock, 7,38, 30,20, 0, true );
  lcPropPutStr( hEnt, LC_PROP_ENT_FCOLOR, L"255,0,0" );
  lcPropPutInt( hEnt, LC_PROP_ENT_FALPHA, 120 );

  // add green circle
  hEnt = lcBlockAddCircle( hBlock, 20,33, 10, true );
  lcPropPutStr( hEnt, LC_PROP_ENT_FCOLOR, L"0,255,0" );
  lcPropPutInt( hEnt, LC_PROP_ENT_FALPHA, 120 );

  // add blue polygon
  hEnt = lcBlockAddPolyline( hBlock, 0, true, true );
  lcPlineAddVer( hEnt, 0,  0,34 ); 
  lcPlineAddVer( hEnt, 0,  8,54 ); 
  lcPlineAddVer( hEnt, 0, 20,56 ); 
  lcPlineAddVer( hEnt, 0, 39,40 ); 
  lcPlineEnd( hEnt );
  lcPropPutStr( hEnt, LC_PROP_ENT_FCOLOR, L"0,0,255" );
  lcPropPutInt( hEnt, LC_PROP_ENT_FALPHA, 120 );

  // update view
  lcBlockUpdate( hBlock, LC_TRUE, 0 );
  // zoom extents
  lcWndZoomRect( hLcWnd, 0, 0, 0, 0 );
}
This will create a drawing as shown on the picture below:



See Also:

Create a closed polylines with linear filling
Create simple entities