Ejemplo n.º 1
0
void CFDE_RenderContext::RenderPath(IFDE_PathSet* pPathSet,
                                    FDE_HVISUALOBJ hPath) {
  FXSYS_assert(m_pRenderDevice != NULL);
  FXSYS_assert(pPathSet != NULL && hPath != NULL);
  IFDE_Path* pPath = pPathSet->GetPath(hPath);
  if (pPath == NULL) {
    return;
  }
  FDE_HDEVICESTATE hState;
  FX_BOOL bClip = ApplyClip(pPathSet, hPath, hState);
  int32_t iRenderMode = pPathSet->GetRenderMode(hPath);
  if (iRenderMode & FDE_PATHRENDER_Stroke) {
    IFDE_Pen* pPen = pPathSet->GetPen(hPath);
    FX_FLOAT fWidth = pPathSet->GetPenWidth(hPath);
    if (pPen != NULL && fWidth > 0) {
      m_pRenderDevice->DrawPath(pPen, fWidth, pPath, &m_Transform);
    }
  }
  if (iRenderMode & FDE_PATHRENDER_Fill) {
    IFDE_Brush* pBrush = pPathSet->GetBrush(hPath);
    if (pBrush != NULL) {
      m_pRenderDevice->FillPath(pBrush, pPath, &m_Transform);
    }
  }
  if (bClip) {
    RestoreClip(hState);
  }
}
Ejemplo n.º 2
0
/* ARGSUSED */
static void
PrevCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np)
{
    if (currentClip->prev)
    {
	SaveClip (text, currentClip);
	currentClip = currentClip->prev;
	RestoreClip (text, currentClip);
	set_button_state ();
    }
}
Ejemplo n.º 3
0
/* ARGSUSED */
static void
DeleteCurrentClip(Widget w, XEvent *ev, String *parms, Cardinal *np)
{
    ClipPtr newCurrent;

    if (currentClip->prev)
	newCurrent = currentClip->prev;
    else
	newCurrent = currentClip->next;
    if (newCurrent)
    {
	DeleteClip (text, currentClip);
	currentClip = newCurrent;
	RestoreClip (text, currentClip);
    }
    else
	EraseTextWidget ();
    set_button_state ();
}
Ejemplo n.º 4
0
void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet,
                                    FDE_HVISUALOBJ hText) {
  FXSYS_assert(m_pRenderDevice != NULL);
  FXSYS_assert(pTextSet != NULL && hText != NULL);
  IFX_Font* pFont = pTextSet->GetFont(hText);
  if (pFont == NULL) {
    return;
  }
  int32_t iCount = pTextSet->GetDisplayPos(hText, NULL, FALSE);
  if (iCount < 1) {
    return;
  }
  if (m_pSolidBrush == NULL) {
    m_pSolidBrush = (IFDE_SolidBrush*)IFDE_Brush::Create(FDE_BRUSHTYPE_Solid);
    if (m_pSolidBrush == NULL) {
      return;
    }
  }
  if (m_pCharPos == NULL) {
    m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iCount);
  } else if (m_iCharPosCount < iCount) {
    m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iCount);
  }
  if (m_iCharPosCount < iCount) {
    m_iCharPosCount = iCount;
  }
  iCount = pTextSet->GetDisplayPos(hText, m_pCharPos, FALSE);
  FX_FLOAT fFontSize = pTextSet->GetFontSize(hText);
  FX_ARGB dwColor = pTextSet->GetFontColor(hText);
  m_pSolidBrush->SetColor(dwColor);
  FDE_HDEVICESTATE hState;
  FX_BOOL bClip = ApplyClip(pTextSet, hText, hState);
  m_pRenderDevice->DrawString(m_pSolidBrush, pFont, m_pCharPos, iCount,
                              fFontSize, &m_Transform);
  if (bClip) {
    RestoreClip(hState);
  }
}