本文整理汇总了C++中CFX_FloatRect::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FloatRect::IsEmpty方法的具体用法?C++ CFX_FloatRect::IsEmpty怎么用?C++ CFX_FloatRect::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_FloatRect
的用法示例。
在下文中一共展示了CFX_FloatRect::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawThisAppearance
void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
if (IsVisible() && m_bFlash) {
CFX_FloatRect rcRect = GetCaretRect();
CFX_FloatRect rcClip = GetClipRect();
CFX_PathData path;
path.SetPointCount(2);
FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f;
FX_FLOAT fCaretTop = rcRect.top;
FX_FLOAT fCaretBottom = rcRect.bottom;
if (!rcClip.IsEmpty()) {
rcRect.Intersect(rcClip);
if (!rcRect.IsEmpty()) {
fCaretTop = rcRect.top;
fCaretBottom = rcRect.bottom;
path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO);
path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO);
} else {
return;
}
} else {
path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO);
path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO);
}
CFX_GraphStateData gsd;
gsd.m_LineWidth = m_fWidth;
pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
FXFILL_ALTERNATE);
}
}
示例2: IsSameTextObject
bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1,
CPDF_TextObject* pTextObj2) {
if (!pTextObj1 || !pTextObj2)
return false;
CFX_FloatRect rcPreObj = pTextObj2->GetRect();
const CFX_FloatRect& rcCurObj = pTextObj1->GetRect();
if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) {
float dbXdif = fabs(rcPreObj.left - rcCurObj.left);
size_t nCount = m_CharList.size();
if (nCount >= 2) {
PAGECHAR_INFO perCharTemp = m_CharList[nCount - 2];
float dbSpace = perCharTemp.m_CharBox.Width();
if (dbXdif > dbSpace)
return false;
}
}
if (!rcPreObj.IsEmpty() || !rcCurObj.IsEmpty()) {
rcPreObj.Intersect(rcCurObj);
if (rcPreObj.IsEmpty())
return false;
if (fabs(rcPreObj.Width() - rcCurObj.Width()) > rcCurObj.Width() / 2) {
return false;
}
if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize())
return false;
}
size_t nPreCount = pTextObj2->CountItems();
if (nPreCount != pTextObj1->CountItems())
return false;
// If both objects have no items, consider them same.
if (nPreCount == 0)
return true;
CPDF_TextObjectItem itemPer;
CPDF_TextObjectItem itemCur;
for (size_t i = 0; i < nPreCount; ++i) {
pTextObj2->GetItemInfo(i, &itemPer);
pTextObj1->GetItemInfo(i, &itemCur);
if (itemCur.m_CharCode != itemPer.m_CharCode)
return false;
}
CFX_PointF diff = pTextObj1->GetPos() - pTextObj2->GetPos();
float font_size = pTextObj2->GetFontSize();
float char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont());
float max_pre_size =
std::max(std::max(rcPreObj.Height(), rcPreObj.Width()), font_size);
return fabs(diff.x) <= 0.9 * char_size * font_size / 1000 &&
fabs(diff.y) <= max_pre_size / 8;
}
示例3: GetThisAppearanceStream
void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
CFX_ByteTextBuf sButton;
CFX_FloatPoint ptCenter = GetCenterPoint();
CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_FloatPoint 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";
}
}
}
示例4: DrawThisAppearance
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
CFX_PointF ptCenter = GetCenterPoint();
CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_PointF 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.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
path.AppendPoint(pt3, FXPT_TYPE::LineTo, false);
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
pDevice->DrawPath(&path, pUser2Device, nullptr,
PWL_DEFAULT_BLACKCOLOR.ToFXColor(GetTransparency()), 0,
FXFILL_ALTERNATE);
}
}
}
示例5: DrawThisAppearance
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
CFX_FloatPoint ptCenter = GetCenterPoint();
CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
CFX_FloatPoint 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, nullptr,
CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
GetTransparency()),
0, FXFILL_ALTERNATE);
}
}
}
示例6: GetTextByRect
CFX_WideString CRF_TextPage::GetTextByRect(CFX_FloatRect rect) const
{
int count;
FPDF_CHAR_INFO info;
CFX_WideString str;
CFX_FloatRect Recttmp;
FX_BOOL bstart = TRUE;
count = CountChars();
if(rect.IsEmpty()) {
return L"";
}
for(int i = 0; i < count; i++) {
GetCharInfo(i, info);
if(_IsIntersect(rect, info.m_CharBox)) {
if(bstart) {
Recttmp = info.m_CharBox;
str += info.m_Unicode;
bstart = FALSE;
} else if(_IsInsameline(Recttmp, info.m_CharBox)) {
str += info.m_Unicode;
} else {
str += L"\r\n";
Recttmp = info.m_CharBox;
str += info.m_Unicode;
}
}
}
if(str.IsEmpty()) {
return L"";
} else {
return str;
}
}
示例7: OnDraw
void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
ASSERT(pPageView);
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
if (!IsVisible(pWidget))
return;
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
if (pFormFiller && pFormFiller->IsValid()) {
pFormFiller->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device);
pAnnot->GetPDFPage();
if (m_pFormFillEnv->GetFocusAnnot() != pAnnot)
return;
CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView);
if (rcFocus.IsEmpty())
return;
CFX_PathData path;
path.AppendPoint(CFX_PointF(rcFocus.left, rcFocus.top), FXPT_TYPE::MoveTo,
false);
path.AppendPoint(CFX_PointF(rcFocus.left, rcFocus.bottom),
FXPT_TYPE::LineTo, false);
path.AppendPoint(CFX_PointF(rcFocus.right, rcFocus.bottom),
FXPT_TYPE::LineTo, false);
path.AppendPoint(CFX_PointF(rcFocus.right, rcFocus.top), FXPT_TYPE::LineTo,
false);
path.AppendPoint(CFX_PointF(rcFocus.left, rcFocus.top), FXPT_TYPE::LineTo,
false);
CFX_GraphStateData gsd;
gsd.m_DashArray = {1.0f};
gsd.m_DashPhase = 0;
gsd.m_LineWidth = 1.0f;
pDevice->DrawPath(&path, &mtUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
FXFILL_ALTERNATE);
return;
}
pFormFiller = GetFormFiller(pAnnot, false);
if (pFormFiller) {
pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, mtUser2Device);
} else {
pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal,
nullptr);
}
if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
pWidget->DrawShadow(pDevice, pPageView);
}
示例8: OnDraw
void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
FX_DWORD dwFlags) {
ASSERT(pPageView);
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) {
CFX_FloatRect 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);
}
}
示例9: GetViewBBox
FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
return pFormFiller->GetViewBBox(pPageView, pAnnot);
ASSERT(pPageView);
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
CFX_FloatRect rcWin = pPDFAnnot->GetRect();
if (!rcWin.IsEmpty()) {
rcWin.Inflate(1, 1);
rcWin.Normalize();
}
return rcWin.GetOuterRect();
}
示例10: GetMatrix
CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot,
CFX_FloatRect rcStream,
const CFX_Matrix& matrix) {
if (rcStream.IsEmpty())
return CFX_Matrix();
matrix.TransformRect(rcStream);
rcStream.Normalize();
FX_FLOAT a = rcAnnot.Width() / rcStream.Width();
FX_FLOAT d = rcAnnot.Height() / rcStream.Height();
FX_FLOAT e = rcAnnot.left - rcStream.left * a;
FX_FLOAT f = rcAnnot.bottom - rcStream.bottom * d;
return CFX_Matrix(a, 0, 0, d, e, f);
}
示例11: IsValiableRect
FX_BOOL IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) {
if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f)
return FALSE;
if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f &&
rect.bottom == 0.0f)
return FALSE;
if (!rcPage.IsEmpty()) {
if (rect.left - rcPage.left < -10.000001f ||
rect.right - rcPage.right > 10.000001f ||
rect.top - rcPage.top > 10.000001f ||
rect.bottom - rcPage.bottom < -10.000001f)
return FALSE;
}
return TRUE;
}
示例12: DrawThisAppearance
void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CFX_FloatRect rectWnd = GetWindowRect();
if (!rectWnd.IsEmpty()) {
if (HasFlag(PWS_BACKGROUND)) {
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient,
GetBackgroundColor(), GetTransparency());
}
if (HasFlag(PWS_BORDER))
CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd,
(FX_FLOAT)GetBorderWidth(), GetBorderColor(),
GetBorderLeftTopColor(GetBorderStyle()),
GetBorderRightBottomColor(GetBorderStyle()),
GetBorderStyle(), GetTransparency());
}
}
示例13: GetThisAppearanceStream
// if don't set,Get default apperance stream
void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_FloatRect rectWnd = GetWindowRect();
if (!rectWnd.IsEmpty()) {
CFX_ByteTextBuf sThis;
if (HasFlag(PWS_BACKGROUND))
sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColor());
if (HasFlag(PWS_BORDER)) {
sThis << CPWL_Utils::GetBorderAppStream(
rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(),
GetBorderLeftTopColor(GetBorderStyle()),
GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(),
GetBorderDash());
}
sAppStream << sThis;
}
}
示例14: GetViewBBox
FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
ASSERT(pPageView);
ASSERT(pAnnot);
CFX_FloatRect rcAnnot = m_pWidget->GetRect();
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
CFX_FloatRect rcWindow = pWnd->GetWindowRect();
rcAnnot = PWLtoFFL(rcWindow);
}
CFX_FloatRect rcWin = rcAnnot;
CFX_FloatRect rcFocus = GetFocusBox(pPageView);
if (!rcFocus.IsEmpty())
rcWin.Union(rcFocus);
CFX_FloatRect rect = CPWL_Utils::InflateRect(rcWin, 1);
return rect.GetOutterRect();
}
示例15: GetCaretApp
void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream,
const CFX_FloatPoint& ptOffset) {
if (IsVisible() && m_bFlash) {
CFX_ByteTextBuf sCaret;
CFX_FloatRect rcRect = GetCaretRect();
CFX_FloatRect 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;
}
}