コード例 #1
0
void TColorStyle::assignBlend(const TColorStyle &a, const TColorStyle &b,
                              double t) {
  // Blend colors
  {
    int col, colCount = getColorParamCount();
    assert(a.getColorParamCount() == colCount &&
           b.getColorParamCount() == colCount);

    for (col = 0; col != colCount; ++col)
      setColorParamValue(
          col, blend(a.getColorParamValue(col), b.getColorParamValue(col), t));
  }

  // Blend parameters
  {
    int par, parCount = getParamCount();
    assert(a.getParamCount() == parCount && b.getParamCount() == parCount);

    for (par = 0; par != parCount; ++par) {
      switch (getParamType(par)) {
      case DOUBLE:
        setParamValue(par, (1 - t) * a.getParamValue(double_tag(), par) +
                               t * b.getParamValue(double_tag(), par));
        break;
      default:
        break;
      }
    }
  }

  invalidateIcon();
}
コード例 #2
0
ファイル: ostoolbarwnd.cpp プロジェクト: bizzehdee/wasabi
int OSToolBarWnd::onLeftButtonDown(int x, int y) {
  OSTOOLBARWND_PARENT::onLeftButtonDown(x, y);
  if (m_hilite) invalidateIcon(m_hilite);
  foreach(m_entries)
    RECT ir = m_entries.getfor()->getLastRect();
    if (Std::pointInRect(&ir, x, y)) {
      m_last_pushed = foreach_index;
      break;
    }
  endfor
  m_down = 1;
  return 1;
}
コード例 #3
0
ファイル: ostoolbarwnd.cpp プロジェクト: bizzehdee/wasabi
void OSToolBarWnd::localMouseMove(int x, int y) {
  OSToolBarEntry *old = m_hilite;
  OSToolBarEntry *at = getEntryAt(x, y);
  if (!at) {
    if (m_hilite) {
      onLeaveIcon(m_hilite);
      m_hilite = NULL;
    }
  } else {
    if (at != m_hilite) {
      if (m_hilite) onLeaveIcon(m_hilite);
      m_hilite = at;
      onEnterIcon(m_hilite);
    } else {
      // repaint current in case its animated -BU
      invalidateIcon(m_hilite);
    }
  }
  if (!old && m_hilite) beginCapture();
  else if (old && !m_hilite) endCapture();
}
コード例 #4
0
void TMyPaintBrushStyle::loadBrush(const TFilePath &path) {
  m_path = path;
  m_fullpath = decodePath(path);
  m_brushOriginal.fromDefaults();

  Tifstream is(m_fullpath);
  if (is) {
    std::string str;
    str.assign( std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>() );
    m_brushOriginal.fromString(str);
  }

  m_brushModified = m_brushOriginal;
  std::map<MyPaintBrushSetting, float> baseValuesCopy;
  baseValuesCopy.swap(m_baseValues);
  for(std::map<MyPaintBrushSetting, float>::const_iterator i = baseValuesCopy.begin(); i != baseValuesCopy.end(); ++i)
    setBaseValue(i->first, i->second);

  TFilePath preview_path = m_fullpath.getParentDir() + (m_fullpath.getWideName() + L"_prev.png");
  TImageReader::load(preview_path, m_preview);

  invalidateIcon();
}
コード例 #5
0
ファイル: ostoolbarwnd.cpp プロジェクト: bizzehdee/wasabi
void OSToolBarWnd::onEnterIcon(OSToolBarEntry *entry) {
  invalidateIcon(entry);
  delete m_tip;
  m_tip = new OSToolTip(entry->getTooltip());
  m_tip->init(this);
}
コード例 #6
0
ファイル: ostoolbarwnd.cpp プロジェクト: bizzehdee/wasabi
void OSToolBarWnd::onLeaveIcon(OSToolBarEntry *entry) {
  invalidateIcon(entry);
  delete m_tip;
  m_tip = NULL;
}