本文整理汇总了C++中CFX_FxgeDevice::SetClip_Rect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FxgeDevice::SetClip_Rect方法的具体用法?C++ CFX_FxgeDevice::SetClip_Rect怎么用?C++ CFX_FxgeDevice::SetClip_Rect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_FxgeDevice
的用法示例。
在下文中一共展示了CFX_FxgeDevice::SetClip_Rect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}