本文整理汇总了C++中CFX_FloatRect类的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FloatRect类的具体用法?C++ CFX_FloatRect怎么用?C++ CFX_FloatRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFX_FloatRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCaretRect
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: GetPath
CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
CFX_FloatRect rect;
bool bStarted = false;
if (GetPathCount() > 0) {
rect = GetPath(0).GetBoundingBox();
for (size_t i = 1; i < GetPathCount(); ++i) {
CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
rect.Intersect(path_rect);
}
bStarted = true;
}
CFX_FloatRect layer_rect;
bool bLayerStarted = false;
for (size_t i = 0; i < GetTextCount(); ++i) {
CPDF_TextObject* pTextObj = GetText(i);
if (pTextObj) {
if (bLayerStarted) {
layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox()));
} else {
layer_rect = CFX_FloatRect(pTextObj->GetBBox());
bLayerStarted = true;
}
} else {
if (bStarted) {
rect.Intersect(layer_rect);
} else {
rect = layer_rect;
bStarted = true;
}
bLayerStarted = false;
}
}
return rect;
}
示例3: 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);
CFX_FloatRect rect = link.GetRect();
if (!rect.Contains(pdf_x, pdf_y))
continue;
if (z_order)
*z_order = annot_index;
return link;
}
return CPDF_Link();
}
示例4: GetBBox
void CFDE_Path::GetBBox(CFX_RectF& bbox,
FX_FLOAT fLineWidth,
FX_FLOAT fMiterLimit) const {
CFX_FloatRect rect = m_Path.GetBoundingBox(fLineWidth, fMiterLimit);
bbox.Set(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
}
示例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_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);
}
}
}
示例6: GetControlAtPoint
CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
FX_FLOAT pdf_x,
FX_FLOAT pdf_y,
int* z_order) const {
CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnotList)
return nullptr;
for (size_t i = pAnnotList->GetCount(); i > 0; --i) {
size_t annot_index = i - 1;
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index);
if (!pAnnot)
continue;
const auto it = m_ControlMap.find(pAnnot);
if (it == m_ControlMap.end())
continue;
CPDF_FormControl* pControl = it->second;
CFX_FloatRect rect = pControl->GetRect();
if (!rect.Contains(pdf_x, pdf_y))
continue;
if (z_order)
*z_order = static_cast<int>(annot_index);
return pControl;
}
return nullptr;
}
示例7: 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";
}
}
}
示例8: InvalidateRectMove
void CPWL_Wnd::InvalidateRectMove(const CFX_FloatRect& rcOld,
const CFX_FloatRect& rcNew) {
CFX_FloatRect rcUnion = rcOld;
rcUnion.Union(rcNew);
InvalidateRect(&rcUnion);
}
示例9: 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
CFX_FloatRect rect = pAnnot->GetRect();
CFX_Matrix 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 = pAnnot->GetAnnotDict()->GetArrayBy("Rect");
if (!pRectArray)
pRectArray = new CPDF_Array;
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
}
}
示例10: 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);
}
}
}
示例11: TorelanceRect
int CRF_TextPage::GetIndexAtPos(CPDF_Point point, FX_FLOAT xTorelance, FX_FLOAT yTorelance) const
{
int index = -1, i = 0, j = 0;
FPDF_CHAR_INFO info;
CFX_FloatRect rectTmp;
FX_FLOAT MinDistance = 1000, DistanceTmp = 0;
FX_FLOAT rect_bottom = point.x - xTorelance;
CFX_FloatRect TorelanceRect(rect_bottom <= 0 ? 0 : rect_bottom, point.y - yTorelance, point.x + xTorelance, point.y + yTorelance);
int count = CountChars();
for(i = 0; i < count; i++) {
GetCharInfo(i, info);
rectTmp = info.m_CharBox;
if(rectTmp.Contains(point.x, point.y)) {
index = i;
break;
} else if(_IsIntersect(rectTmp, TorelanceRect)) {
DistanceTmp = _GetDistance(rectTmp, point);
if(DistanceTmp < MinDistance) {
MinDistance = DistanceTmp;
index = i;
}
}
}
return index;
}
示例12: FXSYS_fabs
void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str)
{
if (NULL == m_pReflowed) {
return;
}
CFX_AffineMatrix revMatrix;
revMatrix.SetReverse(matrix);
FX_FLOAT x1, y1;
revMatrix.Transform((float)x, (float)y, x1, y1);
int count = m_pReflowed->GetSize();
FX_FLOAT dx = 1000, dy = 1000;
FX_INT32 pos = 0;
FX_INT32 i;
for(i = 0; i < count; i++) {
CRF_Data* pData = (*m_pReflowed)[i];
FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
if(FXSYS_fabs(tempdy - dy) < 1) {
continue;
}
CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidth, pData->m_PosY);
if(rect.Contains(x1, y1)) {
pos = i;
dx = 0;
dy = 0;
break;
} else if(tempdy < dy) {
dy = tempdy;
dx = FXSYS_fabs(pData->m_PosX - x1);
pos = i;
} else if (tempdy == dy) {
FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
if(tempdx < dx) {
dx = tempdx;
pos = i;
}
} else if (tempdy > dy) {
break;
}
}
if(dx != 0 || dy != 0) {
count = count < (pos + 10) ? count : (pos + 10);
for(i = 0 > (pos - 10) ? 0 : (pos - 10); i < count; i++) {
CRF_Data* pData = (*m_pReflowed)[i];
FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
if(tempdy < dy) {
dy = tempdy;
dx = FXSYS_fabs(pData->m_PosX - x1);
pos = i;
} else if (tempdy == dy) {
FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
if(tempdx < dx) {
dx = tempdx;
pos = i;
}
}
}
}
str.Format("%d", pos);
}
示例13: CFX_FloatRect
CFX_FloatRect CPDF_Annot::GetRect() const {
if (!m_pAnnotDict)
return CFX_FloatRect();
CFX_FloatRect rect = m_pAnnotDict->GetRectBy("Rect");
rect.Normalize();
return rect;
}
示例14: Annot_HitTest
FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_FloatPoint point) {
CFX_FloatRect rc = pAnnot->GetRect();
if (rc.Contains(point.x, point.y))
return TRUE;
return FALSE;
}
示例15: FXSYS_assert
FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice,
FX_RECT* pRect,
const CPDF_PageObject* pObj,
const CPDF_RenderOptions* pOptions,
int max_dpi) {
FXSYS_assert(pRect != NULL);
m_pDevice = pDevice;
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) {
return TRUE;
}
m_pContext = pContext;
m_Rect = *pRect;
m_pObject = pObj;
m_Matrix.TranslateI(-pRect->left, -pRect->top);
int horz_size = pDevice->GetDeviceCaps(FXDC_HORZ_SIZE);
int vert_size = pDevice->GetDeviceCaps(FXDC_VERT_SIZE);
if (horz_size && vert_size && max_dpi) {
int dpih =
pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size * 10);
int dpiv =
pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size * 10);
if (dpih > max_dpi) {
m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f);
}
if (dpiv > max_dpi) {
m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv);
}
}
m_pBitmapDevice.reset(new CFX_FxgeDevice);
FXDIB_Format dibFormat = FXDIB_Rgb;
int32_t bpp = 24;
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) {
dibFormat = FXDIB_Argb;
bpp = 32;
}
CFX_FloatRect rect;
int32_t iWidth, iHeight, iPitch;
while (1) {
rect = *pRect;
m_Matrix.TransformRect(rect);
FX_RECT bitmap_rect = rect.GetOutterRect();
iWidth = bitmap_rect.Width();
iHeight = bitmap_rect.Height();
iPitch = (iWidth * bpp + 31) / 32 * 4;
if (iWidth * iHeight < 1) {
return FALSE;
}
if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ &&
m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) {
break;
}
m_Matrix.Scale(0.5f, 0.5f);
}
m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions,
&m_Matrix);
return TRUE;
}