1.1.1.1 打印和打印预览(Printing and Print Preview)
ChoopsView支持本机Windows的打印和打印预览,这个功能由HOOPS/MFC实现Cview::OnPrint虚函数来提供。相关的HbaseView的场景将被发送到打印机。相关信息请参见HOOPS/MVO startup segment structure。
如下的ChoopsView类成员提供了底层打印逻辑控制:
m_bFastPrint: // flag enabling print optimization; if setHOOPS will print using
//software-frame-buffer logic
m_bMetaPrint: //flag enabling creation and playing of a metafile to the printer
如果需要在CHoopsView::OnPrint方法中执行程序特定逻辑,则需要在特定的CHoopsView类中实现该函数并调用基类(CHoopsView::OnPrint)来执行特定打印。
光栅输出选项
光栅输出一般需要很大的内存,特别是数据量比较大的光栅格式。在HOOPS中,GDIExportInfo提供了开发者控制光栅输出的方式。
l GDIExportInfo::bConserveMemory
l GDIExportInfo::image_dpi
如果你想修改这些值(不使用默认值),如下所示,你必须将GDIExportinfo传递到CHoopsView::OnPrint:
void MyCustomHoopsView::OnPrint( CDC*pDC, CprintInfo* pInfo )
{
GDIExportInformationoptions;
options.bConserveMemory= true; //instruct the printer to perform banding
option.image_dpi= 300; //render the rasterized portion at 300 dpi to
// produce a high-quality result
pInfo->m_lpUserData= &options;
CHoopsView::OnPrintf(pDC, pInfo );
}