예제 #1
0
void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS,
                               CFX_Matrix* pMatrix,
                               uint32_t dwStatus) {
  if (!IsMatchVisibleStatus(dwStatus)) {
    return;
  }
  CXFA_Value value = m_pDataAcc->GetFormValue();
  if (!value) {
    return;
  }
  CXFA_Line lineObj = value.GetLine();
  FX_ARGB lineColor = 0xFF000000;
  int32_t iStrokeType = 0;
  FX_FLOAT fLineWidth = 1.0f;
  FX_BOOL bSlope = lineObj.GetSlop();
  int32_t iCap = 0;
  CXFA_Edge edge = lineObj.GetEdge();
  if (edge) {
    if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
      return;
    }
    lineColor = edge.GetColor();
    iStrokeType = edge.GetStrokeType();
    fLineWidth = edge.GetThickness();
    iCap = edge.GetCapType();
  }
  CFX_Matrix mtRotate;
  GetRotateMatrix(mtRotate);
  if (pMatrix) {
    mtRotate.Concat(*pMatrix);
  }
  CFX_RectF rtLine;
  GetRectWithoutRotate(rtLine);
  if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
    XFA_RectWidthoutMargin(rtLine, mgWidget);
  }
  GetRectFromHand(rtLine, lineObj.GetHand(), fLineWidth);
  CFX_Path linePath;
  linePath.Create();
  if (bSlope && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) {
    linePath.AddLine(rtLine.right(), rtLine.top, rtLine.left, rtLine.bottom());
  } else {
    linePath.AddLine(rtLine.left, rtLine.top, rtLine.right(), rtLine.bottom());
  }
  CFX_Color color(lineColor);
  pGS->SaveGraphState();
  pGS->SetLineWidth(fLineWidth, TRUE);
  XFA_StrokeTypeSetLineDash(pGS, iStrokeType, iCap);
  pGS->SetStrokeColor(&color);
  pGS->SetLineCap(XFA_LineCapToFXGE(iCap));
  pGS->StrokePath(&linePath, &mtRotate);
  pGS->RestoreGraphState();
}
예제 #2
0
FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics,
                                 const CFX_Matrix* pMatrix) {
  if (!pGraphics)
    return FWL_ERR_Indefinite;
  if ((m_pProperties->m_dwStyleExes & FWL_GRIDSTYLEEXT_ShowGridLines) == 0) {
    return FWL_ERR_Succeeded;
  }
  pGraphics->SaveGraphState();
  if (pMatrix) {
    pGraphics->ConcatMatrix(pMatrix);
  }
  {
    FX_BOOL bDrawLine = FALSE;
    CFX_Path path;
    path.Create();
    int32_t iColumns = m_Columns.GetSize();
    for (int32_t i = 1; i < iColumns; i++) {
      CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]);
      if (!pColRow) {
        continue;
      }
      bDrawLine = TRUE;
      path.AddLine(pColRow->m_fActualPos, 0, pColRow->m_fActualPos,
                   m_pProperties->m_rtWidget.height);
    }
    int32_t iRows = m_Rows.GetSize();
    for (int32_t j = 1; j < iRows; j++) {
      CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[j]);
      if (!pColRow) {
        continue;
      }
      bDrawLine = TRUE;
      path.AddLine(0, pColRow->m_fActualPos, m_pProperties->m_rtWidget.width,
                   pColRow->m_fActualPos);
    }
    if (bDrawLine) {
      CFX_Color cr(0xFFFF0000);
      pGraphics->SetStrokeColor(&cr);
      pGraphics->StrokePath(&path);
    }
  }
  pGraphics->RestoreGraphState();
  return FWL_ERR_Succeeded;
}
예제 #3
0
파일: formtp.cpp 프로젝트: andoma/pdfium
void CFWL_FormTP::DrawMaximizeBox(CFX_Graphics* pGraphics,
                                  const CFX_RectF* pRect,
                                  FWLTHEME_STATE eState,
                                  FX_BOOL bMax,
                                  CFX_Matrix* pMatrix,
                                  int32_t iActive) {
  DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix);
  FX_FLOAT fWidth = pRect->width;
  FX_FLOAT fHeight = pRect->height;
  if (bMax) {
    CFX_Path path;
    path.Create();
    path.AddLine(pRect->left + 7, pRect->top + 6, pRect->left + 14,
                 pRect->top + 6);
    path.AddLine(pRect->left + 4, pRect->top + 9, pRect->left + 11,
                 pRect->top + 9);
    pGraphics->SaveGraphState();
    pGraphics->SetLineWidth(2);
    CFX_Color crStroke(0xFFFFFFFF);
    pGraphics->SetStrokeColor(&crStroke);
    pGraphics->StrokePath(&path, pMatrix);
    pGraphics->SetLineWidth(1);
    path.Clear();
    path.AddLine(pRect->left + 4, pRect->top + 10, pRect->left + 4,
                 pRect->top + 14);
    path.AddLine(pRect->left + 10, pRect->top + 10, pRect->left + 10,
                 pRect->top + 14);
    path.AddLine(pRect->left + 13, pRect->top + 7, pRect->left + 13,
                 pRect->top + 11);
    path.AddLine(pRect->left + 4, pRect->top + 14, pRect->left + 10,
                 pRect->top + 14);
    path.AddLine(pRect->left + 12, pRect->top + 11, pRect->left + 12,
                 pRect->top + 11);
    pGraphics->StrokePath(&path, pMatrix);
    pGraphics->RestoreGraphState();
  } else {
    CFX_RectF rtMax(*pRect);
    rtMax.Inflate(-5, -5);
    CFX_Path path;
    path.Create();
    path.AddRectangle(pRect->left + 5, pRect->top + 5, fWidth - 10,
                      fHeight - 10);
    path.AddRectangle(pRect->left + 6, pRect->top + 8, fWidth - 12,
                      fHeight - 14);
    pGraphics->SaveGraphState();
    CFX_Color crFill(0xFFFFFFFF);
    pGraphics->SetFillColor(&crFill);
    pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
    pGraphics->RestoreGraphState();
  }
}
예제 #4
0
void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
                                    const CFX_RectF* pRtSign,
                                    FX_ARGB argbFill,
                                    CFX_Matrix* pMatrix) {
  CFX_Path path;
  path.Create();
  FX_FLOAT fRight = pRtSign->right();
  FX_FLOAT fBottom = pRtSign->bottom();
  path.AddLine(pRtSign->left, pRtSign->top, fRight, fBottom);
  path.AddLine(pRtSign->left, fBottom, fRight, pRtSign->top);
  CFX_Color crFill(argbFill);
  pGraphics->SaveGraphState();
  pGraphics->SetStrokeColor(&crFill);
  pGraphics->SetLineWidth(1.0f);
  pGraphics->StrokePath(&path, pMatrix);
  pGraphics->RestoreGraphState();
}
예제 #5
0
파일: formtp.cpp 프로젝트: andoma/pdfium
void CFWL_FormTP::DrawCloseBox(CFX_Graphics* pGraphics,
                               const CFX_RectF* pRect,
                               FWLTHEME_STATE eState,
                               CFX_Matrix* pMatrix,
                               int32_t iActive) {
  FX_FLOAT fRight = pRect->right();
  FX_FLOAT fBottom = pRect->bottom();
  FX_FLOAT fWidth = pRect->width;
  FX_FLOAT fHeight = pRect->height;
  pGraphics->SaveGraphState();
  CFX_RectF rt(*pRect);
  pGraphics->SetLineWidth(1.0f);
  CFX_Path path;
  path.Create();
  path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1);
  path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2);
  path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2);
  path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1);
  CFX_Color crFill;
  crFill = m_pThemeData->clrBtnEdgeOut[iActive];
  pGraphics->SetFillColor(&crFill);
  pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
  path.Clear();
  path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1);
  path.AddRectangle(fRight - 2, rt.top + 1, 1, 1);
  path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1);
  path.AddRectangle(fRight - 2, fBottom - 2, 1, 1);
  crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1];
  pGraphics->SetFillColor(&crFill);
  pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
  path.Clear();
  path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1);
  path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4);
  crFill = m_pThemeData->clrCloseBtEdgeLight[iActive][eState - 1];
  pGraphics->SetFillColor(&crFill);
  pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
  path.Clear();
  path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4);
  path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1);
  crFill = m_pThemeData->clrCloseBtEdgeDark[iActive][eState - 1];
  pGraphics->SetFillColor(&crFill);
  pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
  path.Clear();
  path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4);
  DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2,
                   fBottom - 2,
                   m_pThemeData->clrCloseBtBKStart[iActive][eState - 1],
                   m_pThemeData->clrCloseBtBKEnd[iActive][eState - 1], &path,
                   FXFILL_WINDING, pMatrix);
  CFX_RectF rtX(*pRect);
  rtX.Inflate(-5, -5);
  path.Clear();
  FX_FLOAT frtXRight = rtX.right();
  FX_FLOAT frtXBottom = rtX.bottom();
  path.AddLine(rtX.left, rtX.top + 1, frtXRight - 1, frtXBottom);
  path.AddLine(rtX.left, rtX.top, frtXRight, frtXBottom);
  path.AddLine(rtX.left + 1, rtX.top, frtXRight, frtXBottom - 1);
  path.AddLine(rtX.left, frtXBottom - 1, frtXRight - 1, rtX.top);
  path.AddLine(rtX.left, frtXBottom, frtXRight, rtX.top);
  path.AddLine(rtX.left + 1, frtXBottom, frtXRight, rtX.top + 1);
  CFX_Color clrLine(0xffffffff);
  pGraphics->SetLineWidth(1.0f);
  pGraphics->SetStrokeColor(&clrLine);
  pGraphics->StrokePath(&path, pMatrix);
  pGraphics->RestoreGraphState();
}