Code sample Home

Save window view into raster image file

void DemoWindowShot (HANDLE hLcWnd)
{
  HANDLE hBlock;
  double Xmin, Ymin, Xmax, Ymax;
  int    ImgW, ImgH;
  WCHAR* szRasterFile = L"d:/WndShot.png";

  // get the block, linked with CAD window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );
  
  // get size of CAD window, pixels
  ImgW = lcPropGetInt( hLcWnd, LC_PROP_WND_WIDTH );
  ImgH = lcPropGetInt( hLcWnd, LC_PROP_WND_HEIGHT );

  // get extents of currently visible drawing's area
  Xmin = lcPropGetFloat( hLcWnd, LC_PROP_WND_XMIN );
  Ymin = lcPropGetFloat( hLcWnd, LC_PROP_WND_YMIN );
  Xmax = lcPropGetFloat( hLcWnd, LC_PROP_WND_XMAX );
  Ymax = lcPropGetFloat( hLcWnd, LC_PROP_WND_YMAX );

  // rasterize the window view
  lcBlockRasterize( hBlock, szRasterFile, Xmin, Ymin, Xmax, Ymax, ImgW, ImgH );
}

See Also:

Save active block into raster image file
Convert a drawing file into raster image file
Save window view into raster image in a memory