Creating a Bitmap File (Using the Engine) New in Version 2025.1

www.CAD6.com

Once you started the CAD6engine and created drawing data (or had the user create/modify it by showing him the user interface), it is very simple to create a bitmap file from it.

 

Here's the basic code:

 

C++ Source Code

MKI_BITMAP_EXPORT cBitmapExport;

cBitmapExport.Init();

cBitmapExport.m_cResolution.Set( 150.0 * MKI_MATH_MM_INCH, 150.0 * MKI_MATH_MM_INCH );

cBitmapExport.m_nAntialiase = MKI_BITMAPANTIALIASING_4_TIMES;

cBitmapExport.m_nOptions    = MKI_BITMAPOPTION_TRANSPARENT;

 

MKI_RECT cRect;

MKI_PageGetQuadRect( 0, nullptr, &cRect );

MKI_RESULTVALUE nResult = MKI_DrawingExportBitmap( L"C:\\Test.png", MKI_FILTERMODE_NULL, MKI_FLAG_NULL, cBitmapExport, &cRect, nullptr );

 

It first initialized a bitmap export data set, sets the desired resolution to 150 dpi, antialiasing to 4 times, and the background to transparent. The default bitmap format of PNG remains unchanged. To alter the settings used, modify the members of cBitmapExport as required. Then, it determines the surrounding rectangle of the first page in the drawing (index 0) and uses that to create a bitmap.

 

The result will be a PNG file with all the page's contents. If the file C:\Test.png already existed before, it will be overwritten without a warning. All progress and error dialogs are suppressed.

 

CAD6interface 2026.0 - Copyright 2026 Malz++Kassner® GmbH