This guide explains how to use the functionality provided by the HOOPS/MFC Classes.
The HOOPS/MFC headers, export library, source code, and prebuilt release and debug dlls are located in the /dev_tools/hoops_mfc subdirectories. The /dev_tools/hoops_mfc/source directory includes the Microsoft Developer Studio Project files to enable manual rebuilding on Windows.
The HOOPS/MFC component has been tested and is supported on all the major Windows platforms including NT4.0, Win98, WinME, Win2000 and WinXP.
Within the HOOPS installation, you will find several versions of HOOPS/MFC available. Each variety offers different features that developers might find useful as a foundation for their application. Note that each library has specific linking and distribution requirements. The following is a list of the available libraries found in the <hoops>\Dev_Tools\hoops_mfc\lib\<platform> directory:
For developers with applications that do not use unicode, the HOOPS/MFC library must be rebuilt manually with the correct preprocessor directives.
The CHoopsView object supports native Windows printing and print-preview, by providing a HOOPS/MFC-specific implementation of the CView::OnPrint virtual function. The associated HBaseView's scene will be sent to the printer. Refer to the HOOPS/MVO startup segment structure.
The following CHoopsView class members provide additional HOOPS/MFC-specific control of the underlying printing logic:
If you needed to perform additional application-specific logic within the CHoopsView::OnPrint method, you could implement the function in your app-specific CHoopsView class, and call the base class (CHoopsView::OnPrint) to perform the HOOPS-specific printing.
The HOOPS/MFC-specific OnPrint logic is based on HOOPS/MVO output support, and therefore utilizes an overloaded version of the HOutputHandlerOptions class, called GDIExportInformation. This structure can be customized by modifying the CPrintInfo data as follows:
void MyCustomHoopsView::OnPrint(CDC* pDC, CPrintInfo* pInfo){GDIExportInformation options;// setup customizations to GDIExportInformation here// pass our custom options into CPrintInfopInfo->m_lpUserData = &options;CHoopsView::OnPrint(pDC, pInfo);}
HOOPS/MVO output supports 'output to scale'. See Section 4.3.2 of the HOOPS/MVO Programming Guide for more info. The following example shows how we could print the scene with a specific scaling factor:
void MyCustomHoopsView::OnPrint(CDC* pDC, CPrintInfo* pInfo){GDIExportInformation options;options.PrintToScale(1.0f); // as an example, let's set the scaling factor to indicate that 1 world-space-unit equals 1cmpInfo->m_lpUserData = &options;CHoopsView::OnPrint(pDC, pInfo);}
Generating raster output can require high memory footprint, particular on larger format devices. The following members of GDIExportInformation allow the developer to control how the raster output is generated:
If you wish to modify these values (rather than use the defaults), pass in a customer version of the GDIExportInformation structure into CHoopsView::OnPrint as follows:
void MyCustomHoopsView::OnPrint(CDC* pDC, CPrintInfo* pInfo){GDIExportInformation options;options.image_dpi = 300; // render the rasterized portion at 300 dpi to produce a high-quality resultpInfo->m_lpUserData = &options;CHoopsView::OnPrint(pDC, pInfo);}
The CHoopsView object supports Windows Copy to Clipboard by providing a HOOPS/MFC-specific implementation of the CView::OnEditCopy message map function. Similar to CHoopsView::OnPrint, the CHoopsView::OnEditCopy function will copy the associated HBaseView scene to the clipboard.
The following CHoopsView class members provide for control of the underlying clipboard logic:
m_bClipboardTruecolor; // flag enabling clipboard truecolor supportm_MetafileType; // selects metafile type; can be WMF or EMF
<p>If you needed to perform additional application-specific logic within the handling of the CHoopsView::OnEditCopy message, you could add this function to the message-map of your app-specific CHoopsView class, and call the base class (CHoopsView::OnEditCopy) to perform the HOOPS-specific
Copy to Clipboard.
Windows palette management becomes a concern when using the HOOPS MSW driver for display on 8-bit systems, which should be quite rare considering that all computer displays support 24-bit or higher color.
Nonetheless, the HOOPS/MFC Classes provide support for creating a Windows palette and sharing it among multiple CHoopsView objects, in order to support 8-bit color mode when using the MSW Driver. Creation of the shareable palette is enabled by default, but the palette needs to be accessed and passed into each HOOPS/MVO View object during it's creation.
The shared palette is accessed via the CHoopsView::GetPalette function, and passed into HOOPS via the HBaseView object's constructor. The following code is used in the CMyHoopsView constructor to pass the shared palette to HOOPS:
m_pHView = new HMyBaseView(hmodel,NULL, NULL, NULL, (long) m_hWnd, (long)(HPALETTE)*(GetPalette()));