CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_Matrix mt; CFX_FloatRect rcDA; m_pWidget->GetPDFAnnot()->GetRect(rcDA); switch (m_pWidget->GetRotate()) { default: case 0: mt = CFX_Matrix(1, 0, 0, 1, 0, 0); break; case 90: mt = CFX_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); break; case 180: mt = CFX_Matrix(-1, 0, 0, -1, rcDA.right - rcDA.left, rcDA.top - rcDA.bottom); break; case 270: mt = CFX_Matrix(0, -1, 1, 0, 0, rcDA.top - rcDA.bottom); break; } mt.e += rcDA.left; mt.f += rcDA.bottom; return mt; }
void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) { if (!IsValid()) { m_sPrivateParam = cp; OnCreate(m_sPrivateParam); m_sPrivateParam.rcRectWnd.Normalize(); m_rcWindow = m_sPrivateParam.rcRectWnd; m_rcClip = CPWL_Utils::InflateRect(m_rcWindow, 1.0f); CreateMsgControl(); if (m_sPrivateParam.pParentWnd) m_sPrivateParam.pParentWnd->OnNotify(this, PNM_ADDCHILD); PWL_CREATEPARAM ccp = m_sPrivateParam; ccp.dwFlags &= 0xFFFF0000L; // remove sub styles ccp.mtChild = CFX_Matrix(1, 0, 0, 1, 0, 0); CreateScrollBar(ccp); CreateChildWnd(ccp); m_bVisible = HasFlag(PWS_VISIBLE); OnCreated(); RePosChildWnd(); m_bCreated = TRUE; } }
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); }
bool CFX_ImageTransformer::Start() { CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect(); FX_RECT result_rect = unit_rect.GetClosestRect(); FX_RECT result_clip = result_rect; if (m_pClip) result_clip.Intersect(*m_pClip); if (result_clip.IsEmpty()) return false; m_result = result_clip; if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 && FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 && FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) { int dest_width = result_rect.Width(); int dest_height = result_rect.Height(); result_clip.Offset(-result_rect.left, -result_rect.top); result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, m_pMatrix->c > 0, m_pMatrix->b < 0); m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 1; return true; } if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 && FXSYS_fabs(m_pMatrix->c) < FIX16_005) { int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a) : (int)FXSYS_floor(m_pMatrix->a); int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d) : (int)-FXSYS_floor(m_pMatrix->d); result_clip.Offset(-result_rect.left, -result_rect.top); m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 2; return true; } int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, (FX_FLOAT)(stretch_height)); stretch2dest.Concat( CFX_Matrix(m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width, m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height, m_pMatrix->e, m_pMatrix->f)); m_dest2stretch.SetReverse(stretch2dest); CFX_FloatRect clip_rect_f(result_clip); m_dest2stretch.TransformRect(clip_rect_f); m_StretchClip = clip_rect_f.GetOuterRect(); m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags); m_Stretcher->Start(); m_Status = 3; return true; }
CFX_Matrix CPWL_Image::GetImageMatrix() { if (m_pPDFStream) { if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { return pDict->GetMatrixFor("Matrix"); } } return CFX_Matrix(); }
CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) { if (pPrivateData->pPageView) { CFX_Matrix mtPageView; pPrivateData->pPageView->GetCurrentMatrix(mtPageView); CFX_Matrix mt = GetCurMatrix(); mt.Concat(mtPageView); return mt; } } return CFX_Matrix(1, 0, 0, 1, 0, 0); }
void CRF_TextPage::GetCharInfo(int index, FPDF_CHAR_INFO & info) const { if(index >= CountChars() || index < 0 || !m_pDataList) { return; } CRF_CharData* pData = (*m_pDataList)[index]; FX_FLOAT ReltiveCorddDs = pData->m_pCharState->m_fDescent; FX_FLOAT ReltiveCorddAs = pData->m_pCharState->m_fAscent; info.m_Flag = CHAR_NORMAL; info.m_pTextObj = pData->m_pCharState->m_pTextObj; info.m_OriginX = pData->m_PosX; info.m_OriginY = pData->m_PosY - ReltiveCorddDs; info.m_FontSize = pData->m_pCharState->m_fFontSize; CFX_FloatRect FloatRectTmp(pData->m_PosX, pData->m_PosY, pData->m_PosX + pData->m_Width, pData->m_PosY + ReltiveCorddAs - ReltiveCorddDs); info.m_CharBox = FloatRectTmp; CFX_WideString str = pData->m_pCharState->m_pFont->UnicodeFromCharCode(pData->m_CharCode); if(!str.IsEmpty()) { info.m_Unicode = str.GetAt(0); } else { info.m_Unicode = -1; } info.m_Charcode = (FX_WCHAR)pData->m_CharCode; info.m_Matrix = CFX_Matrix(1, 0, 0, 1, 0, 0); }
// static CFX_Matrix CFX_RenderDevice::GetFlipMatrix(float width, float height, float left, float top) { return CFX_Matrix(width, 0, 0, -height, left, top + height); }
CFX_Matrix CPWL_Wnd::GetChildMatrix() const { if (HasFlag(PWS_CHILD)) return m_sPrivateParam.mtChild; return CFX_Matrix(1, 0, 0, 1, 0, 0); }
CFX_Matrix CFX_QuartzDeviceDriver::GetCTM() const { CGAffineTransform ctm = CGContextGetCTM(_context); return CFX_Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.tx, ctm.ty); }