void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics,
                                    const CFX_RectF* pRect,
                                    FX_BOOL bVert,
                                    FWLTHEME_STATE eState,
                                    FX_BOOL bPawButton,
                                    CFX_Matrix* pMatrix) {
  if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) {
    return;
  }
  CFX_Path path;
  path.Create();
  CFX_RectF rect(*pRect);
  if (bVert) {
    rect.Deflate(1, 0);
    if (rect.IsEmpty(0.1f)) {
      return;
    }
    path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
    DrawAxialShading(pGraphics, rect.left, rect.top, rect.right(), rect.top,
                     m_pThemeData->clrBtnBK[eState - 1][0],
                     m_pThemeData->clrBtnBK[eState - 1][1], &path,
                     FXFILL_WINDING, pMatrix);
    CFX_Color rcStroke;
    rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]);
    pGraphics->SaveGraphState();
    pGraphics->SetStrokeColor(&rcStroke);
    pGraphics->StrokePath(&path, pMatrix);
    pGraphics->RestoreGraphState();
  } else {
    rect.Deflate(0, 1);
    if (rect.IsEmpty(0.1f)) {
      return;
    }
    path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
    DrawAxialShading(pGraphics, rect.left, rect.top, rect.left, rect.bottom(),
                     m_pThemeData->clrBtnBK[eState - 1][0],
                     m_pThemeData->clrBtnBK[eState - 1][1], &path,
                     FXFILL_WINDING, pMatrix);
    CFX_Color rcStroke;
    rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]);
    pGraphics->SaveGraphState();
    pGraphics->SetStrokeColor(&rcStroke);
    pGraphics->StrokePath(&path, pMatrix);
    pGraphics->RestoreGraphState();
  }
}
Exemple #2
0
void CFX_RGBLed::Commit()
{
  if (Changed())
  {
    CFX_Color newcolor;
    
    uint8_t brightness = GetBrightness();
    if (brightness == 255)
    {
      newcolor = m_color;
    }
    else
    {
      float factor = (float)brightness/255;
      newcolor = m_color * factor;
    }
    
    if (m_commonAnode)
    {
      analogWrite(m_redpin, 255 - newcolor.Red());
      analogWrite(m_greenpin, 255 - newcolor.Green());
      analogWrite(m_bluepin, 255 - newcolor.Blue());
    }
    else
    {
      analogWrite(m_redpin, newcolor.Red());
      analogWrite(m_greenpin, newcolor.Green());
      analogWrite(m_bluepin, newcolor.Blue());
    }
    SetChanged(false);
  }
}
void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics,
                            const CFX_RectF* pRect,
                            FWLTHEME_STATE eState,
                            CFX_Matrix* pMatrix) {
  CFX_Path path;
  InitializeArrowColorData();

  FX_FLOAT fRight = pRect->right();
  FX_FLOAT fBottom = pRect->bottom();
  path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
  DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom,
                   m_pColorData->clrStart[eState - 1],
                   m_pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING,
                   pMatrix);

  CFX_Color rcStroke;
  rcStroke.Set(m_pColorData->clrBorder[eState - 1]);
  pGraphics->SetStrokeColor(&rcStroke);
  pGraphics->StrokePath(&path, pMatrix);
}
Exemple #4
0
void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics,
                            const CFX_RectF* pRect,
                            FWLTHEME_STATE eState,
                            CFX_Matrix* pMatrix) {
  CFX_Path path;
  path.Create();
  if (!CFWL_ArrowData::IsInstance()) {
    CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID));
  }
  CFWL_ArrowData::CColorData* pColorData =
      CFWL_ArrowData::GetInstance()->m_pColorData;
  FX_FLOAT fRight = pRect->right();
  FX_FLOAT fBottom = pRect->bottom();
  path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
  DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom,
                   pColorData->clrStart[eState - 1],
                   pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING,
                   pMatrix);
  CFX_Color rcStroke;
  rcStroke.Set(pColorData->clrBorder[eState - 1]);
  pGraphics->SetStrokeColor(&rcStroke);
  pGraphics->StrokePath(&path, pMatrix);
}