CFX_AffineMatrix GetMatrix(CPDF_Rect rcAnnot, CPDF_Rect rcStream, CFX_AffineMatrix matrix) { if(rcStream.IsEmpty()) return CFX_AffineMatrix(); 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_AffineMatrix(a, 0, 0, d, e, f); }
FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray) { if (pFont && !pFont->IsStandardFont()) { FX_RECT rcBBox; pFont->GetFontBBox(rcBBox); CPDF_Rect 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; }
void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { CPDF_Rect rcClient = this->GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; CFX_PathData pathCross; pathCross.SetPointCount(4); pathCross.SetPoint(0, rcClient.right, rcClient.top, FXPT_MOVETO); pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.right, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); pDevice->DrawPath(&pathCross, pUser2Device, &gsd, 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); }
void CPWL_Note_Options::RePosChildWnd() { if (this->IsValid()) { ASSERT(m_pText != NULL); CPDF_Rect rcClient = GetClientRect(); if (rcClient.Width() > 15.0f) { rcClient.right -= 15.0f; m_pText->Move(rcClient, TRUE, FALSE); m_pText->SetVisible(TRUE); } else { m_pText->Move(CPDF_Rect(0,0,0,0), TRUE, FALSE); m_pText->SetVisible(FALSE); } } }