本文整理汇总了C++中CPDF_Page::GetPageWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Page::GetPageWidth方法的具体用法?C++ CPDF_Page::GetPageWidth怎么用?C++ CPDF_Page::GetPageWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Page
的用法示例。
在下文中一共展示了CPDF_Page::GetPageWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueryWherePopup
void CFFL_InteractiveFormFiller::QueryWherePopup(
const CPWL_Wnd::PrivateData* pAttached,
float fPopupMin,
float fPopupMax,
bool* bBottom,
float* fPopupRet) {
auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
CPDFSDK_Widget* pWidget = pData->pWidget;
CPDF_Page* pPage = pWidget->GetPDFPage();
CFX_FloatRect rcPageView(0, pPage->GetPageHeight(), pPage->GetPageWidth(), 0);
rcPageView.Normalize();
CFX_FloatRect rcAnnot = pWidget->GetRect();
float fTop = 0.0f;
float fBottom = 0.0f;
switch (pWidget->GetRotate() / 90) {
default:
case 0:
fTop = rcPageView.top - rcAnnot.top;
fBottom = rcAnnot.bottom - rcPageView.bottom;
break;
case 1:
fTop = rcAnnot.left - rcPageView.left;
fBottom = rcPageView.right - rcAnnot.right;
break;
case 2:
fTop = rcAnnot.bottom - rcPageView.bottom;
fBottom = rcPageView.top - rcAnnot.top;
break;
case 3:
fTop = rcPageView.right - rcAnnot.right;
fBottom = rcAnnot.left - rcPageView.left;
break;
}
constexpr float kMaxListBoxHeight = 140;
const float fMaxListBoxHeight =
pdfium::clamp(kMaxListBoxHeight, fPopupMin, fPopupMax);
if (fBottom > fMaxListBoxHeight) {
*fPopupRet = fMaxListBoxHeight;
*bBottom = true;
return;
}
if (fTop > fMaxListBoxHeight) {
*fPopupRet = fMaxListBoxHeight;
*bBottom = false;
return;
}
if (fTop > fBottom) {
*fPopupRet = fTop;
*bBottom = false;
} else {
*fPopupRet = fBottom;
*bBottom = true;
}
}
示例2: CheckRotate
static void CheckRotate(CPDF_Page& page, CFX_FloatRect& page_bbox)
{
int total_count = 0, rotated_count[3] = {0, 0, 0};
FX_POSITION pos = page.GetFirstObjectPosition();
while (pos) {
CPDF_PageObject* pObj = page.GetNextObject(pos);
if (pObj->m_Type != PDFPAGE_TEXT) {
continue;
}
total_count ++;
CPDF_TextObject* pText = (CPDF_TextObject*)pObj;
FX_FLOAT angle = pText->m_TextState.GetBaselineAngle();
if (angle == 0.0) {
continue;
}
int degree = (int)(angle * 180 / PI + 0.5);
if (degree % 90) {
continue;
}
if (degree < 0) {
degree += 360;
}
int index = degree / 90 % 3 - 1;
if (index < 0) {
continue;
}
rotated_count[index] ++;
}
if (total_count == 0) {
return;
}
CFX_AffineMatrix matrix;
if (rotated_count[0] > total_count * 2 / 3) {
matrix.Set(0, -1, 1, 0, 0, page.GetPageHeight());
} else if (rotated_count[1] > total_count * 2 / 3) {
matrix.Set(-1, 0, 0, -1, page.GetPageWidth(), page.GetPageHeight());
} else if (rotated_count[2] > total_count * 2 / 3) {
matrix.Set(0, 1, -1, 0, page.GetPageWidth(), 0);
} else {
return;
}
page.Transform(matrix);
page_bbox.Transform(&matrix);
}
示例3:
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height)
{
CPDF_Document* pDoc = (CPDF_Document*)document;
if(pDoc == NULL)
return FALSE;
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (pDict == NULL) return FALSE;
CPDF_Page page;
page.Load(pDoc, pDict);
*width = page.GetPageWidth();
*height = page.GetPageHeight();
return TRUE;
}