当前位置: 首页>>代码示例>>C++>>正文


C++ CPDF_Rect类代码示例

本文整理汇总了C++中CPDF_Rect的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Rect类的具体用法?C++ CPDF_Rect怎么用?C++ CPDF_Rect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CPDF_Rect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FPDFPage_TransformAnnots

DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
                                                double a,
                                                double b,
                                                double c,
                                                double d,
                                                double e,
                                                double f) {
  CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
  if (!pPage)
    return;
  CPDF_AnnotList AnnotList(pPage);
  for (size_t i = 0; i < AnnotList.Count(); ++i) {
    CPDF_Annot* pAnnot = AnnotList.GetAt(i);
    // transformAnnots Rectangle
    CPDF_Rect rect;
    pAnnot->GetRect(rect);
    CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
                            (FX_FLOAT)e, (FX_FLOAT)f);
    rect.Transform(&matrix);
    CPDF_Array* pRectArray = NULL;
    pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
    if (!pRectArray)
      pRectArray = CPDF_Array::Create();
    pRectArray->SetAt(0, new CPDF_Number(rect.left));
    pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
    pRectArray->SetAt(2, new CPDF_Number(rect.right));
    pRectArray->SetAt(3, new CPDF_Number(rect.top));
    pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);

    // Transform AP's rectangle
    // To Do
  }
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: GetCaretRect

void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset)
{
	if (IsVisible() && m_bFlash)
	{
		CFX_ByteTextBuf sCaret;

		CPDF_Rect rcRect = GetCaretRect();
		CPDF_Rect rcClip = GetClipRect();

		rcRect = CPWL_Utils::OffsetRect(rcRect,ptOffset.x,ptOffset.y);
		rcClip = CPWL_Utils::OffsetRect(rcClip,ptOffset.x,ptOffset.y);

		sCaret << "q\n";
		if (!rcClip.IsEmpty())
		{
			sCaret << rcClip.left << " " << rcClip.bottom + 2.5f << " "
				<< rcClip.right - rcClip.left << " " << rcClip.top - rcClip.bottom - 4.5f << " re W n\n";
		}
		sCaret << m_fWidth << " w\n0 G\n";
		sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.bottom << " m\n";
		sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.top << " l S\nQ\n";

		sAppStream << sCaret;
	}
}
开发者ID:abbro-ca,项目名称:pdfium,代码行数:25,代码来源:PWL_Caret.cpp

示例3: DrawThisAppearance

void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                       CPDF_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CPDF_Point ptCenter = GetCenterPoint();

    CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      CFX_PathData path;

      path.SetPointCount(4);
      path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
      path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
      path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
      path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);

      pDevice->DrawPath(&path, pUser2Device, NULL,
                        CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
                                                      GetTransparency()),
                        0, FXFILL_ALTERNATE);
    }
  }
}
开发者ID:azunite,项目名称:libpdfium,代码行数:35,代码来源:PWL_ComboBox.cpp

示例4: GetPageLinks

CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
                                        FX_FLOAT pdf_x,
                                        FX_FLOAT pdf_y,
                                        int* z_order) {
  const std::vector<CPDF_Dictionary*>* pPageLinkList = GetPageLinks(pPage);
  if (!pPageLinkList)
    return CPDF_Link();

  for (size_t i = pPageLinkList->size(); i > 0; --i) {
    size_t annot_index = i - 1;
    CPDF_Dictionary* pAnnot = (*pPageLinkList)[annot_index];
    if (!pAnnot)
      continue;

    CPDF_Link link(pAnnot);
    CPDF_Rect rect = link.GetRect();
    if (!rect.Contains(pdf_x, pdf_y))
      continue;

    if (z_order)
      *z_order = annot_index;
    return link;
  }
  return CPDF_Link();
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:25,代码来源:doc_link.cpp

示例5: ScrollBarShouldVisible

FX_BOOL CPWL_Note::ScrollBarShouldVisible()
{
	CPDF_Rect rcContentsFact = m_pContents->GetScrollArea();
	CPDF_Rect rcContentsClient = m_pContents->GetClientRect();

	return rcContentsFact.Height() > rcContentsClient.Height();	
}
开发者ID:HelloZhu,项目名称:PDFium.js,代码行数:7,代码来源:PWL_Note.cpp

示例6: OnMouseWheel

FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
{
	CPDF_Point ptScroll = m_pContents->GetScrollPos();
	CPDF_Rect rcScroll = m_pContents->GetScrollArea();
	CPDF_Rect rcContents = m_pContents->GetClientRect();

	if (rcScroll.top - rcScroll.bottom > rcContents.Height())
	{
		CPDF_Point ptNew = ptScroll;

		if (zDelta > 0)
			ptNew.y += 30;
		else
			ptNew.y -= 30;

		if (ptNew.y > rcScroll.top)
			ptNew.y = rcScroll.top;
		if (ptNew.y < rcScroll.bottom + rcContents.Height())
			ptNew.y = rcScroll.bottom + rcContents.Height();
		if (ptNew.y < rcScroll.bottom)
			ptNew.y = rcScroll.bottom;

		if (ptNew.y != ptScroll.y)
		{
			m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
			m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (FX_INTPTR)&ptNew.y);			
			m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (FX_INTPTR)&ptNew.y);

			return TRUE;
		}
	}

	return FALSE;
}
开发者ID:HelloZhu,项目名称:PDFium.js,代码行数:34,代码来源:PWL_Note.cpp

示例7: GetThisAppearanceStream

void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
  CPWL_Wnd::GetThisAppearanceStream(sAppStream);

  CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect();

  if (IsVisible() && !rectWnd.IsEmpty()) {
    CFX_ByteTextBuf sButton;

    CPDF_Point ptCenter = GetCenterPoint();

    CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
                   ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
    CPDF_Point pt3(ptCenter.x,
                   ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);

    if (IsFloatBigger(rectWnd.right - rectWnd.left,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
        IsFloatBigger(rectWnd.top - rectWnd.bottom,
                      PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
      sButton << "0 g\n";
      sButton << pt1.x << " " << pt1.y << " m\n";
      sButton << pt2.x << " " << pt2.y << " l\n";
      sButton << pt3.x << " " << pt3.y << " l\n";
      sButton << pt1.x << " " << pt1.y << " l f\n";

      sAppStream << "q\n" << sButton << "Q\n";
    }
  }
}
开发者ID:azunite,项目名称:libpdfium,代码行数:31,代码来源:PWL_ComboBox.cpp

示例8: ASSERT

FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot)
{
	if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
	{
		return pFormFiller->GetViewBBox(pPageView, pAnnot);
	}
	else
	{
		ASSERT(pPageView != NULL);
		ASSERT(pAnnot != NULL);

		CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
		ASSERT(pPDFAnnot != NULL);

		CPDF_Rect rcAnnot;
		pPDFAnnot->GetRect(rcAnnot);

// 		CRect rcWin;
// 		pPageView->DocToWindow(rcAnnot, rcWin);
		CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1);
//		rcWin.InflateRect(1, 1);

		return rcWin.GetOutterRect();
	}
}
开发者ID:151706061,项目名称:PDFium,代码行数:25,代码来源:FFL_IFormFiller.cpp

示例9:

FX_BOOL	CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point)
{
	CPDF_Rect rc = pAnnot->GetRect();
	if(rc.Contains(point.x, point.y))
		return TRUE;
	return FALSE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:7,代码来源:FFL_IFormFiller.cpp

示例10: GetClientRect

void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) {
  CPDF_Rect rcClient = GetClientRect();

  if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) {
    CPDF_Rect rcOrigin = pItem->GetWindowRect();
    CPDF_Rect rcWnd = pItem->ChildToParent(rcOrigin);

    if (!(rcWnd.bottom > rcClient.bottom && rcWnd.top < rcClient.top)) {
      CPDF_Point ptScroll = GetScrollPos();

      if (rcWnd.top > rcClient.top) {
        ptScroll.y = rcOrigin.top;
      } else if (rcWnd.bottom < rcClient.bottom) {
        ptScroll.y = rcOrigin.bottom + rcClient.Height();
      }

      SetScrollPos(ptScroll);
      ResetFace();
      InvalidateRect();
      if (CPWL_Wnd* pParent = GetParentWindow()) {
        pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
                          (intptr_t)&ptScroll.y);
      }
    }
  }
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:26,代码来源:PWL_IconList.cpp

示例11: ASSERT

FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
                                        CPDFSDK_Annot* pAnnot,
                                        const CPDF_Point& point) {
  ASSERT(pPageView);
  ASSERT(pAnnot);

  CPDF_Rect rect = GetViewBBox(pPageView, pAnnot);
  return rect.Contains(point.x, point.y);
}
开发者ID:andoma,项目名称:pdfium,代码行数:9,代码来源:fsdk_annothandler.cpp

示例12: FFLtoWnd

CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
  if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
    CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
    CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
    if (rcPage.Contains(rcFocus))
      return rcFocus;
  }
  return CPDF_Rect(0, 0, 0, 0);
}
开发者ID:azunite,项目名称:libpdfium,代码行数:9,代码来源:FFL_FormFiller.cpp

示例13: annotIterator

CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX,
                                                   FX_FLOAT pageY) {
  CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
  CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
  CPDFSDK_AnnotIterator annotIterator(this, false);
  while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
    CPDF_Rect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
    if (rc.Contains(pageX, pageY))
      return pSDKAnnot;
  }

  return nullptr;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例14: OnLButtonDown

FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
                                   CPDFSDK_Annot* pAnnot,
                                   FX_UINT nFlags,
                                   const CPDF_Point& point) {
  CPDF_Rect rcAnnot = pAnnot->GetRect();
  if (!rcAnnot.Contains(point.x, point.y))
    return FALSE;

  m_bMouseDown = TRUE;
  m_bValid = TRUE;
  FX_RECT rect = GetViewBBox(pPageView, pAnnot);
  InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
  return TRUE;
}
开发者ID:azunite,项目名称:libpdfium,代码行数:14,代码来源:FFL_FormFiller.cpp

示例15: ASSERT

void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
                              /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
                              CFX_RenderDevice* pDevice,
                              CPDF_Matrix* pUser2Device,
                              /*const CRect& rcWindow,*/ FX_DWORD dwFlags) {
    ASSERT(pPageView != NULL);
    CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;

    if (IsVisible(pWidget)) {
        if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
            if (pFormFiller->IsValid()) {
                pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
                pAnnot->GetPDFPage();

                CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
                if (pDocument->GetFocusAnnot() == pAnnot) {
                    CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView);
                    if (!rcFocus.IsEmpty()) {
                        CFX_PathData path;
                        path.SetPointCount(5);
                        path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO);
                        path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO);
                        path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO);
                        path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO);
                        path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO);

                        CFX_GraphStateData gsd;
                        gsd.SetDashCount(1);
                        gsd.m_DashArray[0] = 1.0f;
                        gsd.m_DashPhase = 0;
                        gsd.m_LineWidth = 1.0f;
                        pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
                                          ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE);
                    }
                }
                return;
            }
        }

        if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
            pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
                                        dwFlags);
        else
            pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);

        if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
            pWidget->DrawShadow(pDevice, pPageView);
    }
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:49,代码来源:FFL_IFormFiller.cpp


注:本文中的CPDF_Rect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。