本文整理汇总了C++中CFX_FloatRect::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FloatRect::Width方法的具体用法?C++ CFX_FloatRect::Width怎么用?C++ CFX_FloatRect::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_FloatRect
的用法示例。
在下文中一共展示了CFX_FloatRect::Width方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: DrawThisAppearance
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
if (m_pList) {
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
CFX_FloatRect rcList = GetListRect();
CFX_FloatRect rcClient = GetClientRect();
for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
CFX_FloatRect rcItem = m_pList->GetItemRect(i);
if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
continue;
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) {
CFX_FloatRect rcContent = pEdit->GetContentRect();
if (rcContent.Width() > rcClient.Width())
rcItem.Intersect(rcList);
else
rcItem.Intersect(rcClient);
}
if (m_pList->IsItemSelected(i)) {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
IFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList,
ptOffset, nullptr, pSysHandler, m_pFormFiller);
pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
} else {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
ArgbEncode(255, 0, 51, 113));
IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
ArgbEncode(255, 255, 255, 255), 0, rcList,
ptOffset, nullptr, pSysHandler, m_pFormFiller);
}
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
rcList, ptOffset, nullptr, pSysHandler, nullptr);
}
}
}
}
示例3: 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();
}
示例4: 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);
}
示例5: GetCharArrayAutoFontSize
FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont,
const CFX_FloatRect& rcPlate,
int32_t nCharArray) {
if (pFont && !pFont->IsStandardFont()) {
FX_RECT rcBBox;
pFont->GetFontBBox(rcBBox);
CFX_FloatRect rcCell = rcPlate;
FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width();
FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height();
return xdiv < ydiv ? xdiv : ydiv;
}
return 0.0f;
}
示例6: locker
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFPage_TransFormWithClip(FPDF_PAGE page,
const FS_MATRIX* matrix,
const FS_RECTF* clipRect) {
if (!matrix && !clipRect)
return false;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return false;
std::ostringstream textBuf;
textBuf << "q ";
if (clipRect) {
CFX_FloatRect rect = CFXFloatRectFromFSRECTF(*clipRect);
rect.Normalize();
textBuf << ByteString::Format("%f %f %f %f re W* n ", rect.left,
rect.bottom, rect.Width(), rect.Height());
}
if (matrix) {
textBuf << ByteString::Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,
matrix->c, matrix->d, matrix->e, matrix->f);
}
CPDF_Dictionary* pPageDict = pPage->GetDict();
CPDF_Object* pContentObj = GetPageContent(pPageDict);
if (!pContentObj)
return false;
CPDF_Document* pDoc = pPage->GetDocument();
if (!pDoc)
return false;
CPDF_Stream* pStream =
pDoc->NewIndirect<CPDF_Stream>(nullptr, 0, pDoc->New<CPDF_Dictionary>());
pStream->SetDataFromStringstream(&textBuf);
CPDF_Stream* pEndStream =
pDoc->NewIndirect<CPDF_Stream>(nullptr, 0, pDoc->New<CPDF_Dictionary>());
pEndStream->SetData(ByteStringView(" Q").span());
if (CPDF_Array* pContentArray = ToArray(pContentObj)) {
pContentArray->InsertAt(0, pStream->MakeReference(pDoc));
pContentArray->Add(pEndStream->MakeReference(pDoc));
} else if (pContentObj->IsStream() && !pContentObj->IsInline()) {
pContentArray = pDoc->NewIndirect<CPDF_Array>();
pContentArray->Add(pStream->MakeReference(pDoc));
pContentArray->Add(pContentObj->MakeReference(pDoc));
pContentArray->Add(pEndStream->MakeReference(pDoc));
pPageDict->SetFor(pdfium::page_object::kContents,
pContentArray->MakeReference(pDoc));
}
// Need to transform the patterns as well.
CPDF_Dictionary* pRes =
pPageDict->GetDictFor(pdfium::page_object::kResources);
if (!pRes)
return true;
CPDF_Dictionary* pPatternDict = pRes->GetDictFor("Pattern");
if (!pPatternDict)
return true;
CPDF_DictionaryLocker locker(pPatternDict);
for (const auto& it : locker) {
CPDF_Object* pObj = it.second.get();
if (pObj->IsReference())
pObj = pObj->GetDirect();
CPDF_Dictionary* pDict = nullptr;
if (pObj->IsDictionary())
pDict = pObj->AsDictionary();
else if (CPDF_Stream* pObjStream = pObj->AsStream())
pDict = pObjStream->GetDict();
else
continue;
if (matrix) {
CFX_Matrix m = CFXMatrixFromFSMatrix(*matrix);
pDict->SetMatrixFor("Matrix", pDict->GetMatrixFor("Matrix") * m);
}
}
return true;
}
示例7: Display
void CPDF_ProgressiveReflowPageRender::Display(IFX_Pause* pPause)
{
if (NULL == m_pReflowPage) {
m_Status = Done;
return;
}
FX_RECT clipBox = m_pFXDevice->GetClipBox();
int size = m_pReflowPage->m_pReflowed->GetSize();
if (size < 1 || NULL == m_pDisplayMatrix) {
m_Status = Done;
return;
}
for(int i = m_CurrNum; i < size; i++) {
CRF_Data* pData = (*m_pReflowPage->m_pReflowed)[i];
if(!pData) {
continue;
}
CFX_FloatRect rect (pData->m_PosX, pData->m_PosY + pData->m_Height, pData->m_PosX + pData->m_Width, pData->m_PosY);
m_pDisplayMatrix->TransformRect(rect);
if(rect.left > clipBox.right || rect.right < clipBox.left || rect.bottom > clipBox.bottom || rect.top < clipBox.top) {
continue;
}
if(pData->GetType() == CRF_Data::Text) {
CRF_CharData* pCharData = (CRF_CharData*)pData;
CPDF_Font* pPDFFont = pCharData->m_pCharState->m_pFont;
if(pPDFFont->GetFontType() == PDFFONT_TYPE3) {
continue;
}
FX_FLOAT x = pData->m_PosX, y = pData->m_PosY - pCharData->m_pCharState->m_fDescent;
FXTEXT_CHARPOS charpos ;
charpos.m_GlyphIndex = pPDFFont->GlyphFromCharCode(pCharData->m_CharCode);
charpos.m_FontCharWidth = pPDFFont->m_Font.GetGlyphWidth(charpos.m_GlyphIndex);
charpos.m_OriginX = x;
charpos.m_OriginY = y;
FX_FLOAT charW = pData->m_Width * 1000 / pData->m_Height;
if(charW != charpos.m_FontCharWidth) {
charpos.m_bGlyphAdjust = TRUE;
charpos.m_AdjustMatrix[0] = charW / charpos.m_FontCharWidth;
charpos.m_AdjustMatrix[1] = 0;
charpos.m_AdjustMatrix[2] = 0;
charpos.m_AdjustMatrix[3] = 1;
} else {
charpos.m_bGlyphAdjust = FALSE;
}
FX_BOOL bRet = FALSE;
if(m_DisplayColor == -1)
bRet = m_pFXDevice->DrawNormalText(1, &charpos, &(pPDFFont->m_Font),
NULL, pCharData->m_pCharState->m_fFontSize,
m_pDisplayMatrix, pCharData->m_pCharState->m_Color + 0xff000000, FXTEXT_CLEARTYPE);
else
bRet = m_pFXDevice->DrawNormalText(1, &charpos, &(pPDFFont->m_Font),
NULL, pCharData->m_pCharState->m_fFontSize, m_pDisplayMatrix, m_DisplayColor, FXTEXT_CLEARTYPE);
} else if(pData->GetType() == CRF_Data::Image) {
CRF_ImageData* pImageData = (CRF_ImageData*)pData;
if(!pImageData->m_pBitmap) {
continue;
}
int left = 0, top = 0;
CFX_DIBitmap* pDiBmp = NULL;
CFX_DIBSource* pDispSource = pImageData->m_pBitmap;
if(pImageData->m_Matrix.d < 0) {
CFX_AffineMatrix matrix(pImageData->m_Matrix.a, 0, 0, -pImageData->m_Matrix.d, 0, 0);
int left, top;
pDiBmp = pImageData->m_pBitmap->TransformTo(&matrix, left, top);
pDispSource = pDiBmp;
}
if (NULL == pDispSource) {
continue;
}
if (pDispSource->GetFormat() == FXDIB_1bppMask || pDispSource->GetFormat() == FXDIB_8bppMask) {
m_pFXDevice->StretchBitMask(pDispSource, (int)(rect.left + 0.5), (int)(rect.bottom + 0.5), (int)(rect.Width() + 0.5), (int)(rect.Height() + 0.5), 0xff000000);
} else {
m_pFXDevice->StretchDIBits(pDispSource, (int)(rect.left + 0.5), (int)(rect.bottom + 0.5), (int)(rect.Width() + 0.5), (int)(rect.Height() + 0.5));
}
if(m_pFXDevice->GetBitmap() && m_pFXDevice->GetBitmap()->GetFormat() == FXDIB_8bppRgb &&
m_pFXDevice->GetBitmap()->GetPalette() == NULL) {
int nPalette = 0;
switch(m_DitherBits) {
case 0:
nPalette = 0;
break;
case 1:
nPalette = 2;
break;
case 2:
nPalette = 4;
break;
case 3:
nPalette = 8;
break;
case 4:
nPalette = 16;
break;
case 5:
nPalette = 32;
break;
case 6:
nPalette = 64;
break;
case 7:
//.........这里部分代码省略.........