本文整理汇总了C++中CPDF_Page::SetPrivateData方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Page::SetPrivateData方法的具体用法?C++ CPDF_Page::SetPrivateData怎么用?C++ CPDF_Page::SetPrivateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Page
的用法示例。
在下文中一共展示了CPDF_Page::SetPrivateData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
int size_x, int size_y, int rotate, int flags)
{
if (bitmap == NULL || page == NULL) return;
CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifdef _SKIA_SUPPORT_
pContext->m_pDevice = new CFX_SkiaDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap,0,TRUE);
else
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#else
pContext->m_pDevice = new CFX_FxgeDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap,0,TRUE);
else
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#endif
Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
delete pContext;
pPage->RemovePrivateData((void*)1);
}
示例2: IPauseAdapter
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags,
IFSDK_PAUSE* pause) {
if (!bitmap || !pause || pause->version != 1)
return FPDF_RENDER_FAILED;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return FPDF_RENDER_FAILED;
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifdef _SKIA_SUPPORT_
pContext->m_pDevice = new CFX_SkiaDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_SkiaDevice*)pContext->m_pDevice)
->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
else
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#else
pContext->m_pDevice = new CFX_FxgeDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_FxgeDevice*)pContext->m_pDevice)
->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
else
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#endif
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, FALSE, &IPauseAdapter);
if (pContext->m_pRenderer)
return CPDF_ProgressiveRenderer::ToFPDFStatus(
pContext->m_pRenderer->GetStatus());
return FPDF_RENDER_FAILED;
}
示例3: renderPageBitmap
static void renderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int destLeft, int destTop,
int destRight, int destBottom, SkMatrix* transform, int flags) {
// Note: this code ignores the currently unused RENDER_NO_NATIVETEXT,
// FPDF_RENDER_LIMITEDIMAGECACHE, FPDF_RENDER_FORCEHALFTONE, FPDF_GRAYSCALE,
// and FPDF_ANNOT flags. To add support for that refer to FPDF_RenderPage_Retail
// in fpdfview.cpp
CRenderContext* pContext = FX_NEW CRenderContext;
CPDF_Page* pPage = (CPDF_Page*) page;
pPage->SetPrivateData((void*) 1, pContext, DropContext);
CFX_FxgeDevice* fxgeDevice = FX_NEW CFX_FxgeDevice;
pContext->m_pDevice = fxgeDevice;
// Reverse the bytes (last argument TRUE) since the Android
// format is ARGB while the renderer uses BGRA internally.
fxgeDevice->Attach((CFX_DIBitmap*) bitmap, 0, TRUE);
CPDF_RenderOptions* renderOptions = pContext->m_pOptions;
if (!renderOptions) {
renderOptions = FX_NEW CPDF_RenderOptions;
pContext->m_pOptions = renderOptions;
}
if (flags & FPDF_LCD_TEXT) {
renderOptions->m_Flags |= RENDER_CLEARTYPE;
} else {
renderOptions->m_Flags &= ~RENDER_CLEARTYPE;
}
const CPDF_OCContext::UsageType usage = (flags & FPDF_PRINTING)
? CPDF_OCContext::Print : CPDF_OCContext::View;
renderOptions->m_AddFlags = flags >> 8;
renderOptions->m_pOCContext = new CPDF_OCContext(pPage->m_pDocument, usage);
fxgeDevice->SaveState();
FX_RECT clip;
clip.left = destLeft;
clip.right = destRight;
clip.top = destTop;
clip.bottom = destBottom;
fxgeDevice->SetClip_Rect(&clip);
CPDF_RenderContext* pageContext = FX_NEW CPDF_RenderContext;
pContext->m_pContext = pageContext;
pageContext->Create(pPage);
CFX_AffineMatrix matrix;
if (!transform) {
pPage->GetDisplayMatrix(matrix, destLeft, destTop, destRight - destLeft,
destBottom - destTop, 0);
} else {
// PDF's coordinate system origin is left-bottom while
// in graphics it is the top-left, so remap the origin.
matrix.Set(1, 0, 0, -1, 0, pPage->GetPageHeight());
SkScalar transformValues[6];
transform->asAffine(transformValues);
matrix.Concat(transformValues[SkMatrix::kAScaleX], transformValues[SkMatrix::kASkewY],
transformValues[SkMatrix::kASkewX], transformValues[SkMatrix::kAScaleY],
transformValues[SkMatrix::kATransX], transformValues[SkMatrix::kATransY]);
}
pageContext->AppendObjectList(pPage, &matrix);
pContext->m_pRenderer = FX_NEW CPDF_ProgressiveRenderer;
pContext->m_pRenderer->Start(pageContext, fxgeDevice, renderOptions, NULL);
fxgeDevice->RestoreState();
pPage->RemovePrivateData((void*) 1);
delete pContext;
}
示例4: WinDC
DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
int rotate, int flags)
{
if (page==NULL) return;
CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = FX_NEW CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifndef _WIN32_WCE
CFX_DIBitmap* pBitmap = NULL;
FX_BOOL bBackgroundAlphaNeeded=FALSE;
bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
if (bBackgroundAlphaNeeded)
{
pBitmap = FX_NEW CFX_DIBitmap;
pBitmap->Create(size_x, size_y, FXDIB_Argb);
pBitmap->Clear(0x00ffffff);
#ifdef _SKIA_SUPPORT_
pContext->m_pDevice = FX_NEW CFX_SkiaDevice;
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
#else
pContext->m_pDevice = FX_NEW CFX_FxgeDevice;
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
#endif
}
else
pContext->m_pDevice = FX_NEW CFX_WindowsDevice(dc);
if (flags & FPDF_NO_CATCH)
Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
else {
try {
Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
} catch (...) {
}
}
if (bBackgroundAlphaNeeded)
{
if (pBitmap)
{
CFX_WindowsDevice WinDC(dc);
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER)
{
CFX_DIBitmap* pDst = FX_NEW CFX_DIBitmap;
pDst->Create(pBitmap->GetWidth(), pBitmap->GetHeight(),FXDIB_Rgb32);
FXSYS_memcpy(pDst->GetBuffer(), pBitmap->GetBuffer(), pBitmap->GetPitch()*pBitmap->GetHeight());
// WinDC.SetDIBits(pDst,0,0);
WinDC.StretchDIBits(pDst,0,0,size_x*2,size_y*2);
delete pDst;
}
else
WinDC.SetDIBits(pBitmap,0,0);
}
}
#else
// get clip region
RECT rect, cliprect;
rect.left = start_x;
rect.top = start_y;
rect.right = start_x + size_x;
rect.bottom = start_y + size_y;
GetClipBox(dc, &cliprect);
IntersectRect(&rect, &rect, &cliprect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
#ifdef DEBUG_TRACE
{
char str[128];
sprintf(str, "Rendering DIB %d x %d", width, height);
CPDF_ModuleMgr::Get()->ReportError(999, str);
}
#endif
// Create a DIB section
LPVOID pBuffer;
BITMAPINFOHEADER bmih;
FXSYS_memset(&bmih, 0, sizeof bmih);
bmih.biSize = sizeof bmih;
bmih.biBitCount = 24;
bmih.biHeight = -height;
bmih.biPlanes = 1;
bmih.biWidth = width;
pContext->m_hBitmap = CreateDIBSection(dc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, &pBuffer, NULL, 0);
if (pContext->m_hBitmap == NULL) {
#if defined(DEBUG) || defined(_DEBUG)
char str[128];
sprintf(str, "Error CreateDIBSection: %d x %d, error code = %d", width, height, GetLastError());
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, str);
#else
CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, NULL);
#endif
}
FXSYS_memset(pBuffer, 0xff, height*((width*3+3)/4*4));
#ifdef DEBUG_TRACE
{
//.........这里部分代码省略.........