本文整理汇总了C++中PD_Document::readFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ PD_Document::readFromFile方法的具体用法?C++ PD_Document::readFromFile怎么用?C++ PD_Document::readFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PD_Document
的用法示例。
在下文中一共展示了PD_Document::readFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makePngPreview
bool AP_UnixApp::makePngPreview(const char * pszInFile, const char * pszPNGFile, UT_sint32 iWidth, UT_sint32 iHeight)
{
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, iWidth, iHeight);
cairo_t *cr = cairo_create (surface);
GR_UnixCairoAllocInfo ai(NULL, false);
GR_CairoGraphics * pG = static_cast<GR_CairoGraphics*>(GR_UnixCairoGraphics::graphicsAllocator(ai));
pG->setCairo(cr);
pG->beginPaint(); // needed to avoid cairo reference loss
UT_Error error = UT_OK;
PD_Document * pNewDoc = new PD_Document();
error = pNewDoc->readFromFile(pszInFile,IEFT_Unknown, NULL);
if (error != UT_OK)
{
return false;
}
AP_Preview_Abi * pPrevAbi = new AP_Preview_Abi(pG,iWidth,iHeight,NULL, PREVIEW_ZOOMED,pNewDoc);
dg_DrawArgs da;
memset(&da, 0, sizeof(da));
da.pG = pG;
GR_Painter * pPaint = new GR_Painter(pG);
pPaint->clearArea(0,0,pG->tlu(iWidth),pG->tlu(iHeight));
pPrevAbi->getView()->draw(0, &da);
pG->endPaint();
cairo_destroy(cr);
DELETEP(pPaint);
cairo_surface_write_to_png(surface, pszPNGFile);
cairo_surface_destroy(surface);
DELETEP(pG);
DELETEP(pPrevAbi); // This deletes pNewDoc
return true;
}